-
-
Notifications
You must be signed in to change notification settings - Fork 289
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
Vendor setuptools / wheel. #607
Comments
There was some discussion of this on slack (link will die eventually: https://pantsbuild.slack.com/archives/C087V4P1T/p1539287221000100). @kwlzn and I concurred vendoring would make sense with the only real downside being a need to pick up new pex releases when new features in those support libs were needed. This downside being one we mainly suffer right now though anyhow with an upper-bound on the versions we're willing to resolve that has traditionally been capped under the next major version. |
This will allow removing |
Noting that the total distribution size will increase ~6x from ~115KB to ~706KB. Vendored code ~591KB:
vs current code ~115KB:
|
I believe the full extent of the third party API surface area is constrained to |
In the end, the vendoring did not use renaming since it presented challenges executing requirement |
This change removes pex dependence on `setuptools` and `wheel` resolution at build time in favor of vendoring pinned versions. Switching to a vendoring model allows us to eliminate code that dealt with the vagaries of supporting a ~5 year span of setuptools organic growth and API drift and it also allows us to fully isolate pex build-time interpreters. Going forward more libraries could be vendored easily at the cost of pex distribution size. Three changes make this possible: 1. The `pex.vendor` module is introduced to centralize vendored distribution management including establishing vendored distribution requirements and setting up interpreters with vendored distribution extras. 2. A `pex.vendor.__main__` is introduced and run via `tox -e vendor` to actually perform vendoring of third-party distributions inside pex. This includes installing the distributions in a the `pex/vendor/_vendored` subtree and re-writing their imports (shading). 3. The `pex.third_party` module is introduced to provide runtime import support for the vendored code using a [PEP-302](https://www.python.org/dev/peps/pep-0302/) `sys.meta_path` importer. Important consequences of this change include: 1. The pex runtime that used to be vendored under `.bootstrap/_pex` is now vendored under `.bootstrap/pex` in order to support a fixed `pex.third_party` vendor shading import prefix. The PEX runtime bootstrap demotion code is made more aggressive, correct and complete as a result to support and old pex vendored runtime handing off to a newer pex distribution to support pexed pex. In addtion, the `pex.third_party` vendoring importer is re-used to expose `pex` as `_pex` for users taking advantage of `_pex.util.DistributionHelper` and its `access_zipped_assets` for a deprecation period up to pex 2.0.0. 2. Since we no longer re-name `pex` to `_pex` in the runtime, all imports are now absolute. 3. The pex build-time interpreter cache is eliminated. Since we vendor the extras needed by interpreters, setup is now cheap, fast and hermetic and needs no cache. As a result the `--interpreter-cache-dir` flag now no-ops and is deprecated for removal in pex 2.0.0. Additional changes of note include: 1. The `bdist_pex` distutils command now dogfoods the pex cli for better fidelity with standard pex tool usage. 2. The pex `setup.py` is now self-hosting and can be run by a python interpreter lacking `setuptools` and/or `wheel`; in fact, pex can be pexed via `python -sSE setup.py bdist_pex`. Replaces pex-tool#612 Fixes pex-tool#607
This change removes pex dependence on `setuptools` and `wheel` resolution at build time in favor of vendoring pinned versions. Switching to a vendoring model allows us to eliminate code that dealt with the vagaries of supporting a ~5 year span of setuptools organic growth and API drift and it also allows us to fully isolate pex build-time interpreters. Going forward more libraries could be vendored easily at the cost of pex distribution size. Three changes make this possible: 1. The `pex.vendor` module is introduced to centralize vendored distribution management including establishing vendored distribution requirements and setting up interpreters with vendored distribution extras. 2. A `pex.vendor.__main__` is introduced and run via `tox -e vendor` to actually perform vendoring of third-party distributions inside pex. This includes installing the distributions in a the `pex/vendor/_vendored` subtree and re-writing their imports (shading). 3. The `pex.third_party` module is introduced to provide runtime import support for the vendored code using a [PEP-302](https://www.python.org/dev/peps/pep-0302/) `sys.meta_path` importer. Important consequences of this change include: 1. The pex runtime that used to be vendored under `.bootstrap/_pex` is now vendored under `.bootstrap/pex` in order to support a fixed `pex.third_party` vendor shading import prefix. The PEX runtime bootstrap demotion code is made more aggressive, correct and complete as a result to support and old pex vendored runtime handing off to a newer pex distribution to support pexed pex. In addtion, the `pex.third_party` vendoring importer is re-used to expose `pex` as `_pex` for users taking advantage of `_pex.util.DistributionHelper` and its `access_zipped_assets` for a deprecation period up to pex 2.0.0. 2. Since we no longer re-name `pex` to `_pex` in the runtime, all imports are now absolute. 3. The pex build-time interpreter cache is eliminated. Since we vendor the extras needed by interpreters, setup is now cheap, fast and hermetic and needs no cache. As a result the `--interpreter-cache-dir` flag now no-ops and is deprecated for removal in pex 2.0.0. Additional changes of note include: 1. The `bdist_pex` distutils command now dogfoods the pex cli for better fidelity with standard pex tool usage. 2. The pex `setup.py` is now self-hosting and can be run by a python interpreter lacking `setuptools` and/or `wheel`; in fact, pex can be pexed via `python -sSE setup.py bdist_pex`. Replaces pex-tool#612 Fixes pex-tool#607
This change removes pex dependence on `setuptools` and `wheel` resolution at build time in favor of vendoring pinned versions. Switching to a vendoring model allows us to eliminate code that dealt with the vagaries of supporting a ~5 year span of setuptools organic growth and API drift and it also allows us to fully isolate pex build-time interpreters. Going forward more libraries could be vendored easily at the cost of pex distribution size. Three changes make this possible: 1. The `pex.vendor` module is introduced to centralize vendored distribution management including establishing vendored distribution requirements and setting up interpreters with vendored distribution extras. 2. A `pex.vendor.__main__` is introduced and run via `tox -e vendor` to actually perform vendoring of third-party distributions inside pex. This includes installing the distributions in a the `pex/vendor/_vendored` subtree and re-writing their imports (shading). 3. The `pex.third_party` module is introduced to provide runtime import support for the vendored code using a [PEP-302](https://www.python.org/dev/peps/pep-0302/) `sys.meta_path` importer. Important consequences of this change include: 1. The pex runtime that used to be vendored under `.bootstrap/_pex` is now vendored under `.bootstrap/pex` in order to support a fixed `pex.third_party` vendor shading import prefix. The PEX runtime bootstrap demotion code is made more aggressive, correct and complete as a result to support and old pex vendored runtime handing off to a newer pex distribution to support pexed pex. In addtion, the `pex.third_party` vendoring importer is re-used to expose `pex` as `_pex` for users taking advantage of `_pex.util.DistributionHelper` and its `access_zipped_assets` for a deprecation period up to pex 2.0.0. 2. Since we no longer re-name `pex` to `_pex` in the runtime, all imports are now absolute. 3. The pex build-time interpreter cache is eliminated. Since we vendor the extras needed by interpreters, setup is now cheap, fast and hermetic and needs no cache. As a result the `--interpreter-cache-dir` flag now no-ops and is deprecated for removal in pex 2.0.0. Additional changes of note include: 1. The `bdist_pex` distutils command now dogfoods the pex cli for better fidelity with standard pex tool usage. 2. The pex `setup.py` is now self-hosting and can be run by a python interpreter lacking `setuptools` and/or `wheel`; in fact, pex can be pexed via `python -sSE setup.py bdist_pex`. Replaces #612 Fixes #607
We rely on wheel and setuptools (pkg_resources) APIs heavily. Supporting changes in these APIs leads to complex and brittle code - we should vendor what we need and simplify associated code and interpreter setup in the pex build phase.
The text was updated successfully, but these errors were encountered: