This is a cookiecutter repository to generate the file structure for a Python project that uses Poetry for its dependency management.
- Poetry for dependency management
- CI/CD with GitHub Actions
- Pre-commit hooks with pre-commit
- Formatting with black and isort
- Linting with flake8
- Static type checking with mypy
- Dependency checking with cookiecutter-poetry
- Publishing to Pypi or Artifactory by creating a new release on GitHub
- Testing with pytest
- Test coverage with codecov
- Documentation with MkDocs
- Compatibility testing for multiple versions of Python with Tox
- Containerization with Docker
On your local machine, navigate to the directory in which you want to create a project directory, and run the following two commands:
pip install cookiecutter-poetry
ccp
Alternatively, install cookiecutter
and directly pass the URL to this
Github repository to the cookiecutter
command:
pip install cookiecutter
cookiecutter https://github.com/fpgmaas/cookiecutter-poetry.git
Create a repository on GitHub, and then run the following commands, replacing <project-name>
, with the name that you gave the Github repository and
<github_author_handle>
with your Github username.
cd <project_name>
git init -b main
git add .
git commit -m "Init commit"
git remote add origin git@github.com:<github_author_handle>/<project_name>.git
git push -u origin main
Finally, install the environment and the pre-commit hooks with
make install
You are now ready to start development on your project! The CI/CD pipeline will be triggered when you open a pull request, merge to main, or when you create a new release.
To finalize the set-up for publishing to PyPi or Artifactory, see here. For activating the automatic documentation with MkDocs, see here. To enable the code coverage reports, see here.
This project is partially based on Audrey Feldroy's's great cookiecutter-pypackage repository.