Contributing

We accept code contributions to amaGama, please use GitHub pull requests for your changes.

Preparations

You will need a local working copy of amaGama. The best way to achieve that is to follow the installation guidelines.

Coding style

Please follow the Translate Toolkit Style Guide.

Every commit is checked by the hooks in .pre-commit-config.yaml: ruff, codespell, the copyright header, whitespace and file checks, the GitHub workflow files (zizmor and their schema) and the commit message (gitlint). Install them once per checkout with prek (installed by requirements/dev.txt; pre-commit reads the same config); CI runs the same hooks:

$ prek install

To check the whole tree:

$ prek run --all-files

Every Python file and bin/ script starts with the copyright header in .license.header.txt; AUTHORS.md lists who has contributed. Add yourself there with your first change.

Running the tests

The tests start their own PostgreSQL server with pytest-postgresql, which needs PostgreSQL’s server binaries installed. Without them, run the tests in Docker against your checkout:

$ docker compose run --rm test

Fuzzing

The fuzz targets in fuzz/ feed generated input to the code that reads untrusted text: the file readers the updater uses, language codes, a lookup’s options and text, and the language negotiation. They run with Atheris under ClusterFuzzLite: for a few minutes on each pull request, and for two hours every day on main. Each target’s seed inputs are in fuzz/corpus/; the tests run every target over them.

amagama/tests/test_api_fuzz.py sends generated requests to the API and the web pages. The tests run it with the same examples every time; to run many more, new ones each time:

$ AMAGAMA_FUZZ=1 pytest amagama/tests/test_api_fuzz.py

A problem fuzzing finds gets an issue. Until it is fixed, the target or test lets that input through, with the issue number beside it.

Planned work

Planned work and known problems are tracked in the issue tracker.