microberx._version

Git implementation of _version.py.

Attributes

LONG_VERSION_PY

HANDLERS

Exceptions

NotThisMethod

Exception raised if a method is not valid for the current scenario.

Classes

VersioneerConfig

Container for Versioneer configuration parameters.

Functions

get_keywords()

Get the keywords needed to look up the version information.

get_config()

Create, populate and return the VersioneerConfig() object.

register_vcs_handler(vcs, method)

Create decorator to mark a method as the handler of a VCS.

run_command(commands, args[, cwd, verbose, ...])

Call the given command(s).

versions_from_parentdir(parentdir_prefix, root, verbose)

Try to determine the version from the parent directory name.

git_get_keywords(versionfile_abs)

Extract version information from the given file.

git_versions_from_keywords(keywords, tag_prefix, verbose)

Get version information from git keywords.

git_pieces_from_vcs(tag_prefix, root, verbose[, runner])

Get version from 'git describe' in the root of the source tree.

plus_or_dot(pieces)

Return a + if we don't already have one, else return a .

render_pep440(pieces)

Build up version string, with post-release "local version identifier".

render_pep440_branch(pieces)

TAG[[.dev0]+DISTANCE.gHEX[.dirty]] .

pep440_split_post(ver)

Split pep440 version string at the post-release segment.

render_pep440_pre(pieces)

TAG[.postN.devDISTANCE] -- No -dirty.

render_pep440_post(pieces)

TAG[.postDISTANCE[.dev0]+gHEX] .

render_pep440_post_branch(pieces)

TAG[.postDISTANCE[.dev0]+gHEX[.dirty]] .

render_pep440_old(pieces)

TAG[.postDISTANCE[.dev0]] .

render_git_describe(pieces)

TAG[-DISTANCE-gHEX][-dirty].

render_git_describe_long(pieces)

TAG-DISTANCE-gHEX[-dirty].

render(pieces, style)

Render the given version pieces into the requested style.

get_versions()

Get version information or return default if unable to do so.

Module Contents

microberx._version.get_keywords()[source]

Get the keywords needed to look up the version information.

Return type:

Dict[str, str]

class microberx._version.VersioneerConfig[source]

Container for Versioneer configuration parameters.

VCS: str[source]
style: str[source]
tag_prefix: str[source]
parentdir_prefix: str[source]
versionfile_source: str[source]
verbose: bool[source]
microberx._version.get_config()[source]

Create, populate and return the VersioneerConfig() object.

Return type:

VersioneerConfig

exception microberx._version.NotThisMethod[source]

Bases: Exception

Exception raised if a method is not valid for the current scenario.

microberx._version.LONG_VERSION_PY: Dict[str, str][source]
microberx._version.HANDLERS: Dict[str, Dict[str, Callable]][source]
microberx._version.register_vcs_handler(vcs, method)[source]

Create decorator to mark a method as the handler of a VCS.

Parameters:
  • vcs (str) –

  • method (str) –

Return type:

Callable

microberx._version.run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, env=None)[source]

Call the given command(s).

Parameters:
  • commands (List[str]) –

  • args (List[str]) –

  • cwd (Optional[str]) –

  • verbose (bool) –

  • hide_stderr (bool) –

  • env (Optional[Dict[str, str]]) –

Return type:

Tuple[Optional[str], Optional[int]]

microberx._version.versions_from_parentdir(parentdir_prefix, root, verbose)[source]

Try to determine the version from the parent directory name.

Source tarballs conventionally unpack into a directory that includes both the project name and a version string. We will also support searching up two directory levels for an appropriately named parent directory

Parameters:
  • parentdir_prefix (str) –

  • root (str) –

  • verbose (bool) –

Return type:

Dict[str, Any]

microberx._version.git_get_keywords(versionfile_abs)[source]

Extract version information from the given file.

Parameters:

versionfile_abs (str) –

Return type:

Dict[str, str]

microberx._version.git_versions_from_keywords(keywords, tag_prefix, verbose)[source]

Get version information from git keywords.

Parameters:
  • keywords (Dict[str, str]) –

  • tag_prefix (str) –

  • verbose (bool) –

Return type:

Dict[str, Any]

microberx._version.git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command)[source]

Get version from ‘git describe’ in the root of the source tree.

This only gets called if the git-archive ‘subst’ keywords were not expanded, and _version.py hasn’t already been rewritten with a short version string, meaning we’re inside a checked out source tree.

Parameters:
  • tag_prefix (str) –

  • root (str) –

  • verbose (bool) –

  • runner (Callable) –

Return type:

Dict[str, Any]

microberx._version.plus_or_dot(pieces)[source]

Return a + if we don’t already have one, else return a .

Parameters:

pieces (Dict[str, Any]) –

Return type:

str

microberx._version.render_pep440(pieces)[source]

Build up version string, with post-release “local version identifier”.

Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you get a tagged build and then dirty it, you’ll get TAG+0.gHEX.dirty

Exceptions: 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty]

Parameters:

pieces (Dict[str, Any]) –

Return type:

str

microberx._version.render_pep440_branch(pieces)[source]

TAG[[.dev0]+DISTANCE.gHEX[.dirty]] .

The “.dev0” means not master branch. Note that .dev0 sorts backwards (a feature branch will appear “older” than the master branch).

Exceptions: 1: no tags. 0[.dev0]+untagged.DISTANCE.gHEX[.dirty]

Parameters:

pieces (Dict[str, Any]) –

Return type:

str

microberx._version.pep440_split_post(ver)[source]

Split pep440 version string at the post-release segment.

Returns the release segments before the post-release and the post-release version number (or -1 if no post-release segment is present).

Parameters:

ver (str) –

Return type:

Tuple[str, Optional[int]]

microberx._version.render_pep440_pre(pieces)[source]

TAG[.postN.devDISTANCE] – No -dirty.

Exceptions: 1: no tags. 0.post0.devDISTANCE

Parameters:

pieces (Dict[str, Any]) –

Return type:

str

microberx._version.render_pep440_post(pieces)[source]

TAG[.postDISTANCE[.dev0]+gHEX] .

The “.dev0” means dirty. Note that .dev0 sorts backwards (a dirty tree will appear “older” than the corresponding clean one), but you shouldn’t be releasing software with -dirty anyways.

Exceptions: 1: no tags. 0.postDISTANCE[.dev0]

Parameters:

pieces (Dict[str, Any]) –

Return type:

str

microberx._version.render_pep440_post_branch(pieces)[source]

TAG[.postDISTANCE[.dev0]+gHEX[.dirty]] .

The “.dev0” means not master branch.

Exceptions: 1: no tags. 0.postDISTANCE[.dev0]+gHEX[.dirty]

Parameters:

pieces (Dict[str, Any]) –

Return type:

str

microberx._version.render_pep440_old(pieces)[source]

TAG[.postDISTANCE[.dev0]] .

The “.dev0” means dirty.

Exceptions: 1: no tags. 0.postDISTANCE[.dev0]

Parameters:

pieces (Dict[str, Any]) –

Return type:

str

microberx._version.render_git_describe(pieces)[source]

TAG[-DISTANCE-gHEX][-dirty].

Like ‘git describe –tags –dirty –always’.

Exceptions: 1: no tags. HEX[-dirty] (note: no ‘g’ prefix)

Parameters:

pieces (Dict[str, Any]) –

Return type:

str

microberx._version.render_git_describe_long(pieces)[source]

TAG-DISTANCE-gHEX[-dirty].

Like ‘git describe –tags –dirty –always -long’. The distance/hash is unconditional.

Exceptions: 1: no tags. HEX[-dirty] (note: no ‘g’ prefix)

Parameters:

pieces (Dict[str, Any]) –

Return type:

str

microberx._version.render(pieces, style)[source]

Render the given version pieces into the requested style.

Parameters:
  • pieces (Dict[str, Any]) –

  • style (str) –

Return type:

Dict[str, Any]

microberx._version.get_versions()[source]

Get version information or return default if unable to do so.

Return type:

Dict[str, Any]