An easy way to create and manage a pip Python package.
Install the latest stable release with:
pip install https://github.com/tchlux/packager/archive/1.0.7.zipIn order to install the current files in this repository (potentially less stable) use:
pip install git+https://github.com/tchlux/packager.gitimport packager
packager.create("path_to_project")
packager.push("path_to_project")Descriptions of the create and push functions follow.
python -m packager <project> [create] [push] [push comments]Manage a python package project at provided directory.
If create is specified, a project is initialized with
default files for a package managed by this module.
If push is specified, a git (and PyPi if declared) update
cycle is initiated. This includes a commit to the repository,
version update, packaging, and commit to the PyPi servers.
This module uses itself as a template to initialize a project directory, taking only the desired name to make necessary modifications to the internals of this project.
When creating a push to PyPi, the following steps are taken:
- The push is abandoned if there are staged files that require commit.
- The directory is cleaned of unnecessary files (
.pyc,__pycache__) - The
version_history.mdfile in theaboutdirectory is updated with the commit message. - A
MANIFEST.infile is created specifying all files in the repository, to ensure all files are included on install. - The
version_history.mdandMANIFEST.infiles are added and committed. - Git commands
tag -a <version> -m <notes>andpush --tagsare executed. - If PyPi, the
setup.pyfile is executed withsdistargument to create a distribution. twineis used to upload the distribution to PyPi.- All extra files created from the package build are deleted.