A Python project template that highlights some best practices in Python packaging. Can be used as a GitHub template for your new Python project.
-
The name of the Git repository should be the PyPi name of the package and should be what you type as
import mypackagename
. That means no hyphens in package names! -
Your package should be a one-trick pony. Nobody wants to install a huge toolbox if all they need is the image converter in it.
-
After
import yourpackagename
, people should be able to callyourpackagename.__version__
. This helps with debugging. -
Choose a license for your code and provide a
LICENSE[.txt]
in the root level of your package as well as a statement in your main README. choosealicense.com can help you make a decision. -
Use linting and formatting, include those in your integration tests.
-
Once you have tests in order, make sure they are executed with every git push. Popular CI services that run your tests are GitHub Actions, Travis CI, and CircleCI. This repository contains the config files for each of them.
-
Make sure that nobody can push to main. On GitHub, go to Settings -> Branches -> Add rule and select Require status checks to pass before merging and Include administrators. Development happens in pull requests, this makes sure that nobody -- including yourself -- ever accidentally pushes something broken to main.
-
Use a tool for measuring test coverage. codecov is one, and your CI provider submits the data to it.
-
If you have CI set up, want to show test coverage, or advertise the availability on PyPi, do so using a badge at the top of your README. Check out shields.io for what's available.
-
Include contributing guidelines and a code of conduct (edit to add appropriate enforcement contacts or use a template) to help foster a community.
First run
find . -type f -print0 -name "*.py" -o -name Makefile -o -name "*.yml" | xargs -0 sed -i 's/rohan-rk4/your-project-name/g'
and rename the folder rohan-rk4
to customize the name.
There is a simple Makefile
that can help you with certain tasks:
-
Run
make format
to apply formatting. -
Run
make lint
to check formatting and style. -
Run
make publish
to- tag your project on git (
make tag
) - upload your package to PyPi (
make upload
)
After publishing, people can install your package with
pip3 install rohan-rk4
- tag your project on git (
To run the rohan-rk4 unit tests, check out this repository and do
tox
rohan-rk4 is published under the MIT license.