-
Notifications
You must be signed in to change notification settings - Fork 361
Add the option to compile key modules to C using mypyc #2134
New issue
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
Open
chadrik
wants to merge
16
commits into
AcademySoftwareFoundation:main
Choose a base branch
from
chadrik:mypyc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
e8a9f42
Add use of Generic
chadrik 0e0c7ce
Safe code changes to reduce mypy errors
chadrik e88514c
asserts and riskier changes
chadrik 519a5c9
Add generics for package resources
chadrik 0e39c66
riskier change: return NotImplemented from __eq__
chadrik 8191b73
Runtime and structural changes to compile key modules to C with mypyc
chadrik 3796181
ci: build and test rez with and without mypyc
chadrik 5f1c71f
ci: update type-checking mypy to 2.1.0 to match the fork base
chadrik ec95bcf
ci: benchmark compiled (mypyc) and pure builds
chadrik e10dbd9
util: restore atexit registration of _atexit
chadrik ba19273
build_process: document why get_changelog guards on self.vcs
chadrik 79c806d
packages: document that get_latest_package args are keyword-only
chadrik 3c8d407
data_utils: drive the forwarder version type via a codegen override
chadrik 54e78d4
resolver: implement ResolverStatus.description as a property
chadrik 67c7bf7
solver: implement SolverStatus.description as a property
chadrik f19c6f2
filesystem: restore memcached pooling on the iter_* methods (inlined)
chadrik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,3 +23,5 @@ docs/source/commands/ | |
| __tests_pkg_repo/ | ||
| .idea/ | ||
| venv/ | ||
| /out* | ||
| /build* | ||
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| #pip install ../mypy | ||
| pip uninstall -y rez | ||
| pip install --no-build-isolation -e . | ||
| python -m rez.cli._main selftest --debug |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| builddir=./build | ||
|
|
||
| rm -rf $builddir | ||
| _REZ_NO_KILLPG=1 python ./install.py -v $builddir | ||
|
|
||
|
|
||
| #$builddir/bin/rez/rez-selftest | ||
|
|
||
| #_REZ_NO_KILLPG=1 ./build/bin/python -c "import rez.utils.resources; print(rez.utils.resources.__file__); " | ||
| #_REZ_NO_KILLPG=1 ./build/bin/python -c "import rez.solver; print(rez.solver.__file__)" | ||
| #_REZ_NO_KILLPG=1 ./build/bin/python -c "import rez.resolver; print(rez.resolver.__file__)" | ||
| #_REZ_NO_KILLPG=1 ./build/bin/python -c "import rez.packages; print(rez.packages.__file__)" | ||
| # ./build/bin/python -c "import rez.version._version; print(rez.version._version.__file__)" | ||
|
|
||
| ./build/bin/rez/rez-selftest | ||
|
|
||
| # ./build/bin/rez/rez-benchmark --out ./out-solver-resolver | ||
|
|
||
| # PYTHONPATH=src python -c "import rez.utils.data_utils;rez.utils.data_utils.write_all_dynamic_members()" | ||
|
|
||
| # python -m rez.cli._main selftest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,101 @@ | ||
| [build-system] | ||
| requires = ["setuptools"] | ||
| # Building rez with mypyc (the default; set REZ_MYPYC=0 to build pure-python) | ||
| # requires our fork of mypy, which carries fixes needed to compile rez. Those | ||
| # fixes are pending upstreaming; until they land, pin the fork so that an | ||
| # isolated build (pip install ., install.py, etc.) picks up the right mypy. | ||
| # | ||
| # Local testing against a working copy of the mypy fork: | ||
| # The pin below points at the *pushed* fork branch on GitHub, so an isolated | ||
| # build always fetches it from the network and ignores any local mypy changes. | ||
| # To build against a local checkout instead, either: | ||
| # (a) recommended - install the fork editable in your venv and build with | ||
| # --no-build-isolation, which uses that installed mypy and ignores the | ||
| # requirement below entirely (this is what ./mypyc-custom.sh does): | ||
| # pip install -e /path/to/mypy | ||
| # pip install --no-build-isolation -e . | ||
| # (b) for an isolated build, temporarily replace the requirement below with | ||
| # a local path (revert before committing): | ||
| # "mypy[mypyc] @ file:///path/to/mypy" | ||
| requires = ["setuptools", "mypy[mypyc] @ git+https://github.com/chadrik/mypy@rez-mypyc-fixes ; python_version >= '3.10'"] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [tool.mypy] | ||
| python_version = "3.8" | ||
| # mypy 2.1 requires the type-check target to be 3.10+, so we can no longer | ||
| # target rez's lowest supported runtime (3.8). 3.10 is the closest mypy allows. | ||
| python_version = "3.10" | ||
| files = ["src/rez/", "src/rezplugins/"] | ||
| exclude = [ | ||
| '.*/rez/data/.*', | ||
| '.*/rez/vendor/.*', | ||
| '.*/rez/tests/.*', | ||
| '.*/rez/utils/lint_helper.py', | ||
| ] | ||
| disable_error_code = ["var-annotated", "import-not-found"] | ||
| check_untyped_defs = true | ||
| # allow this for now: | ||
| allow_redefinition = true | ||
| #allow_redefinition = true | ||
| follow_imports = "silent" | ||
| enable_incomplete_feature = ["InlineTypedDict"] | ||
|
|
||
| [[tool.mypy.overrides]] | ||
| module = "rez.vendor.*" | ||
| ignore_errors = true | ||
|
|
||
| [[tool.mypy.overrides]] | ||
| module = "rez.vendor.schema.schema" | ||
| ignore_errors = false | ||
|
|
||
| [[tool.mypy.overrides]] | ||
| module = "rez.utils.formatting" | ||
| disallow_untyped_defs = true | ||
|
|
||
| [[tool.mypy.overrides]] | ||
| module = 'rez.utils.lint_helper' | ||
| follow_imports = "skip" | ||
|
|
||
| [[tool.mypy.overrides]] | ||
| module = "rez.version._version" | ||
| module = "rez.packages" | ||
| disallow_untyped_defs = true | ||
|
|
||
| [[tool.mypy.overrides]] | ||
| module = "rez.package_filter" | ||
| disallow_untyped_defs = true | ||
|
|
||
| [[tool.mypy.overrides]] | ||
| module = "rez.package_order" | ||
| disallow_untyped_defs = true | ||
|
|
||
| [[tool.mypy.overrides]] | ||
| module = "rez.package_repository" | ||
| disallow_untyped_defs = true | ||
|
|
||
| [[tool.mypy.overrides]] | ||
| module = "rez.package_resources" | ||
| disallow_untyped_defs = true | ||
|
|
||
| [[tool.mypy.overrides]] | ||
| module = "rez.solver" | ||
| disallow_untyped_defs = true | ||
|
|
||
| [[tool.mypy.overrides]] | ||
| module = "rez.resolved_context" | ||
| disallow_untyped_defs = true | ||
|
|
||
| [[tool.mypy.overrides]] | ||
| module = "rez.resolver" | ||
| disallow_untyped_defs = true | ||
|
|
||
| [[tool.mypy.overrides]] | ||
| module = "rez.version._requirement" | ||
| module = "rez.version.*" | ||
| disallow_untyped_defs = true | ||
|
|
||
| [[tool.mypy.overrides]] | ||
| module = "rez.utils.resources" | ||
| disallow_untyped_defs = true | ||
|
|
||
| [[tool.mypy.overrides]] | ||
| module = "rez.utils.scope" | ||
| disallow_untyped_defs = true | ||
|
|
||
| [[tool.mypy.overrides]] | ||
| module = "rezplugins.package_repository.filesystem" | ||
| disallow_untyped_defs = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.