Skip to content

Commit

Permalink
chore(pyright): rebuild pyright pins on each buildkite build (dagster…
Browse files Browse the repository at this point in the history
…-io#20440)

## Summary & Motivation
Prevent errors like dagster-io#20406
from happening by always attempting to regenerate the pyright pins on
each build.

I could put this in a separate step and scope it down to only run if any
`requirements.txt` has changed in the `pyright/` subdirectory, but want
to see if the build time difference is negligible because of `uv` first.

## How I Tested These Changes
bk
  • Loading branch information
rexledesma authored Mar 20, 2024
1 parent 7e08c05 commit 0a33908
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
37 changes: 28 additions & 9 deletions .buildkite/dagster-buildkite/dagster_buildkite/steps/dagster.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
from ..utils import (
BuildkiteStep,
CommandStep,
GroupStep,
is_feature_branch,
is_release_branch,
safe_getenv,
skip_if_no_non_docs_markdown_changes,
skip_if_no_pyright_requirements_txt_changes,
skip_if_no_python_changes,
skip_if_no_yaml_changes,
)
Expand Down Expand Up @@ -102,17 +104,34 @@ def build_check_changelog_steps() -> List[CommandStep]:
]


def build_repo_wide_pyright_steps() -> List[CommandStep]:
def build_repo_wide_pyright_steps() -> List[BuildkiteStep]:
return [
CommandStepBuilder(":pyright: pyright")
.run(
"curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y",
"pip install uv -e python_modules/dagster[pyright] -e python_modules/dagster-pipes",
"make pyright",
GroupStep(
group=":pyright: pyright",
key="pyright",
steps=[
CommandStepBuilder(":pyright: make pyright")
.run(
"curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y",
"pip install -U uv",
"make install_pyright",
"make pyright",
)
.on_test_image(AvailablePythonVersion.get_default())
.with_skip(skip_if_no_python_changes(overrides=["pyright"]))
.build(),
CommandStepBuilder(":pyright: make rebuild_pyright_pins")
.run(
"curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y",
"pip install -U uv",
"make install_pyright",
"make rebuild_pyright_pins",
)
.on_test_image(AvailablePythonVersion.get_default())
.with_skip(skip_if_no_pyright_requirements_txt_changes())
.build(),
],
)
.on_test_image(AvailablePythonVersion.get_default())
.with_skip(skip_if_no_python_changes(overrides=["pyright"]))
.build(),
]


Expand Down
10 changes: 10 additions & 0 deletions .buildkite/dagster-buildkite/dagster_buildkite/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,16 @@ def skip_if_no_python_changes(overrides: Optional[Sequence[str]] = None):
return "No python changes"


def skip_if_no_pyright_requirements_txt_changes():
if not is_feature_branch():
return None

if any(path.match("pyright/*/requirements.txt") for path in ChangedFiles.all):
return None

return "No pyright requirements.txt changes"


def skip_if_no_yaml_changes():
if not is_feature_branch():
return None
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pyright:
python scripts/run-pyright.py --all

install_pyright:
pip install -e 'python_modules/dagster[pyright]'
pip install -e 'python_modules/dagster[pyright]' -e 'python_modules/dagster-pipes'

rebuild_pyright:
python scripts/run-pyright.py --all --rebuild
Expand Down

0 comments on commit 0a33908

Please sign in to comment.