Tired of switching between python development tools such as pipenv and poetry I decided to stick to Makefile because it is available by default in Linux and OSX.
- Makefile is available in most unix systems - ships with OSX and most Linuxes.
- Virtualenv is automatically created on demand via Makefile rules.
- Use pure pip to manage dependencies.
- Practice your GNU Make skills.
- No excuse for creating python projects without proper packaging and distribution structure, this repo gives you the blueprint for an installable python package ready for publishing to pypi.
The main file is obviously the Makefile, you can just download and use it however you want.
Optionally clone this whole repo which gives you the basic structure of an installable python package.
Runs all tests.
Runs unit tests.
Runs functional tests.
Format code with black.
Executes the main command-line script.
Builds the current version and pushes to pypi.
- Clone this repo.
- Delete the git information:
rm -rf .git
. - Customize the variables in the
Makefile
. - Customize the variables in the
setup.py
. - Customize the
cover-package
variable insetup.cfg
. - Adjust the initial version in
yourpackagename/version.py
. - Rename the folder
yourpackagename
to a valid python module name. - Replace the contents of this file
README.rst
(format documentation here). - Your project is ready for development, refer to the list of makefile targets above for more information.
- Follow the python packaging guide for licenses.
- Edit the file
LICENSE
with a copy of the license you chose as explained in the guide above. - Edit
setup.py
with the proper trove classifiers for the chosen license.
Before making a release, make sure to configure your pypi credentials....
- Set the new version in
version.py
. - Add proper version changes in
CHANGELOG.rst
. - run
make release
.
I recommend using Sphinx for documenting your project.
Sphinx is the unspoken official tool for documentation in the python
ecosystem, it supports many plugins but the Intersphinx
plugin is among the ones I find most useful because it creates a
binary file called objects.inv
that allows other Sphinx-powered
documentation to make direct reference to the documentation of
internal python APIs.