| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # This list is also used in make_symlinks.py, only put actual concrete paths below | ||
| # (no wildcards!). | ||
|
|
||
| _colorize.py | ||
| _pyrepl | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -11,6 +11,17 @@ like `types`, `typing`, and `collections.abc`. | |
|
|
||
| So instead, we set `mypy_path` to include this directory, | ||
| which only links modules and packages we know are safe to be | ||
| type-checked themselves and used as dependencies. | ||
| type-checked themselves and used as dependencies. See | ||
| `Lib/_pyrepl/mypy.ini` for an example. | ||
|
|
||
| See `Lib/_pyrepl/mypy.ini` for an example. | ||
| At the same time, we don't want symlinks to be checked into the | ||
| repository as they would end up being shipped as part of the source | ||
| tarballs, which can create compatibility issues with unpacking on | ||
| operating systems without symlink support. Additionally, those symlinks | ||
| would have to be part of the SBOM, which we don't want either. | ||
|
|
||
| Instead, this directory ships with a `make_symlinks.py` script, which | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityFWIW, I would be inclined to not symlink anything, and instead copy files to a separate directory to run mypy on... but then I don't use mypy and I have no idea how that would integrate with normal edit-typecheck workflows people have.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Qualitycopying files makes it annoying for a local workflow since then you have to copy the tree for every mypy run. that's too slow.
Sorry, something went wrong.
All reactions
|
||
| creates the symlinks when they are needed. This happens automatically | ||
| on GitHub Actions. You will have to run it manually for a local | ||
| type-checking workflow. Note that `make distclean` removes the symlinks | ||
| to ensure that the produced distribution is clean. | ||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| #!/usr/bin/env python3 | ||
| from __future__ import annotations | ||
|
|
||
| import argparse | ||
| import os | ||
| from pathlib import Path | ||
|
|
||
| CURRENT_DIR = Path(__file__).parent | ||
| MISC_DIR = CURRENT_DIR.parent | ||
| REPO_ROOT = MISC_DIR.parent | ||
| LIB_DIR = REPO_ROOT / "Lib" | ||
|
|
||
| parser = argparse.ArgumentParser(prog="make_symlinks.py") | ||
| parser.add_argument( | ||
| "--dry-run", | ||
| action="store_true", | ||
| help="Don't actually symlink or delete anything", | ||
| ) | ||
| parser.add_argument( | ||
| "--force", | ||
| action="store_true", | ||
| help="Delete destination paths if they exist", | ||
| ) | ||
|
|
||
| args = parser.parse_args() | ||
|
|
||
| for link in (CURRENT_DIR / ".gitignore").read_text().splitlines(): | ||
| link = link.strip() | ||
| if not link or link.startswith('#'): | ||
| continue | ||
|
|
||
| src = LIB_DIR / link | ||
| dst = CURRENT_DIR / link | ||
| src_at_root = src.relative_to(REPO_ROOT) | ||
| dst_at_root = dst.relative_to(REPO_ROOT) | ||
| if args.force: | ||
| if dst.exists(): | ||
| if args.dry_run: | ||
| print(f"{dst_at_root} already exists, would delete") | ||
| else: | ||
| print(f"{dst_at_root} already exists, deleting") | ||
| dst.unlink() | ||
| elif ( | ||
| dst.is_symlink() | ||
| and src.resolve(strict=True) == dst.resolve(strict=True) | ||
| ): | ||
| print(f"{dst_at_root} already exists, skipping") | ||
| continue | ||
|
|
||
| # we specifically want relative path links with .. | ||
| src_rel = os.path.relpath(src, CURRENT_DIR) | ||
| action = "symlinking" if not args.dry_run else "would symlink" | ||
| print(f"{action} {src_at_root} at {dst_at_root}") | ||
| if not args.dry_run: | ||
| os.symlink(src_rel, dst) |
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityIt's a pity .gitignore doesn't let you include other files.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.