Provides a simple utility for checking the python version.
Project description
## Python Version
This package provides a basic python version checking utility. It will check for a range of python versions and either report an error or exit depending on the parameters provided.
## Example
` $ python Python 3.5.1+ (default, Mar 30 2016, 22:46:26) [GCC 5.3.1 20160330] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import python_version >>> >>> try: ... python_version.check(min=(3, 0, 0), max=(4, 0, 0)) ... except Exception as e: ... print(repr(e)) ... else: ... print("All good!") ... All good! >>> try: ... python_version.check(min=(3, 6, 0), max=(4, 0, 0)) ... except Exception as e: ... print(repr(e)) ... else: ... print("All good!") ... VersionConflict('requires python version >= 3.6.0 but the running python version is 3.5.1+',) >>> try: ... python_version.check(min=(2, 7, 0), max=(2, 7, 999)) ... except Exception as e: ... print(repr(e)) ... else: ... print("All good!") ... VersionConflict('requires python version <= 2.7.999 but the running python version is 3.5.1+',) >>> try: ... python_version.check(min=(2, 7, 0), max=(2, 7, 999), exit_on_error=True) ... except Exception as e: ... print(repr(e)) ... else: ... print("All good!") ... requires python version <= 2.7.999 but the running python version is 3.5.1+ $ `
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file python_version-0.0.2.tar.gz
.
File metadata
- Download URL: python_version-0.0.2.tar.gz
- Upload date:
- Size: 1.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c16de57c7f2d614621cf468e8f5a20bb6b3cec665c9c7f5e9f9f000bf04fe67 |
|
MD5 | dfb13254eaa9f2adccc09f73d2cb5cf7 |
|
BLAKE2b-256 | fe748ed1d7f895b33a89565be4b1c8651d503fcb2cdda951fef4ec6f6906432c |
File details
Details for the file python_version-0.0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: python_version-0.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c7429f3375cee19873892e5db4d10d2b42172d8851a8bb5111729e028470580 |
|
MD5 | 4814649585d3e39b5435e07be8a00599 |
|
BLAKE2b-256 | a8e306841b7e2b5dab99f6e5ece60db926ce35b9cf351da87ecaf2d75e5d9009 |