Package: buildver
BuildverTool to build Python packages with built-in intuitive versioning mechanismThis project is part of thePyrustic Open Ecosystem.Installation.Latest.DocumentationTable of contentsOverviewSet a new versionVersion modifiersVersion widthBuild a projectCheck a projectAPIUnder the hoodRelated projectsInstallationOverviewCreating distribution packages and managing version numbers are two related tasks that should be done intelligently to avoid confusion regarding version numbers.Buildverdefines a standard versioning mechanism and automates the close relationship between versioning and distribution package creation while giving the developer full control.Buildveris a Python package that comes as a command-line tool with an API.This tool saves me headaches when I have to release a new version of one of mymany projects.Fun fact:Buildveritself is built with...BuildverSet a new versionYou can change the current version of your Python project like this:buildver set <new-version>.Here,<new-version>is either a canonical version (e.g.,3.0.1) or a version modifier (e.g.,+rev).$cd/path/to/project
$buildverset+rev
VERSIONfileupdatedfrom0.0.1to0.0.2

$buildverset0.0.3
VERSIONfileupdatedfrom0.0.2to0.0.3Version modifiersUse+maj,+min, and+revto increment the current version of your project.These version modifiers increment themajor,minor, andrevisionnumbers respectively.CurrentModifierNext1.0.0+rev1.0.11.0.1+min1.1.01.1.0+maj2.0.0Version widthPeople usually limit their version scheme to 3 numbers, from left to right: themajor,minor, andrevisionnumber.Buildversupports any version scheme as long as integers and dots are used.By default,Buildverworks with themajor.minor.revisionscheme, but you can expand your version width, thenBuildverwill update this version according to your scheme.For this,Buildverfollows simple rules:themajoris thefirstnumber of a versiontheminoris thesecondnumber of a versiontherevisionis thelastnumber of a versionBuild a projectTo build a Python distribution package withBuildver, simply runbuildver build:$cd/path/to/demo
$buildverbuild
buildingv0.0.1...
Successfullybuilt'demo'v0.0.1!
VERSIONfileupdatedfrom0.0.1to0.0.2The above command willbuilda distribution package,updateabuild_reportfile thenincrementthe revision number of the project version.If youonly want to builda distribution package, addthen passto the previous command:$cd/path/to/demo
$buildverbuildthenpass
buildingv0.0.1...
Successfullybuilt'demo'v0.0.1!
VERSIONfilenotupdatedCheck a projectGet some basic information about your project with thecheckcommand:$cd/path/to/demo
$buildvercheck
demov0.0.2(source).whlv0.0.1(package)built7secsagoAPIBuildverexposes an API (the same used by the CLI) with which you can interact programmatically in Python.importbuildverPROJECT_DIR="/path/to/project"# Set a new versionbuildver.set_version("2.0.0",PROJECT_DIR)# Get the current versioncur_version=buildver.get_version(PROJECT_DIR)# returns "2.0.0"# Increment the minor number with the '+min' version modifiernew_version=buildver.interpret_version(cur_version,"+min")# returns "2.1.0"buildver.set_version(new_version,PROJECT_DIR)# Build the projectsuccess,errors=buildver.build_project(PROJECT_DIR)ifsuccess:# Update the build_report filebuildver.update_build_report(new_version,PROJECT_DIR)# Get the latest build infoversion,timestamp=buildver.get_latest_build(PROJECT_DIR)Read themodules documentation.Under the hoodTo build a.whlPython distribution package,BuildverusesSubrunto run thesetup.pymodule on the root of a Python project.The project version is stored in aVERSIONfile at the root. This file is referenced insetup.cfg. So you can safely read and write theVERSIONfile. Obviously, it is recommended to useBuildverto change the version of the project.Thebuild_reportfile is located in$PROJECT_DIR/.pyrustic/buildver.Each line of this file can be split into two parts: theversionon the left and thetimestampon the right. The first line represents the latest build.Related projectsFollowing are some related projects.SetupinitBuildverneeds your project to follow a standard Python project structure in order to build it.Setupinitis a command line tool to properly initialize your Python project.DiscoverSetupinit!BackstageBackstageis alanguage-agnosticcommand-line tool that allows the developer to define, coordinate and use the various resources at his disposal to create and manage a software project.Backstage's default behavior involves usingBuildver.DiscoverBackstage!InstallationBuildveriscross platformand versions under1.0.0will be consideredBetaat best. It is built onUbuntuwithPython 3.8and should work onPython 3.5ornewer.For the first time$pipinstallbuildverUpgrade$pipinstallbuildver--upgrade--upgrade-strategyeagerBack to top