Skip to main content

Python version based conditionals

Project description

You can install the library with pip:

pip install nxpy-past

Nxpy Past provides ways to express conditions on the current Python version to help handling version differences:

import nxpy.core.past

if nxpy.core.past.V_2_6.at_least():
    import abc
else:
    class abc(object):
        class ABCMeta(type):
            def __new__(mcs, name, bases, dict):
                return type.__new__(mcs, name, bases, dict)

It is also possible to express assertions on the current version to better document why some code fails:

import nxpy.core.past

nxpy.core.past.enforce_at_least(nxpy.core.past.V_2_6)

The library’s documentation is available on ReadTheDocs.

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

nxpy_past-1.0.4.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

nxpy_past-1.0.4-py2.py3-none-any.whl (5.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file nxpy_past-1.0.4.tar.gz.

File metadata

  • Download URL: nxpy_past-1.0.4.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for nxpy_past-1.0.4.tar.gz
Algorithm Hash digest
SHA256 4fc901e149405f351f943c7bcad23956fdcb6d7b36068fa83127c4e1d68b46d1
MD5 b993727a05e8ab04b66a67e409256ea5
BLAKE2b-256 9b861d3a536ccbe5e82d7311e3d1d91cca5621138ac44b232a94ef8c8597c70c

See more details on using hashes here.

File details

Details for the file nxpy_past-1.0.4-py2.py3-none-any.whl.

File metadata

  • Download URL: nxpy_past-1.0.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for nxpy_past-1.0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a5c4df4a2bb986e087227f59819ac9add626cedd615377b670c47422a695d17d
MD5 2cd6731ef31b60a4e0b7caf06ff8ae77
BLAKE2b-256 e7665a6508d4dd7fa036126524d5bb446d4b23aa347b2eb9bb94eaeacf0d3f09

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