Skip to main content

Provides functions to check your package's users's python version and shows message to your users continues or stops or accepts callbacks depending your choice.

Project description

Python package PyPI Supported Python Versions Downloads

comply

from comply import check

checks if user's python version is compatible with your project

def check(
        min_version: str,
        max_version: str,
        min_msg: t.Union[str, t.Callable] = default_min_msg,
        max_msg: t.Union[str, t.Callable] = default_max_msg,
        complyible_msg: t.Union[str, t.Callable] = default_comply_msg,
        verbose: bool = True,
        mock_sys_version: t.Union[str, bool] = False, # for test purposes

):

Use case 1 : main file on your project to continue or stop running

you may use it on the main file of your project and create a conditional and decide what to do next

if check(
        min_version="3.7",
        max_version="3.11",
        min_msg="Your version is less than minimum.",
        verbose=True,

    ) is False : 
        sys.exit(0) # return # or just exit
# if user's python has a version of lets say 3.4 this will print your customized message and exit.

just warn the user and continue

if check(
        min_version="3.7",
        max_version="3.10",
        min_msg="Your version is less than minimum.",
        max_msg="Your version is greater than the minimum.",
        verbose=True,

    ) is False : 
        pass   
# if user's machine has a python with version of 
# lets say 3.4 this will print your customized message and continue .

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

comply-0.0.2-py2.py3-none-any.whl (4.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file comply-0.0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: comply-0.0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.7

File hashes

Hashes for comply-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4bcdf54312ab35dde3ec28393ab575d1fa5b396926d9dc5033fe817eb090d049
MD5 8919f553c401bee7fa319d18a0d1394a
BLAKE2b-256 c5c1c73f7b9b11c08ab994c753ca36bd1d10a3b3d2ee83890daa20d1371a7a4f

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