Contribute#
Thank you for considering a contribution to PyPLUTO!
We welcome:
bug reports
feature requests
documentation improvements
tests
code contributions
If you find a bug or have an idea, open an issue first (or go straight to a pull request if you already have a fix).
Code of Conduct#
Please follow our community guidelines in the CODE_OF_CONDUCT.md file at
the root of the repository.
Use of AI#
The use of AI (for example, LLMs) is allowed if used responsibly.
Every contributor remains responsible for what they submit: all generated code and text must be reviewed by a human before being published.
This also applies to communication (issues, pull requests, and emails). AI-assisted translation is acceptable, but please make sure the final text matches your intent.
To keep PyPLUTO maintainable, autonomous agents must not contribute without human supervision.
Prerequisites#
Python
>=3.11(the CI matrix currently tests3.12,3.13, and3.14)Git
A virtual environment tool (
uv,pixi,venv,conda, etc.)
Local Setup#
Fork and clone the repository:
$ git clone https://github.com/GiMattia/PyPLUTO.git
$ cd PyPLUTO
Option A: uv (recommended)
Create a reproducible environment from the lockfile:
$ uv sync --all-extras --all-groups
Run commands inside the synced environment with uv run, for example:
$ uv run pre-commit run --all-files
$ uv run pytest -v ./Tests
Option B: pixi
Install the full environment declared in pyproject.toml:
$ pixi install -e full
Run tools in that environment:
$ pixi run -e all pre-commit run --all-files
$ pixi run -e all pytest -v ./Tests
Option C: pip fallback (not lockfile-based)
$ pip install -r requirements_dev.txt
requirements_dev.txt installs the project in editable mode with development
extras.
Pre-commit and Quality Checks#
Install hooks:
$ pre-commit install
$ pre-commit install --hook-type pre-push
Run all standard checks locally:
$ pre-commit run --all-files
Run manual-stage checks before opening a PR:
$ pre-commit run --all-files --hook-stage manual
Current checks include:
standard
pre-commit-hookssanity checksrufflint/formatlock consistency checks (
uv lock --check,pixi lock --check)pyrighttype checking (pre-pushandmanualstages)pytestwith coverage threshold (manual, fail-under 45 %)
Type checking#
PyPLUTO uses pyright as its standard
type checker. Run it locally with the dev dependency group installed:
$ pyright
The configuration lives in the [tool.pyright] section of pyproject.toml,
so the same settings are used from the CLI, CI, and editors.
pyright was chosen because it is currently the only checker that validates the
patterns PyPLUTO relies on — notably Generic classes with overloaded
__new__ (used to type loaded variables such as Data.rho from the
constructor) and the rejection of unknown Unpack[TypedDict] keyword
arguments (e.g. catching Load(format=2)).
pyrefly and ty (the typefuture dependency group) are kept
installable but are not the source of truth yet. Every issue they would
currently report is already covered by pyright, and they do not yet fully
validate the patterns above. The intent is to switch to one of them once they
mature.
A couple of legacy modules (amr.py, nabla.py) are excluded from type
checking via a file-level # type: ignore until they are reworked.
Running Tests#
Run the full suite:
$ pytest -v ./Tests
Run with coverage:
$ pytest --cov=pyPLUTO --cov-report=term-missing Tests/
Please ensure that all tests pass before submitting a pull request.
Documentation#
Docs are in Docs/source. To build locally:
$ make -C Docs html
Workflow for Pull Requests#
Create a branch from
master.Keep changes focused and small when possible.
Add or update tests for behavioral changes.
Run pre-commit checks (see above).
Push and open a pull request with:
a clear summary of changes
why the change is needed
notes on tests performed
CI runs style checks and tests across multiple OSes and Python versions. A PR is expected to pass all checks.
Project Structure#
Top-level layout:
src/pyPLUTO/: main package codeTests/: test suite and test dataExamples/: runnable examples and sample outputsDocs/: Sphinx documentation
Package subfolders inside src/pyPLUTO/:
gui/: GUI panels, widgets, and main window logicimagefuncs/: image/plot manager classesloadfuncs/: data loading and parsingtoolfuncs/: analysis tools (derivatives, transforms, units, etc.)utils/: shared utilities
Load, LoadPart, and Image follow the same architecture: a state
class (LoadState / BaseLoadState / ImageState) holds all data; a
mixin class (LoadMixin / BaseLoadMixin / ImageMixin) exposes the
public interface; manager classes in the subfolders implement individual
operations and receive the state object at construction time.
Questions#
For questions or suggestions, open an issue in the GitHub repository or contact the developers directly.