|
1 | | -# barebones-python-module |
2 | | -Barebones python3 module with testing and logging environment |
| 1 | +# myapp |
3 | 2 |
|
4 | | -## Environment |
5 | | -This repo contains the environment to start coding with an enabled App module (main program), a Logger (logging capabilities), and Tests (using pytest). It has been set up so modules can be imported from anywhere without braking the application. |
| 3 | +A fork-ready, microservice-friendly Python template. |
6 | 4 |
|
7 | | -## Settings |
8 | | -Global settings should be configured in `module_config.py` as it is on the root directory. |
| 5 | +Clone, init, test, run — then extend with your own services. |
| 6 | + |
| 7 | +## Quickstart |
| 8 | + |
| 9 | +```bash |
| 10 | +just init # install deps, create data dirs, check environment |
| 11 | +just test # run all tests |
| 12 | +just run # run the default service |
| 13 | +``` |
| 14 | + |
| 15 | +Requires [uv](https://docs.astral.sh/uv/) and [just](https://github.com/casey/just). See `just doctor` for environment checks. |
| 16 | + |
| 17 | +## What You Get |
| 18 | + |
| 19 | +- **uv-native** workflows — `pyproject.toml` as single source of truth, `uv.lock` committed |
| 20 | +- **Microservice architecture** — each service in `src/myapp/services/` with clear boundaries |
| 21 | +- **Typed schemas** — Pydantic models at every boundary, versioned with `schema_version` |
| 22 | +- **Dual persistence** — JSON (atomic file writes) + SQLite (WAL mode), independent by design |
| 23 | +- **CLI** — Click-based, auto-discovers service commands (`project svc <name> <cmd>`) |
| 24 | +- **Optional Streamlit UI** — wraps the same service APIs as the CLI |
| 25 | +- **Quality gates** — ruff, mypy, pytest, all runnable via `just check` |
| 26 | +- **CI** — GitHub Actions running the same gates with uv |
| 27 | + |
| 28 | +## Project Structure |
| 29 | + |
| 30 | +``` |
| 31 | +src/myapp/ |
| 32 | +├── cli/ # top-level CLI entrypoint |
| 33 | +├── shared/ # config, logging, base schemas, persistence |
| 34 | +│ └── persistence/ # BaseStore, JsonStore, SqliteStore |
| 35 | +└── services/ |
| 36 | + └── example/ # example service (copy to create new ones) |
| 37 | + ├── api.py # public interface |
| 38 | + ├── schemas.py # I/O models |
| 39 | + ├── cli.py # service CLI commands |
| 40 | + ├── storage/ # JSON + SQLite adapters |
| 41 | + └── tests/ # service tests |
| 42 | +ui/ # optional Streamlit app |
| 43 | +data/ # runtime data (gitignored contents) |
| 44 | +docs/ # guides and reference |
| 45 | +``` |
| 46 | + |
| 47 | +## Commands |
| 48 | + |
| 49 | +```bash |
| 50 | +just --list # see all available commands |
| 51 | +just init # bootstrap project |
| 52 | +just doctor # verify environment |
| 53 | +just fmt # format code |
| 54 | +just lint # lint code |
| 55 | +just typecheck # run mypy |
| 56 | +just test # run pytest |
| 57 | +just check # all quality gates |
| 58 | +just run # run default service |
| 59 | +just cli <args> # run any CLI command |
| 60 | +just ui # launch Streamlit |
| 61 | +``` |
| 62 | + |
| 63 | +## Documentation |
| 64 | + |
| 65 | +| Guide | Description | |
| 66 | +|-------|-------------| |
| 67 | +| [Quickstart](docs/quickstart.md) | Get running in 3 commands | |
| 68 | +| [Architecture](docs/architecture.md) | Services, boundaries, data flow | |
| 69 | +| [CLI Reference](docs/cli-reference.md) | All commands and options | |
| 70 | +| [Persistence](docs/persistence.md) | JSON vs SQLite, no-sync explained | |
| 71 | +| [Extending](docs/extending.md) | Add services, commands, schemas, UI pages | |
| 72 | + |
| 73 | +## Adding a New Service |
| 74 | + |
| 75 | +```bash |
| 76 | +mkdir -p src/myapp/services/myservice/{storage,tests} |
| 77 | +# Copy and adapt from services/example/ |
| 78 | +# The CLI auto-discovers it — no registration needed |
| 79 | +project svc myservice --help |
| 80 | +``` |
| 81 | + |
| 82 | +See [Extending](docs/extending.md) for the full walkthrough. |
| 83 | + |
| 84 | +## License |
| 85 | + |
| 86 | +MIT |
0 commit comments