Skip to main content

Shared helpers for setuptools configuration

Project description

setup_utility

Utility functions for setuptools utilities - my standard source checks, testing, cleanup, deployment, etc.

See LICENSE for important licensing information.

Installing

Your setup.py will need jfaleiro.setup_utility to start - so you either make sure you have it pre-installed using pip:

pip install jfaleiro.setup_utility

or add this on the very top of your setup.py and forget about it moving forward.

try:
    import setup_utility
except ModuleNotFoundError as e:
    from pip._internal import main
    assert main('install jfaleiro.setup_utility'.split()) == 0

from setup_utility import (
    BehaveTestCommand,
    CleanCommand,
    LicenseHeaderCommand,
    version_from_git,
)

and

cmd_classes = {
    'license_headers': LicenseHeaderCommand,
    'behave_test': BehaveTestCommand,
    'clean': CleanCommand,
}

Using

python setup.py --help-commands

You should have commands license_headers, clean, and behave_test listed. To know what you can configure try python setup.py <command> --help:

python setup.py license_headers --help

You can use command line parameters or add the same commands on setup.cfg:

[license_headers]
header-file = HEADER

[aliases]
test=pytest

[tool:pytest]
addopts = --cov=setup_utility --cov-report html

You can also produce your version number from standard git information (tag, branch name, and number of differences):

setup(
	...
    version=version_from_git(),
	...
)

Release tags release/<version> with nnn differences from master will produce version <version>.dev<nnn> and a tagged version <tag> on master will produce the version <tag>. Everything else will produce master.dev<nnn> for master or no-version.dev<nnn> for any other branch.

Enjoy.

Project details


Download files

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

Source Distribution

jfaleiro.setup_utility-0.0.1.tar.gz (17.1 kB view hashes)

Uploaded Source

Built Distribution

jfaleiro.setup_utility-0.0.1-py3-none-any.whl (16.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page