Skip to main content

Generates next version number for your pyton package. If your package is a PYPI package it checks the latest version from PYPI and creates next version depending on your choices. Alternatively you may use local option which reads local __version__.py or any other file name you provide and creates the next version.Creates version file and reads from the same path. It also provides useful functions to show your package's version at run time.

Project description

Python package Downloads Python 3.8 Python 3.9 Python 3.10

verser

from verser import next_version, Project, next_version_pypi, next_version_local

functions

next_version (general function both for pypi and local)

first checks PYPI if not then checks local

> default parameters :
> pypi = True
> part = 'patch' => increments patch part of your version. Options : major/minor/patch/pre/build
> write = True => if True writes a new version file on your local path 'your_package_name/__version__.py'
> first makes a request to PYPI server to get information about your package
> then increments it depending on your choices
> If it is not a PYPI package or if pypi parameter is false checks local version file to increment

Usage example:

from verser import Project,  next_version
from pathlib import Path

project = Project(package_name="evdspy",
                  default_version=default_vers,
                  version_file_path=Path() / "evdspy" / "__version__.py")
    
new_version = next_version(project, write=True, part='patch')

typically in your setup.py file you may use this variable like below

#file: setup.py
...
from verser import Project,  next_version
from pathlib import Path

project = Project(package_name="evdspy",
                  default_version=default_vers,
                  version_file_path=Path() / "evdspy" / "__version__.py")
    
new_version = next_version(project, write=True, part='patch')

# the setup
setup(
    name=f"{package_name}",
    version=new_version,
    description=f"{description}",
...

next_version_pypi (only for pypi packages)

new_version = next_version_pypi('rich')
print(new_version)
# results :  12.6.1 

new_version = next_version_pypi('rich' , part = 'minor')
print(new_version)
# results :  12.7.0 

next_version_local

it only checks local version.py file inside the root of your project creates one if does not exist

new_version =  next_version_local( 
    package_name = 'some_cool_project_not_published' , 
    increment_choice = True,  => if selected False it will not increment current version 
    part = "minor"              => it will increment minoır part of your package version 
    write = True ,              => since write is True it will rewrite current version to the version file 
)
print(new_version)
    # defaults 
#   --------next_version_pypi-------
#   increment_choice = True ,   => if selected False it will not increment current version 
#   part='patch'                 => it will ignore this parameter
#   write = True ,              => since write is True it will rewrite current version to the version file 

Some examples

new_version = next_version_pypi('rich' , part='major')
new_version = next_version_pypi('rich' , part='patch')
new_version = next_version_pypi('rich' , part='major')
new_version = next_version_pypi('rich' , part='pre' , write=True )
new_version = next_version_pypi('rich' , part='build' , write=False )



new_version =  next_version_local( 
        package_name = 'some_cool_package' , 
        increment_choice = True 
        part = "minor"              
        write = True ,             
    )

new_version =  next_version_local( 
        package_name = 'some_cool_package' , 
        increment_choice = False  
        part = "patch"              
        write = True ,             
    )

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 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.

verser-0.1.10-py2.py3-none-any.whl (40.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file verser-0.1.10-py2.py3-none-any.whl.

File metadata

  • Download URL: verser-0.1.10-py2.py3-none-any.whl
  • Upload date:
  • Size: 40.2 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 verser-0.1.10-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 282bdb991a43416e55f8b4f8622ed762a363512727412397959a4622375cd338
MD5 67b71501fc21b601bde7f966cbe1bd1b
BLAKE2b-256 d11b5e4c80f9925c8b1b163072f6aea6ed81347ffb924806fdc1790073cb5c7d

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