nab-markersets
A PEP 508 marker read as the set of environments it selects. packaging
answers "does this marker hold here"; this answers "can these two ever both
hold", "does one imply the other", and "is this a contradiction".
Experimental. Anything here can change in any release, so pin an exact
version. The intent is to land this algebra in packaging itself, and the
shape below is what that proposal is being tried against; the discussion is
pypa/packaging#448.
>>> from nab_markersets.markersets import MarkerSet
>>> old = MarkerSet.from_marker('python_version < "3.11"')
>>> new = MarkerSet.from_marker('python_version >= "3.12"')
>>> old.is_disjoint(new)
True
A set also holds what a marker string cannot: the full set of an absent
marker, the empty set of a contradiction, and complements the grammar cannot
spell. witness returns a point in the set, which is what separates two
markers that look like one constraint.
>>> minor = MarkerSet.from_marker('python_version >= "3.11"')
>>> exact = MarkerSet.from_marker('python_full_version >= "3.11.0"')
>>> minor.equivalent(exact)
False
>>> (minor & ~exact).witness()["python_full_version"]
'3.11.0.dev0'
Installing
The engine runs on packaging's parse tree and its single-atom evaluator, and
two copies of packaging exist: the released one, and the fork
nab vendors. An extra picks which.
pip install "nab-markersets[packaging]"
pip install "nab-markersets[nab-vendored-packaging]"
The first copy at packaging>=26.3 is bound, so with both installed the fork
wins and a Marker built inside nab keeps the class the algebra tests against.
A Marker from the other copy is accepted too. With nothing that new,
importing nab_markersets.markersets fails and says what it found.
When to use it
Whether two lock entries can both apply, whether a dependency is reachable
inside your requires-python, or what a marker still says once you fix the
platform. The guide walks through those, and through what the decisions do not
decide:
https://nab.readthedocs.io/en/stable/how-to/reason-about-markers.html
The public API
The supported API is the module paths below. Everything else in the package is internal and may be renamed or relocated in any release.
nab_markersets.errors IntractableMarkerSet, UnserializableMarkerSet
nab_markersets.markersets DecisionStore, MarkerSet, variable_names
The package root binds no names, so importing nab_markersets pulls in no
submodules.
Two things before you call it. A MarkerSet comes from from_marker, full
or empty, so pickle.loads fails on one: the constructor it reaches for
refuses. And == is structural, over the tree the set was built from, where
equivalent is the semantic test.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nab_markersets-0.0.16.tar.gz.
File metadata
- Download URL: nab_markersets-0.0.16.tar.gz
- Upload date:
- Size: 60.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d4649567dcf03d565c5fba52afeddcdcf85818f1ce45279766c2db9fe25f5c8
|
|
| MD5 |
63f3452c1bd499869d9fc8866b08629a
|
|
| BLAKE2b-256 |
bb5bd4e28f7deb79664930552fe13a2cd6745055b43e8e97d9c897c042349cbf
|
Provenance
The following attestation bundles were made for nab_markersets-0.0.16.tar.gz:
Publisher:
release.yml on notatallshaw/nab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nab_markersets-0.0.16.tar.gz -
Subject digest:
5d4649567dcf03d565c5fba52afeddcdcf85818f1ce45279766c2db9fe25f5c8 - Sigstore transparency entry: 2683038262
- Sigstore integration time:
-
Permalink:
notatallshaw/nab@06270a48e7310c049dc73d7b4c52900b19614357 -
Branch / Tag:
refs/tags/v0.0.16 - Owner: https://github.com/notatallshaw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@06270a48e7310c049dc73d7b4c52900b19614357 -
Trigger Event:
release
-
Statement type:
File details
Details for the file nab_markersets-0.0.16-py3-none-any.whl.
File metadata
- Download URL: nab_markersets-0.0.16-py3-none-any.whl
- Upload date:
- Size: 31.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a53985601a56cb1cec3d23180cdb36e9a16e9957d36f6f1dad98dcbefbd919b6
|
|
| MD5 |
93558bc1898915f01ae0eb6ea71a7e52
|
|
| BLAKE2b-256 |
e136c095d5fef21fd6075cf15ee1d78e98840d2d11061c5ec1b5bfc1ee2a8644
|
Provenance
The following attestation bundles were made for nab_markersets-0.0.16-py3-none-any.whl:
Publisher:
release.yml on notatallshaw/nab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nab_markersets-0.0.16-py3-none-any.whl -
Subject digest:
a53985601a56cb1cec3d23180cdb36e9a16e9957d36f6f1dad98dcbefbd919b6 - Sigstore transparency entry: 2683038291
- Sigstore integration time:
-
Permalink:
notatallshaw/nab@06270a48e7310c049dc73d7b4c52900b19614357 -
Branch / Tag:
refs/tags/v0.0.16 - Owner: https://github.com/notatallshaw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@06270a48e7310c049dc73d7b4c52900b19614357 -
Trigger Event:
release
-
Statement type: