Skip to main content

A compiler for PEP 345 environment markers.

Project description

markerlib

Compile or interpret PEP 345 environment markers.

Usage:

>>> import markerlib
>>> marker = markerlib.compile("os.name == 'posix'")
>>> marker(environment=markerlib.default_environment(),
           override={'os.name':'posix'})
True
>>> marker(environment=markerlib.default_environment(),
           override={'os.name':'nt'})
False

The implementation uses the ast to compile environment markers as Python statements with a limited set of allowed node types.

0.5

  • One final release until it’s just a part of distribute

0.4

  • Cache compiled marker functions with weakref.WeakValueDictionary

  • Rename markerlib.as_function to markerlib.compile

0.3

  • Might work on Python 2.5 (includes needed parts of the ast module from Python 2.6+)

  • Include 100% test coverage, tox config file

0.1

  • Initial version

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

markerlib-0.5.tar.gz (3.6 kB view details)

Uploaded Source

File details

Details for the file markerlib-0.5.tar.gz.

File metadata

  • Download URL: markerlib-0.5.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for markerlib-0.5.tar.gz
Algorithm Hash digest
SHA256 7dbbf0776054af00286aa8fcb3363744352bceb337063dc6de887e96579bf31d
MD5 b1731d428bc3b7808625e5d056d65771
BLAKE2b-256 35efcdd02a22fd3b787404c84423454f57686c3282be7840429ef30220a4658a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page