Comments (2)
After reading PEP345/426 more carefully, it probably makes sense for the PythonInterpreter ID_PY script to export all the defined environment markers for that interpreter:
- python_version: '{0.major}.{0.minor}'.format(sys.version_info)
- python_full_version: see definition below
- os_name: os.name
- sys_platform: sys.platform
- platform_release: platform.release()
- platform_version: platform.version()
- platform_machine: platform.machine()
- platform_python_implementation: platform.python_implementation()
- implementation_name: sys.implementation.name
- implementation_version: see definition below
def format_full_version(info):
version = '{0.major}.{0.minor}.{0.micro}'.format(info)
kind = info.releaselevel
if kind != 'final':
version += kind[0] + str(info.serial)
return version
python_full_version = format_full_version(sys.version_info)
implementation_version = format_full_version(sys.implementation.version)
we can then just implement the PEP345/426 marker evaluator and have it run in the context of the PythonInterpreter.
the only challenge here is to build PEX files for other platforms we either need to get a handle to the remote interpreter or just fake it (e.g. if we see --platform=linux-x86_64 on the pex command line, we can't really actually support anything requiring platform_release/platform_version markers.)
from pex.
This state of affairs is now finally fully buttoned up with enhancements to PythonInterpreter
: https://github.com/pantsbuild/pex/blob/3e71bc7896935a8177e9bbe9399769c3522528dc/pex/interpreter.py#L278-L286, AbbreviatedPlatform
(--platform
): https://github.com/pantsbuild/pex/blob/2b3bdee8cd99ffab0538a63fdd36de8de356f857/pex/targets.py#L214-L238 and the introduction of CompletePlatform
(--complete-platform
): https://github.com/pantsbuild/pex/blob/2b3bdee8cd99ffab0538a63fdd36de8de356f857/pex/targets.py#L246-L280
The abbreviated --platform
case does not have enough information to form a full set of environment markers; so the surrounding code just hard fails iff solving of a resolve requires evaluating the missing env markers; otherwise, it proceeds correctly. This usually works since most env markers in the wild are python_version
markers, but it fails when it should with the remedy of supplying a --complete-platform
.
from pex.
Related Issues (20)
- ValueError: invalid literal for int() with base 10 during pex build HOT 5
- How to bootstrap external pex files within running Python interpreter HOT 23
- Finalize Python 3.13 support HOT 1
- Build fails/incomplete on requirements.txt schema not followed correctly HOT 9
- Allow subsetting a PEX lockfile in PEX format, not just pip HOT 12
- Support for pip-compile generated requirements with hashes HOT 8
- bdist_pex called from tox fails with python 3.12 HOT 7
- Regression of artifact URL due to change since pip 23.3 HOT 12
- Monkey patch warning when using PEX to run a gunicorn app HOT 6
- `pex3 lock export` can turn VCS requirements into PyPI ones, resulting in hash failures HOT 3
- A way to configure sys.executable flags at PEX runtime HOT 8
- Add support for `--override`ing transitive dependencies. HOT 1
- Add `--provided`: like `--exclude`, but require the excluded project is available at boot time.
- "Resolving wheels disallowed" error when using `--lock` and `--only-binary` HOT 3
- Add more distribution metadata parsing context to failures.
- Add support for Pip 24.2 / statically linked musl libc CPythons
- Adding support to have all command line flags respected via environment variables HOT 6
- How does pex resolve defaut `--pip-version` HOT 13
- Support `--scie-pbs-flavor`. HOT 3
- Support `--scie` for PyPy.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pex.