Development
Setting up
Section titled “Setting up”uv installs Python 3.13 (pinned in .python-version) and the
development tools from uv.lock:
git clone https://github.com/opalehq/trueflac.gitcd trueflacuv syncThe package supports Python 3.11 and later; the CI also runs the tests on 3.11, on macOS and on Windows.
Checks
Section titled “Checks”uv run pytestuv run ruff check src tests bench scriptsuv run ruff format --check src tests bench scriptsuv run mypy srcThe same checks, and the commit message rules, run before each commit with pre-commit. Install the hooks once:
uvx pre-commit install --hook-type pre-commit --hook-type commit-msgThe tests use synthetic audio only: a sine wave cut like an encoder does, a signal built on a codec grid. No audio file is stored in the repository. A change to the detection is measured on the bench as well.
Layout
Section titled “Layout”| Path | What it holds |
|---|---|
src/trueflac/analysis.py |
analyze(): the cut highs, then the grids. |
src/trueflac/grid.py |
The AAC and Vorbis grid: the MDCT at every start, the contrast, the agreement of two places. |
src/trueflac/mp3grid.py |
The MP3 grid: the 576 line shapes rebuilt from the standard. |
src/trueflac/verdict.py |
Verdict, Status, Clue, Cancelled, describe(). |
src/trueflac/cli.py |
The trueflac command. |
bench/ |
Builds the bench and scores the detector. |
docs/ |
This site. |
Commits
Section titled “Commits”Commit messages follow Conventional Commits:
type(scope): subject, the subject at most 72 characters, body lines at most 100. The scope is
optional; when there is one, it comes from a closed list:
| Scope | For |
|---|---|
detector |
The analysis: cut, grids, verdict. |
cli |
The command. |
bench |
The bench scripts. |
deps |
Dependencies. |
release |
Release commits, written by semantic-release. |
merge |
Merge commits. |
feat makes a minor release, fix and perf a patch; see Releasing.
Every pull request is checked against .commitlintrc.json.
Branches
Section titled “Branches”develop holds the work in progress, main the released versions. One branch per topic, from
develop, merged back into develop through a pull request.
Previewing these docs
Section titled “Previewing these docs”The site is built with Kiln, with Docker. The Python reference is
read from api.json, written by griffe from the
docstrings (Google style):
uvx --from 'griffe>=1.14,<2' griffe dump trueflac --search src --docstyle google --full --output api.jsondocker run --rm -it -p 4321:4321 -v "$PWD":/project ghcr.io/laidwin/kiln:v1 serveThen open http://localhost:4321/. site/ and api.json are not committed: the docs workflow
builds both on GitHub.