|
1 | 1 | # python-template |
| 2 | + |
| 3 | +A modern Python template for robotics and ML teams that want fast local iteration, reproducible |
| 4 | +setup, and CI-enforced quality gates. |
| 5 | + |
| 6 | +## Why this template |
| 7 | + |
| 8 | +This scaffold is optimized for hybrid robotics + ML work: |
| 9 | + |
| 10 | +- **`uv` first** for fast environment and lockfile management |
| 11 | +- **`pyproject.toml` + `src/` layout** for modern packaging |
| 12 | +- **Ruff + Pyright + pytest** for a strong default quality bar |
| 13 | +- **Makefile** as the single memorable task surface for developers and CI |
| 14 | +- **GitHub Actions** for repeatable checks on Python 3.11–3.13 |
| 15 | +- **Optional extras** so robotics/ML dependencies do not bloat the base environment |
| 16 | + |
| 17 | +## Quickstart |
| 18 | + |
| 19 | +```bash |
| 20 | +uv sync --group dev |
| 21 | +make check |
| 22 | +make run-example-ml |
| 23 | +make run-example-robotics |
| 24 | +``` |
| 25 | + |
| 26 | +To install optional profiles: |
| 27 | + |
| 28 | +```bash |
| 29 | +uv sync --group dev --extra ml |
| 30 | +uv sync --group dev --extra robotics |
| 31 | +uv sync --group dev --all-extras |
| 32 | +``` |
| 33 | + |
| 34 | +## Core tasks |
| 35 | + |
| 36 | +| Task | Purpose | |
| 37 | +| --- | --- | |
| 38 | +| `make sync` | Install the base project environment | |
| 39 | +| `make sync-dev` | Install developer dependencies | |
| 40 | +| `make sync-all` | Install developer dependencies and all optional extras | |
| 41 | +| `make fmt` | Format source, tests, and examples | |
| 42 | +| `make lint` | Run Ruff lint checks | |
| 43 | +| `make typecheck` | Run Pyright | |
| 44 | +| `make test` | Run pytest | |
| 45 | +| `make test-cov` | Run pytest with coverage | |
| 46 | +| `make check` | Run format, lint, typecheck, and tests | |
| 47 | +| `make build` | Build wheel and sdist | |
| 48 | +| `make audit` | Run dependency vulnerability checks | |
| 49 | +| `make run-example-ml` | Execute the ML stub | |
| 50 | +| `make run-example-robotics` | Execute the robotics stub | |
| 51 | + |
| 52 | +## Project layout |
| 53 | + |
| 54 | +```text |
| 55 | +. |
| 56 | +├── .devcontainer/ |
| 57 | +├── .github/workflows/ |
| 58 | +├── docs/ |
| 59 | +├── examples/ |
| 60 | +│ ├── ml/ |
| 61 | +│ └── robotics/ |
| 62 | +├── src/python_template/ |
| 63 | +└── tests/ |
| 64 | +``` |
| 65 | + |
| 66 | +## Quality workflow |
| 67 | + |
| 68 | +Local and CI use the same contract: |
| 69 | + |
| 70 | +```bash |
| 71 | +make check |
| 72 | +make build |
| 73 | +``` |
| 74 | + |
| 75 | +That keeps the README, local workflow, and GitHub Actions aligned. |
| 76 | + |
| 77 | +## Profiles |
| 78 | + |
| 79 | +- `ml`: data-science friendly optional dependencies for training/evaluation prototypes |
| 80 | +- `robotics`: lightweight robotics-adjacent dependencies for adapters and integration code |
| 81 | +- `viz`: visualization and richer terminal output helpers |
| 82 | + |
| 83 | +See [`docs/ml.md`](docs/ml.md) and [`docs/robotics.md`](docs/robotics.md) for guidance. |
| 84 | + |
| 85 | +## GitHub Actions |
| 86 | + |
| 87 | +The repository ships with: |
| 88 | + |
| 89 | +- `ci.yml` for lint/type/test matrix checks |
| 90 | +- `build.yml` for build + wheel smoke validation |
| 91 | +- `audit.yml` for dependency auditing |
| 92 | +- `release.yml` for tag-driven build artifacts |
| 93 | + |
| 94 | +## Dev container |
| 95 | + |
| 96 | +The included dev container is meant to give teammates a reproducible Linux environment with `uv` |
| 97 | +installed and the dev dependencies synced on first open. |
0 commit comments