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.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.4.tar.gz (5.2 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for markerlib-0.4.tar.gz
Algorithm Hash digest
SHA256 1207408dfa3d6519d786fb0327d26b64b04d3c3453efbc3e6f02b1613400b56e
MD5 ada6ef8400ee7b8d608b6dbcecba5340
BLAKE2b-256 180d97251e253ba99c517881a9e62047ce74454d02a658fc947fa5e46289e6fe

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