Makefile

Projects created by pyprojsetup will include a Makefile in their root directory. This Makefile exists to automate common development workflows.

Targets

A make target, supplied as a command-line argument following the make command, describes an objective that make should work towards. For more information on make, see the official docs. The following targets are defined in the Makefile that pyprojsetup creates:

make clean

Delete temporary files in the repo.

make install

Install the project on your system using pip. Meant as a convenience function for end-users who are comfortable with installing things via make.

make test

Run the test suite and tox.

make newversion

Prompt for a new version number, check it for PEP 440 compliance, then write the new version to metadata/version and __init__.py

make egginfo

Populate <project_name>.egg-info/ by running python setup.py egginfo, which creates some useful metadata.

make lint

Run make egginfo, then lint the project. Default linter is pylint. The linted files are the .py files included in setup.py‘s packages.

make coverage

Evaluate the percentage of code that is covered by a test case. Set a value for coverage_min in Makefile to enforce a minimum coverage percentage requirement.

make requirements

Run make egginfo, then compare the dependencies declared by the project with those mentioned in imports, those used by the project, and those installed in the virtual environment. This tool helps you keep your setup.py‘s install_requires up-to-date.

make docs

Run make requirements, then dynamically build updated documentation using a combination of the documents under docs/src, CLI help output, docstrings, and actual code. Open the sources for review prior to building. Build a man page and an HTML page.

make commit

Git tag the current version number. Add, commit, and push all files to the new tag. Push docs/gh-pages to the gh-pages branch of the remote repo, which publishes the HTML documentation made by make docs as a GitHub Page.

make sdist

Creates a source distribution by running python setup.py sdist.

make release

Run make sdist, then create a new release in draft status on github via an API call, and upload the sdist tarball to the release page. The API call uses your Credentials.

make dryrun

Run make test coverage lint docs sdist.

make all

Run make newversion dryrun commit release.

Note

make with no other arguments will run make all.

Environment

To modify the behavior of the Makefile, export environment variables before running make.

  • To see curl output when uploading to github, export VERBOSE=1
  • To avoid opening files in the editor, export SKIPEDIT=1
  • To avoid pausing for user input, export AUTOYES=1

Tip

If you are not sure if your code is ready to release, run make dryrun to check all the things. If you are ready to mark a new version and publish a release, make.