Skip to content

Commit

Permalink
[DOCS-423] Fix make quick_pyright when editing docs (#23945)
Browse files Browse the repository at this point in the history
## Summary & Motivation

As title -- this makes precommit hooks work when modifying things in the
docs_beta_snippets directory (which is explicitly excluded from pyright
as it requires dagster-cloud). It's totally expected in some cases for
there to be no environment which maps to a particular file, in the case
where we are explicitly excluding that file's directory from type
checking.

Note that the function I modified is only used in the quick_pyright
script not the full pyright build that we run in CI, so this leniancy
will not impact the overall correctness of anything, it's just a matter
of avoiding local errors.

## How I Tested These Changes

## Changelog [New | Bug | Docs]

NOCHANGELOG
  • Loading branch information
OwenKephart authored Aug 27, 2024
1 parent 053612f commit 52c25d2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
6 changes: 1 addition & 5 deletions examples/docs_beta_snippets/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,5 @@
],
packages=find_packages(exclude=["test"]),
install_requires=["dagster-cloud"],
extras_require={
"test": [
"pytest",
]
},
extras_require={"test": ["pytest"]},
)
21 changes: 10 additions & 11 deletions scripts/run-pyright.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,17 +260,16 @@ def map_paths_to_envs(paths: Sequence[str]) -> Mapping[str, Sequence[str]]:
env_path_map: Dict[str, List[str]] = {}
for path in paths:
if os.path.isdir(path) or os.path.splitext(path)[1] in [".py", ".pyi"]:
try:
env = next(
(
env_path_spec["env"]
for env_path_spec in env_path_specs
if match_path(path, env_path_spec)
)
)
except StopIteration:
raise Exception(f"Could not find environment that matched path: {path}.")
env_path_map.setdefault(env, []).append(path)
env = next(
(
env_path_spec["env"]
for env_path_spec in env_path_specs
if match_path(path, env_path_spec)
),
None,
)
if env:
env_path_map.setdefault(env, []).append(path)
return env_path_map


Expand Down

1 comment on commit 52c25d2

@github-actions
Copy link

@github-actions github-actions bot commented on 52c25d2 Aug 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for dagster-docs-beta ready!

✅ Preview
https://dagster-docs-beta-psxdo13iz-elementl.vercel.app
https://dagster-docs-beta.dagster-docs.io

Built with commit 52c25d2.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.