API

class assemble.Package(package_name, setup_path, package_path)

Package information and helpers.

Parameters:
  • package_name (str) – Name of your package.
  • setup_path (str) – Base directory containing setup.py.
  • package_path (str) – Directory containing your package.
  • meta (assemble.assemble.Meta) – Meta data from your package __init__.py.
assert_git_is_clean()

Assert that there are no GIT changes pending.

build_distribution(verify=True)

Build distribution that can be uploaded to PyPI.

Parameters:verify (bool) – Verify the build (checks version) [default `True].
get_environment(environment)

When environment is None use the version to determine.

When the version is in development, it will return the ‘test’ environment, otherwise it will return ‘pypi’.

Parameters:environment (str) – Name of the PyPI environment, None for automatic discovery.
Return type:str
get_filename_package(filename)

Get the full filename of a file in the package path.

Parameters:filename (str) – Filename to locate.
Return type:str
get_filename_setup(filename)

Get the full filename of a file in the setup path.

Parameters:filename (str) – Filename to locate.
Return type:str
get_git_tags()

Retrieve all tags from GIT.

Return type:list
get_requirements(named=False, equal=False)

Retrieve requirements of the package (scan using AST).

Parameters:
  • named (str) – Add name of the module found [default False].
  • equal (bool) – Set requirment to ‘==’ for equal, otherwise it will be ‘>=’ [default False].
get_tox_environments()

Retrieve a list of tox-environments.

Return type:list
git_tag()

Tag GIT version (add to __init__, commit, push, tag, push).

patch_version(version)

Patch package version in __init__.py.

This will also set the meta.version to the new version.

Parameters:version (str) – The new version.
read_from_package(filename)

Read contents from a file in the package directory.

Parameters:filename (str) – Filename to read.
Return type:str
read_from_setup(filename)

Read contents from a file in the setup directory.

Parameters:filename (str) – Filename to read.
Return type:str
recreate_tox(environments)

Recreate tox-environments.

Parameters:environments (list) – Which environments to recreate.
Return type:list
register_pypi(environment=None)

Register package to PyPI

Parameters:environment (str) – Which environment to run on.
run_tests(environments=None, coverage=True)

Run tox-tests.

Parameters:
  • environments (list) – Which environments to test, defaults to all environments.
  • coverage (bool) – Capture coverage from all tests, [default True].
setup(keywords, classifiers, install_requires=None, **kwargs)

Run setuptools.setup using the meta-data and README.rst

Parameters:
  • keywords (list) – A list of keywords about your package.
  • classifiers (list) – A list of classifiers about your package.
  • install_requires (list) – All requirements to install, when None it reads them from requirements.txt.
  • **kwargs – Any other arguments you want to pass.
Return type:

distutils.dist.Distribution

upload_documentation(environment=None)

Upload documentation to PyPI.

Parameters:environment (str) – Which environment to run on.
upload_to_pypi(environment=None)

Upload builds to PyPI, use build_distribution for new builds.

Parameters:environment (str) – Which environment to run on.
assemble.get_package(origin='.', search='src')

Get package from current directory.

This method tries to locate your package in the current directory. Use this in your setup.py.

Parameters:
  • origin (str) – Where to start looking, this should be the directory containing your setup.py.
  • search (str) – Directory containing the source of your package.
Return type:

assemble.Package

class assemble.Meta(content)

Meta data about the package read from __init__.py file.

It scans for __variable__ = ‘’ defined variables and adds it to the Meta class. It requires all the keywords it scans for.

Parameters:
  • author (str) – Name of the author __author__.
  • description (str) – Description of the package __description__.
  • email (str) – Email address of author __email__.
  • license (str) – License definition __license__.
  • package (str) – Name of the package __package__.
  • title (str) – Title of the package __title__.
  • uri (str) – URI of package source __uri__.
  • version (str) – Current version __version__.