Package: versipy
versipy v0.2.4.post1Versatile version and medatada managment across the python packaging ecosystem with git integrationSummaryversipyis a versatile tool to centrally manage the package metadata and its version following thePEP 440 version specification.versipypropagates metadata values from a YAML file to target files specified by the user such as thesetup.py,__init__.py,meta.yamlandREADMEfiles. To do so it uses a simple string replacement strategy
using templates files defined by the user containing placeholder values. In addition,versipyis able to automatically
add, commit and push the modified files to a remote git repository and set a remote version tag.InstallationIdeally, before installation, create a cleanpython3.6+virtual environment to deploy the package.
Earlier version of Python3 should also work butPython 2 is not supported.
For example withconda:condacreate-nversipypython=3.6
condaactivateversipyInstall or upgrade the package with pip from pypi# Installpipinstallversipy# Updatepipinstallversipy--updateInstall or upgrade the package with conda from Anacounda cloud# Installcondainstall-caleg-canaconda-cbioconda-cconda-forgeversipy=[VERSION]# Updatecondaupdate-caleg-canaconda-cbioconda-cconda-forgeversipyDependenciesThe following dependencies are required but automatically installed with pip or conda package managercolorlog>=4.1.0pyyaml>=5.3.1gitpython>=3.1.9UsageSetting up your repository requires a bit of manual work but afterwards a single command can bump_up the version and
propagate it to several python packaging ecosystem files including thesetup.py,__init__.py,meta.yamlandREADMEfiles.versipycan also optionally commit and push the changes to a remote git repository and set a git tag.Setting up your repositoryOpen a terminal in the root directory of the (git managed) code repository you want to use withversipyCreate a template versipy YAML fileversipyinit_repoYou should now be able to see 2 new files:versipy.yamlwhich will contain all the repository metadata andversipy_history.txtwhereversipywill keep a track of the version changes history.The versipy.yaml fileExample fileversionsectionThis section contains individual numbers for each sections of the full version number. Although it can be manually
modified, this is supposed to be managed directly via the command line with theset_versionandbump_up_versionsubcommands.managed_valuessectionkey:value fields corresponding to a placeholder key to be found in template managed files and the corresponding
replacement value that can be customized. Users can add as many extra entries and they wish. It is recommended to
define explicit descriptive keys and to use the python double underscore syntax to avoid replacing random words in the
codemanaged_filessectionkey:value fields corresponding to the path of a template file containing placeholder keys as defined in the previous
section and the corresponding destination path where to write a file containing the replacement values.Bump up or set the version numberThe version number can be easily incremented usingbump_up_versionaccording to the level selected by users following
thePEP 440 version specificationas defined above.
Several levels can be incremented at once, but lower levels are always reset to 0 (or discarded for a, b, rc, post and
dev). For example if incrementing the minor level, the micro is set to 0 and the alpha, beta, rc, post and dev levels
are discarded if they were previously set.# Bumping up minor level versionversipybump_up_version--minor# Bumping up minor and setting the dev level to 1versipybump_up_version--minor--dev# Bumping up post level + publish changes to a remote git branchversipybump_up_version--post--git_push# Bumping up major version + publish changes to a remote git branch  + create a git tag and use a custom commentversipybump_up_version--major--git_push--git_tag--comment"Major version update"If you want to jump to a different number, the required tag can be directly set by passing a specific value toset_version. An error will be raised if the version is not canonical.versipyset_version--version_str"1.23rc1.post2"Going further with continuous deploymentUsed in combination withon tagcontinuous deployment,versipyprovides a powerful toolset to greatly simplify
package building and distribution. Here is an example YAML code snippet forTravis CIto auto-deploy a package upon tag publishing to PyPI, anaconda
cloud and set a create Releasedist:xeniallanguage:pythonpython:3.6install:truescript:truedeploy:# Production version deployment-provider:pypiskip_cleanup:trueuser:alegpassword:"$PYPI_PW"on:tags:true-provider:scriptskip_cleanup:truescript:bash ./deploy_anaconda.sh $ANACONDA_TOKENon:tags:true-provider:releasesapi_key:$GITHUB_TOKENskip_cleanup:trueon:tags:trueClassifiersDevelopment Status :: 3 - AlphaIntended Audience :: Science/ResearchTopic :: Scientific/Engineering :: Bio-InformaticsLicense :: OSI Approved :: GNU General Public License v3 (GPLv3)Programming Language :: Python :: 3citationAdrien Leger. (2020, October 27). a-slide/versipy 0.2.2 (Version 0.2.2). Zenodo.http://doi.org/10.5281/zenodo.4139248licenceGPLv3 (https://www.gnu.org/licenses/gpl-3.0.en.html)Copyright © 2020 Adrien LegerAuthorsAdrien Leger /contact@adrienleger.com/https://adrienleger.com