Development¶
Local setup¶
git clone https://github.com/HSPK/usm.git
cd usm
uv sync # installs runtime + dev deps
uv tool install --force . # makes `usm` point at this checkout
After uv tool install --force ., your usm command runs your local
edits. Run the released version again with uv tool install --force usmo.
Running tests¶
101+ tests covering usmo.core and scripts/openai_proxy.py. Tests live
under tests/ and are wired up so scripts in scripts/ can be imported
directly (see tests/conftest.py).
Linting & formatting¶
The project uses Ruff:
Both run automatically via pre-commit:
Adding a new command¶
- Drop a file into
scripts/(.shor.py). - Add an entry in
scripts/_config.json:Only{ "scripts": { "myscript": { "description": "What this does in one line.", "path": "myscript.py", "requirements": ["click>=8.2.1"] } } }pathis required;descriptionshows up inusm list;requirementsare installed once into a persistent per-script venv. - Commit. The pre-commit hook fills in
versionandhash. - Test it:
usm --debug myscript. - Add a docs page under
docs/commands/myscript.mdand link it frommkdocs.yml's nav.
Editing an existing script¶
- Edit the file under
scripts/. - Try it locally with
usm --debug <name>. - Commit. Pre-commit auto-bumps the patch version + records the new hash.
- If you want a minor/major bump, run manually:
Building the docs locally¶
uv sync --group docs
uv run mkdocs serve # live-reloading at http://127.0.0.1:8000
uv run mkdocs build --strict # one-shot build, fails on broken links
Release flow¶
Tag a commit on main with vMAJOR.MINOR.PATCH:
That triggers .github/workflows/release.yml, which:
- Builds the sdist + wheel with
uv build(version comes from the tag viahatch-vcs). - Uploads them as an artifact.
- Creates a GitHub Release with auto-generated notes from the commit range, attaching the artifacts.
- Publishes to PyPI via Trusted Publishing (no secrets needed; the
association is set up under the
releaseenvironment on the repo).
Pre-releases (tags containing -, e.g. v0.4.0-rc1) skip PyPI and
mark the GitHub Release as prerelease.
Repo layout¶
.
├── src/usmo/ # the installable package
│ ├── cli/ # click + rich frontend (app, presenters, …)
│ ├── core/ # pure SDK (catalog, environments, …)
│ └── _version.py # written by hatch-vcs at build
├── scripts/ # everything served via the CLI
│ ├── _config.json
│ ├── tunnel.py
│ ├── init.py
│ ├── ...
│ └── install.sh # bootstrap script (not a usm subcommand)
├── tests/ # pytest suite
├── dev/bump_version.py # pre-commit hook & manual release helper
├── docs/ # mkdocs site (this site!)
├── mkdocs.yml
├── .github/workflows/
│ ├── release.yml # tag -> build + GitHub Release + PyPI
│ └── docs.yml # main -> mkdocs build + GitHub Pages
└── pyproject.toml