Package: bumpit
bumpitA small command line tool to bump tracked versions in your repository.It is designed to integrate well with your CI/CD pipeline. Simply install and runbumpitas part of your pipeline. Let the robots do the boring work!InstallationYou can download and installbumpitfrom PyPI by running:pip install bumpitUsagesThere are two ways to usebumpitthrough the command line, orthrough your python codeThrough CLIAt a high level, you need tosetup the configuration file.bumpconfig.yamlin your target folder.runbumpitor use in the codeUsageUsage:bumpit[OPTIONS]Options:-c,--configPATH(optional)configurationsettings.Defaultsto`.bumpit.yaml`-p,--partTEXT(optional)strategypartoverride.Defaultsto`strategy.part`fromtheconfigfile.-v,--valueTEXT(optional)partvalueoverride.Anypartcanbeoverrodebythisvalueaslongasthevalueisvalid.-d,--dry-run(optional)runthetoolindryrunmode.Defaultstofalse.--helpShowthismessageandexit.Inside your programJust dofrom bumpit.core.bumpit import runin your code.Check out thebumpit cli codefor concrete example.Configurationbumpitrelies heavily on a configuration file to capture runtime context ofbumpit. This config file is named.bumpconfig.yamlby default. You can override this using the--configoption in the command line.The config file looks like:current_version:"201910.1.0"base_branch:"master"strategy:name:"calver"part:"minor"version_format:"YYYYMM.MINOR.MICRO"commit:author:"JaneDoe<jane@doe.com>"tag:apply:Trueformat:"{version}"auto_remote_push:True# or Falsetracked_files:-setup.pywhere:current_version- the current version of your files. It needs to be wrapped in quotes to force parsing to be string (e.g. avoid calver current_version to be parsed as float)base_branch- The name of base branch in the repository. Default value ismasterif it is not specified.strategy- strategy sectionname- supported values:semver,calverpart- the target part to update whenbumpitruns. Please refer to the description below for strategy specific values.version_format- the format of the version. This only applies forcalvercommit- commit sectionauthor- string value usingthe standard git author formatA U Thor <author@example.com>tag- tag sectionapply- bool value to instruct the tool to tag the repository after the version updateformat- format of the tag. Some people prefer to add prefix to their tag versions (e.g.release/1.0.1). As long as the{version}is present, then it is a validtag_formatauto_remote_push- bool flag that guards whether to push commit and/or tag changes to remote repository. It should never be wrapped in quotes so that it will be properly parsed as a booltracked_files- a list of relative filenames to update version to. If the current_version is not found, the tool simply skips this fileImportant NotesCollision of versions is handled outside ofbumpit. Other tools such as a good version control system fits better in solving this problem.ExamplesCheck out the following repositories for examples:CalVerexampleSemVerexamplebumpit- yep!bumpitusesbumpit.Version StrategiesThe tool currently supports the following versioning strategiesSemantic VersionCalendar VersionSemantic Versionbumpitfully supports strict semver specification defined insemver.org. It validates the right format using thesemver.org proposed format.ConfigurationHere is anexampleof a configuration file for semver.Important notes on configuration:strategy.namemust besemverstrategy.partsupported values aremajor,minor,patchstartegy.version_formatdoes not apply tosemver. It is completely ignored in the code. It is safe (and better) to not include this section forsemveruse case to avoid confusing the user.Part updatesAny semver part can be updated by givingbumpita specific value to update the part to. This can be done through:command line by using the--part and --valuecli options, orprogram by providing thetarget_partandforce_valueinbumpit#runmethodDue to the free form nature of thepre_releaseandbuild_metadataparts, they can only be updated through the force method described above.However, the biggest gain from usingbumpitis to let the tool auto update your versions for you.Out of the box,bumpitcan auto update themajor,minor, and thepatchparts of semver. To accomplish this, specify the target part in the config filestrategy.partsection.Calendar Versionbumpitsupports calver specification defined incalver.organd coversuse casesdescribed in the specification website.ConfigurationHere is anexampleof a configuration file for calver.Important notes on configuration:strategy.namemust becalverstrategy.partsupported values areauto,date,major,minor,microstartegy.version_formatcombination ofcalverparts. Note thatbumpitdoes check that only one representation of part is present in the format. For example, you cannot haveMMand0Min the same token because they both refer tomonth.Seecalver schemefor supported formats.Part updatesAny calver part can be updated by givingbumpita specific value to update the part to. This can be done through:command line by using the--part and --valuecli options, orprogram by providing thetarget_partandforce_valueinbumpit#runmethodDue to the free form nature of themodifier, this can only be updated through the force method described above.However, the biggest gain from usingbumpitis to let the tool auto update your versions for you.Out of the box,bumpitcan auto update theauto,date,major,minor, and themicroparts of calver. To accomplish this, specify the target part in the config filestrategy.partsection. This is also the order of precedence when updating the parts. Updating the higher precedent part resets the lower precedent parts. For example, if the date is update, then allmajor,minor,micro,modifierwill be reset to their respective default values.Reset values:majorresets to0minorresets to0microresets to0modifierresets to an empty string""DevelopmentContributionCode and documentation improvements are all welcome. You can also file bug reports or feature suggestions.The feature set is meant to handle different versioning strategies. Currently, the strategies I know are applied in the wild are implemented, but it is by no means complete!PublishingTo publishbumpit, run the followinggitcheckoutmaster
gitpull
bumpit
pythonsetup.pybdist_wheelsdist
twineuploaddist/*CreditsThankful for the generous tools provided by:GitHub- project hostingCircleCI- continuous integrationCode Climate- automated code review for test coverage and maintainabilityLicensebumpitis released under theMIT License.