File: replace-parts-of-a-version.rst

package info (click to toggle)
python-semver 3.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 700 kB
  • sloc: python: 1,972; makefile: 28
file content (19 lines) | stat: -rw-r--r-- 672 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
.. _sec.replace.parts:

Replacing Parts of a Version
============================

If you want to replace different parts of a version, but leave other parts
unmodified, use the function :meth:`~semver.version.Version.replace`:

   >>> version = semver.Version.parse("1.4.5-pre.1+build.6")
   >>> version.replace(major=2, minor=2)
   Version(major=2, minor=2, patch=5, prerelease='pre.1', build='build.6')

If you pass invalid keys you get an exception::

   >>> version = semver.Version.parse("1.4.5-pre.1+build.6")
   >>> version.replace(invalidkey=2)
   Traceback (most recent call last):
   ...
   TypeError: replace() got 1 unexpected keyword argument(s): invalidkey