Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9de22f0dd | ||
|
|
7ee1866fe3 | ||
|
|
cbb2dd44f3 |
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Jev Kuznetsov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
82
README.md
82
README.md
@@ -1,81 +1,31 @@
|
||||
# Python CLI Template
|
||||
|
||||
A minimal Cookiecutter template for building personal CLI tools with `uv`, Typer, and strict typing.
|
||||
Minimal Cookiecutter template for python CLI tools. Python 3.12+, uv, Typer, ruff, mypy, pytest.
|
||||
|
||||
## Features
|
||||
## Usage
|
||||
|
||||
- CLI with Typer
|
||||
- `uv_build` backend and lockfile-first reproducibility
|
||||
- Ruff for linting/formatting
|
||||
- MyPy strict mode
|
||||
- Pytest with coverage
|
||||
- Invoke tasks for common operations
|
||||
```bash
|
||||
cruft create git@git.roxautomation.com:sjev/python-cli-template.git
|
||||
cd your-project
|
||||
uv sync --frozen --group dev
|
||||
uv run invoke lint
|
||||
uv run invoke test
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. Generate a new project:
|
||||
```bash
|
||||
cruft create git@git.roxautomation.com:sjev/python-cli-template.git
|
||||
```
|
||||
|
||||
Or locally:
|
||||
```bash
|
||||
cookiecutter /path/to/python-cli-template
|
||||
```
|
||||
|
||||
2. Post-generation hook runs `uv lock` to create `uv.lock`.
|
||||
|
||||
3. Bootstrap the generated project:
|
||||
```bash
|
||||
uv sync --frozen --group dev
|
||||
uv run invoke lint
|
||||
uv run invoke test
|
||||
```
|
||||
|
||||
## Template Variables
|
||||
|
||||
| Variable | Description | Example |
|
||||
|----------|-------------|---------|
|
||||
| `project_name` | Human-readable project name | "My CLI App" |
|
||||
| `project_slug` | Repository/directory name | "my-cli-app" |
|
||||
| `package_name` | Python package name | "my_cli_app" |
|
||||
| `description` | Short project description | "A modern CLI tool" |
|
||||
| `author_name` | Author's full name | "Your Name" |
|
||||
| `author_email` | Author's email | "your.email@example.com" |
|
||||
| `version` | Initial version | "0.1.0" |
|
||||
|
||||
Python is fixed to 3.12+ by template policy.
|
||||
|
||||
## Generated Project Structure
|
||||
## Generated structure
|
||||
|
||||
```
|
||||
your-project/
|
||||
├── README.md
|
||||
├── pyproject.toml
|
||||
├── tasks.py
|
||||
├── uv.lock
|
||||
├── src/
|
||||
│ └── your_package/
|
||||
│ ├── __init__.py
|
||||
│ ├── py.typed
|
||||
│ └── cli.py
|
||||
├── src/your_package/
|
||||
│ ├── __init__.py
|
||||
│ ├── py.typed
|
||||
│ └── cli.py
|
||||
└── tests/
|
||||
└── test_cli.py
|
||||
```
|
||||
|
||||
## Template Development
|
||||
## License
|
||||
|
||||
To modify this template:
|
||||
|
||||
1. Edit files in `{{cookiecutter.project_slug}}/`
|
||||
2. Update variables in `cookiecutter.json`
|
||||
3. Test changes:
|
||||
```bash
|
||||
./test.sh
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- Python 3.12+
|
||||
- `uv`
|
||||
- `cruft` or `cookiecutter`
|
||||
MIT
|
||||
|
||||
56
{{cookiecutter.project_slug}}/.gitignore
vendored
Normal file
56
{{cookiecutter.project_slug}}/.gitignore
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
dist/
|
||||
*.egg-info/
|
||||
.eggs/
|
||||
*.egg
|
||||
pip-wheel-metadata/
|
||||
|
||||
# Virtual environments
|
||||
.venv/
|
||||
venv/
|
||||
env/
|
||||
ENV/
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
.pytest_cache/
|
||||
.coverage
|
||||
.coverage.*
|
||||
htmlcov/
|
||||
coverage.xml
|
||||
|
||||
# Type checkers / linters
|
||||
.mypy_cache/
|
||||
.pyre/
|
||||
.pytype/
|
||||
.ruff_cache/
|
||||
*_cache/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints/
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# IDEs and editors
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# OS files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
Reference in New Issue
Block a user