https://github.com/turbobasic/python-cli-app-template
Python CLI app template project featuring the modern and extensible Python project manager hatch
https://github.com/turbobasic/python-cli-app-template
cli hatch python
Last synced: 6 months ago
JSON representation
Python CLI app template project featuring the modern and extensible Python project manager hatch
- Host: GitHub
- URL: https://github.com/turbobasic/python-cli-app-template
- Owner: turboBasic
- License: mit
- Created: 2024-09-17T05:03:25.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-29T10:10:27.000Z (8 months ago)
- Last Synced: 2025-05-29T11:51:34.464Z (8 months ago)
- Topics: cli, hatch, python
- Language: Python
- Homepage: https://turbobasic.github.io/python-cli-app-template/
- Size: 1.12 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
- Authors: AUTHORS.md
Awesome Lists containing this project
README
# python-cli-app-template
Boilerplate for Python CLI utility project.
[](https://github.com/turboBasic/python-cli-app-template/actions/workflows/build.yml)
[](https://codecov.io/gh/turboBasic/python-cli-app-template)

## Features
* Uses [Hatch] - modern PEP-compliant project manager
* Uses [Typer] framework for managing CLI commands
* Uses [Dynaconf] for flexible management of configurations
## Usage
```bash
pca --help
```
## Development
To set up [hatch] and [pre-commit] for the first time:
1. install [hatch] globally, e.g. with [pipx] or brew, i.e. `pipx install hatch`,
2. make sure [pre-commit] is installed globally, e.g. with `pipx install pre-commit`.
A special feature that makes hatch very different from other familiar tools is that you almost never
activate, or enter, an environment. Instead, you use `hatch run env_name:command` and the `default` environment
is assumed for a command if there is no colon found. Thus you must always define your environment in a declarative
way and hatch makes sure that the environment reflects your declaration by updating it whenever you issue
a `hatch run ...`. This helps with reproducability and avoids forgetting to specify dependencies since the
hatch workflow is to specify everything directly in [pyproject.toml]. Only in rare cases, you
will use `hatch shell` to enter the `default` environment, which is similar to what you may know from other tools.
To get you started, use `hatch run test:cov` or `hatch run test:no-cov` to run the unitest with or without coverage reports,
respectively. Use `hatch run lint:all` to run all kinds of typing and linting checks. Try to automatically fix linting
problems with `hatch run lint:fix` and use `hatch run docs:serve` to build and serve your documentation.
You can also easily define your own environments and commands. Check out the environment setup of hatch
in [pyproject.toml] for more commands as well as the package, build and tool configuration.
The environments defined by hatch are configured to generate lock files using [hatch-pip-compile] under `locks`.
To upgrade all packages in an environment like `test`, just run `hatch run test:upgrade-all`. To upgrade specific
packages, type `hatch run test:upgrade-pkg pkg1,pkg2`.
## Credits
This package was created with [The Hatchlor] project template.
[The Hatchlor]: https://github.com/florianwilhelm/the-hatchlor
[Typer]: https://typer.tiangolo.com/
[dynaconf]: https://www.dynaconf.com/
[pipx]: https://pypa.github.io/pipx/
[hatch]: https://hatch.pypa.io/
[pre-commit]: https://pre-commit.com/
[hatch-pip-compile]: https://github.com/juftin/hatch-pip-compile
[pyproject.toml]: https://github.com/turboBasic/python-cli-app-template/blob/main/pyproject.toml