Skip to main content

Check version of a Python module

Project description


PyPI Downloads Build Status Test Coverage Supported Python

Check version of a Python module.

Raises an error if the <module>.__version__:

  • already present on PyPI;
  • does not match PEP 440;
  • or does not match specified type: alpha/beta/rc/dev/release.

All of this comes in handy during CI.

Also: No runtime dependencies!


Available from PyPI:

pip install cv

Module Example

With a <module> present on PyPI and <module>.py in current directory:

__version__ = '7.7.7'


Simply run:

cv <module>

If 7.7.7 version of <module> is on PyPI already you’ll get a VersionExists error:

Traceback (most recent call last):
  File "./cv", line 86, in <module>
  File "./cv", line 82, in main
    check_unique(name, version)
  File "./cv", line 28, in check_unique
    raise VersionExists(name, version)
__main__.VersionExists: Package "<module>" with version "7.7.7" already exists on PyPI.
Change the "<module>.__version__" to fix this error.

Package Example

Packages work in the same way as modules except __version__ is defined in <module>/


$ cv --help
usage: cv [-h] [-w WAREHOUSE] [--alpha] [--beta] [--rc] [--dev] [--release]

Check version of a Python package or module.

positional arguments:
  module                the package/module with "__version__" defined

optional arguments:
  -h, --help            show this help message and exit
  -w WAREHOUSE, --warehouse WAREHOUSE
                        package index to use, default is
  --alpha               check that version is an alpha, e.g. 1.0.0a1
  --beta                check that version is a beta, e.g. 1.0.0b2
  --rc                  check that version is a release candidate, e.g.
  --dev                 check that version is in development, e.g. 1.0.0.dev3
  --release             check that version is a release without modifiers,
                        e.g. 1.0.0
  --dry                 make no request to PyPI

Project details

Download files

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

Files for cv, version 1.0.0.dev11
Filename, size File type Python version Upload date Hashes
Filename, size cv-1.0.0.dev11-py3-none-any.whl (7.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size cv-1.0.0.dev11.tar.gz (4.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page