A newer version of this Cookiecutter (using the amazing Typer!) is currently work in progress and available here.
- Containerization
- Pre-commit hooks
- black
- click
- flake8
- mkdocs-material
- mypy
- packaging
Install cookiecutter.
pip install --user cookiecutterGenerate your project template using cookiecutter.
cookiecutter gh:ltpitt/cookiecutter-python-cli-
cdinto project directory. -
Create a virtual environment.
python -m venv venv- Linux / Mac - Activate it.
source venv/Scripts/activate- Windows - Activate it.
source venv/Scripts/Activate.ps1- Linux / Mac - Install development dependencies with editable mode to test the CLI.
make install- Windows - Install development dependencies with editable mode to test the CLI.
pip install -e . -r requirements/dev.txtThis Cookiecutter comes with two generic CLI commands, namely, init and hello.
NOTE
<<cli_command>>is the executable command you choose for your CLI during project setup.
<<cli_command>> init<<cli_command>> helloCLI commands can be tested with Docker.
-
Build an image for the CLI.
Image is tagged <<cli_command>> name.
make docker-image- Run the command inside the container.
docker-run --rm <<cli_command>> init- Linux / Mac - Install documentation-related dependencies.
make docs- Windows - Install development dependencies with editable mode to test the CLI.
pip install -r requirements/docs.txt- Linux / Mac - Serve the docs locally.
make serve-docs- Windows - Serve the docs locally.
mkdocs serve -f docs/mkdocs.ymlNOTE
Make sure you have account in PyPI before you try this out.
To publish you CLI to PyPI, run:
make distributionsdist directory will be created inside your project directory. Upload it to PyPI using:
twine dist/*For help related to make commands.
make help