zensols.pybuild package

Submodules

zensols.pybuild.cli module

Client entry point for the command line program.

class zensols.pybuild.cli.Cli(setup_path: str = None, output_format: str = None)[source]

Bases: object

write()[source]
class zensols.pybuild.cli.ConfAppCommandLine[source]

Bases: zensols.cli.peraction.OneConfPerActionOptionsCli

zensols.pybuild.cli.main()[source]

zensols.pybuild.remote module

A utility class that represents a Git remote.

class zensols.pybuild.remote.RemoteSet(repo_dir: pathlib.Path = PosixPath('.'))[source]

Bases: object

Represents a Git remote. This is used to populate build metadata used for other aspects of the build process rather than just setuptools.

zensols.pybuild.setuputil module

A utility class to help with setuptools, git and GitHub integration.

class zensols.pybuild.setuputil.SetupUtil(name: str, user: str, project: str, setup_path: pathlib.Path = None, package_names: List[str] = None, root_contained_file=None, req_file: str = 'requirements.txt', has_entry_points=True, **kwargs)[source]

Bases: object

This class is used in setup.py in place of the typical call to setuptools and provides a lot of the information contained in the git repo as metadata, such as the version from the latest tag. It also helps with finding paths in a the Zensols default Python project configuration.

The class also provides build information to client APIs (see source).

DEFAULT_ROOT_CONTAINED_FILE = 'README.md'
DO_SETUP = True
FIELDS = '\nname packages package_data version description author author_email url\ndownload_url long_description long_description_content_type install_requires\nkeywords classifiers\n'
property author

Return the author of the package.

property author_email

Return the email address of the project.

property download_url

Return the download URL used to obtain the distribution wheel.

property entry_points

Return the entry points (i.e. console application script), if any.

classmethod find_root(start_path: pathlib.Path, root_contained_file: pathlib.Path = None) → pathlib.Path[source]

Find the root path by iterating to the root looking for the root_contained_file starting from directory start_path.

get_info() → Dict[str, Union[str, dict]][source]
get_properties(paths: bool = False) → Tuple[List[str], Dict[str, str]][source]

Return the properties used by setuptools.

property install_requires

Get a list of pip dependencies from the requirements file.

property long_description

Return a long human readable description of the package, which is the contents of the README.md file. This is added so the README shows up on the pypi module page.

property packages

Get a list of directories that contain package information to tbe included with the distribution files.

property remote_set

Return a remote set for the project.

property root_path

Return root path to the project.

setup()[source]

Called in the setup.py to invoke the Python setuptools package. This assembles the information needed and calls setuptools.setup.

:py:fun:`setuptools:setup`

property short_description
classmethod source(start_path: pathlib.Path = PosixPath('/Users/landes/view/build/zenpybuild'), rel_setup_path: pathlib.Path = PosixPath('src/python/setup.py'), var: str = 'su')[source]

Source the setup.py setuptools file to get an instance of this class to be used in other APIs that want to access build information. This is done by using exec to evaluate the setup.py file and skipping the call to setuptools.setup.

Parameters
  • rel_setup_path – the relative path to the setup.py file, which defaults to src/python/setup.py per standard Zensols build

  • start_path – the path to start looking for the rel_setup_path

  • var – the name of the variable that was was in setup.py for the instantiation of this class

property tag

Return the tag for the project.

to_json(indent: int = 4, writer: _io.TextIOWrapper = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>) → str[source]
property url

Return the URL used to access the project on GitHub.

property version

Return the version of the last tag in the git repo.

write(depth: int = 0, writer: _io.TextIOWrapper = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]

zensols.pybuild.tag module

A utility class that represents a Git tag.

class zensols.pybuild.tag.Tag(repo_dir: pathlib.Path = PosixPath('.'), message: str = 'none', dry_run: bool = False)[source]

Bases: object

Represents a Git tag. It’s main use is determining the last tag in a sorted (by version) used to increment to the next version. However, it also creates tags and provides additional information about existing tags.

All tags have an implicit format by sorting in decimal format (i.e. <major>.<minor>.<version>).

property build_info

Return information about the last commit and a build time with the current time.

create()[source]

Create a new tag on the latest commit.

delete_last_tag()[source]

Delete the last commit tag.

get_entries() → List[Dict[str, str]][source]

Return a list of dicts, each with information about the tag.

Keys::
  • name: the name of the tag

  • ver: the version of the tag (in format v<major>.<minor>.<debug>)

  • date: date the tag was created

  • tag: the tag without the prefix (i.e. sans v)

  • message: the comment given at tag creation

property last_commit

Return rhe last commit ID (sha1).

property last_tag

Return the last tag.

property last_tag_entry

Return the last entry given by get_entries.

Tag.get_entries()

recreate_last_tag()[source]

Delete the last tag and create a new one on the latest commit.

to_json(indent: int = 4, writer: _io.TextIOWrapper = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>) → str[source]

Return build information in JSON format.

zensols.pybuild.version module

A helper class for version formatting.

class zensols.pybuild.version.Version(major=0, minor=0, debug=1)[source]

Bases: object

A container class for a tag version. All tags have an implicit format by sorting in decimal format (i.e. <major>.<minor>.<version>). This class contains methods that make it sortable.

format(prefix='v') → str[source]

Return a formatted string version of the instance.

classmethod from_string(s)[source]

Create a version instance from a string formatted version.

Returns

a new instance of Version

increment(decimal='debug', inc=1)[source]

Increment the version in the instance. By default the debug portion of the instance is incremented.

Module contents