Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Object orientied optimized variant of the semver package

Project description

csemver

csemver is the object orientied optimized Version of semver. It is much more consistent because you only need one object for all operations.

Features

Increase Versions

To increase the different versions csemver provides three methods

  • incMajor
  • incMinor
  • incPatch
from csemver import csemver as Version
a = Version();
print(a)
a.incMajor();
print(a)
a.incMinor();
print(a)
a.incPatch();
print(a)
foo@bar:~$ python test.py
0.1.0
1.0.0
1.1.0
1.1.1

Overwrite Version

To overwrite the current Version just set a new Semver-String for csemver.number

from csemver import csemver as Version
a = Version();
print(a)
a.number ="1.0.0-pre+build.1";
print(a)
foo@bar:~$ python test.py
0.1.0
1.0.0-pre+build.1

Reset Version

Delete the number property to reset the Version to 0.1.0

from csemver import csemver as Version
a = Version("1.0.0");
print(a)
del a.number
print(a)
foo@bar:~$ python test.py
1.0.0
0.1.0

Compare different versions:

You can compare csemver instances with >, >=, ==, !=, <=, <

from csemver import csemver as Version

a = Version("1.1.1")
b = Version("1.1.1")
repr(a)
repr(b)
print(a<b)

b.incPatch()
print(b)
print(a<b)
foo@bar:~$ python test.py
Version<1.1.1> instance at 0x00000159D2061BA8
Version<1.1.1> instance at 0x00000159D2061DD8
False
1.1.2
True

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
csemver-0.1.0-py3-none-any.whl (15.4 kB) Copy SHA256 hash SHA256 Wheel py3
csemver-0.1.0.tar.gz (15.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page