Skip to content

Development

uv installs Python 3.13 (pinned in .python-version) and the development tools from uv.lock:

Terminal window
git clone https://github.com/opalehq/trueflac.git
cd trueflac
uv sync

The package supports Python 3.11 and later; the CI also runs the tests on 3.11, on macOS and on Windows.

Terminal window
uv run pytest
uv run ruff check src tests bench scripts
uv run ruff format --check src tests bench scripts
uv run mypy src

The same checks, and the commit message rules, run before each commit with pre-commit. Install the hooks once:

Terminal window
uvx pre-commit install --hook-type pre-commit --hook-type commit-msg

The 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.

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.

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.

develop holds the work in progress, main the released versions. One branch per topic, from develop, merged back into develop through a pull request.

The site is built with Kiln, with Docker. The Python reference is read from api.json, written by griffe from the docstrings (Google style):

Terminal window
uvx --from 'griffe>=1.14,<2' griffe dump trueflac --search src --docstyle google --full --output api.json
docker run --rm -it -p 4321:4321 -v "$PWD":/project ghcr.io/laidwin/kiln:v1 serve

Then open http://localhost:4321/. site/ and api.json are not committed: the docs workflow builds both on GitHub.

Built with Kiln