Skip to main content

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

nab_markersets-0.0.16.tar.gz (60.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nab_markersets-0.0.16-py3-none-any.whl (31.2 kB view details)

Uploaded Python 3

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

Hashes for nab_markersets-0.0.16.tar.gz
Algorithm Hash digest
SHA256 5d4649567dcf03d565c5fba52afeddcdcf85818f1ce45279766c2db9fe25f5c8
MD5 63f3452c1bd499869d9fc8866b08629a
BLAKE2b-256 bb5bd4e28f7deb79664930552fe13a2cd6745055b43e8e97d9c897c042349cbf

See more details on using hashes here.

Provenance

The following attestation bundles were made for nab_markersets-0.0.16.tar.gz:

Publisher: release.yml on notatallshaw/nab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nab_markersets-0.0.16-py3-none-any.whl.

File metadata

File hashes

Hashes for nab_markersets-0.0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 a53985601a56cb1cec3d23180cdb36e9a16e9957d36f6f1dad98dcbefbd919b6
MD5 93558bc1898915f01ae0eb6ea71a7e52
BLAKE2b-256 e136c095d5fef21fd6075cf15ee1d78e98840d2d11061c5ec1b5bfc1ee2a8644

See more details on using hashes here.

Provenance

The following attestation bundles were made for nab_markersets-0.0.16-py3-none-any.whl:

Publisher: release.yml on notatallshaw/nab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.0.16 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page