|
| 1 | +# Contributing to metriq-gym |
| 2 | + |
| 3 | +Thanks for your interest in improving the project! This guide describes how to get set up, make changes, and submit them for review. For deeper technical context, consult the docs hosted at [metriq-gym.readthedocs.io](https://metriq-gym.readthedocs.io/). |
| 4 | + |
| 5 | +## Getting started |
| 6 | + |
| 7 | +1. Install Python 3.12 or newer and [Poetry](https://python-poetry.org/docs/#installation). |
| 8 | +2. Clone the repository with submodules: |
| 9 | + ```sh |
| 10 | + git clone --recurse-submodules https://github.com/unitaryfoundation/metriq-gym.git |
| 11 | + cd metriq-gym |
| 12 | + ``` |
| 13 | +3. Install dependencies and activate the virtual environment: |
| 14 | + ```sh |
| 15 | + poetry install |
| 16 | + poetry shell # or eval "$(poetry env activate)" |
| 17 | + ``` |
| 18 | +4. Install the pre-commit hooks so linting and type checks run automatically: |
| 19 | + ```sh |
| 20 | + poetry run pre-commit install |
| 21 | + ``` |
| 22 | + |
| 23 | +## Development workflow |
| 24 | + |
| 25 | +- Use `poetry run mgym --help` to confirm the CLI is wired correctly after changes. |
| 26 | +- Keep provider credentials in a local `.env` copied from `.env.example`; never commit secrets. |
| 27 | +- When touching schemas or benchmark examples, validate them with `poetry run mgym job dispatch ...` using a local simulator before opening a PR. |
| 28 | + |
| 29 | +## Coding standards |
| 30 | + |
| 31 | +- Follow the defaults enforced by Ruff: 4-space indentation and 100-character lines. |
| 32 | +- Run `poetry run ruff check --fix` and `poetry run ruff format` before committing. |
| 33 | +- Maintain or extend type hints and verify them with `poetry run mypy`. |
| 34 | +- Add concise, purposeful docstrings; avoid large dumps of commented-out code. |
| 35 | +- Keep provider-specific logic inside the relevant subpackage (`local/`, `quantinuum/`, `qplatform/`). |
| 36 | + |
| 37 | +## Testing checklist |
| 38 | + |
| 39 | +Run the relevant test suites prior to submission: |
| 40 | + |
| 41 | +```sh |
| 42 | +poetry run pytest tests/unit # fast coverage |
| 43 | +poetry run pytest -m e2e # CLI workflows (run before merging) |
| 44 | +poetry run pytest # full suite when feasible |
| 45 | +``` |
| 46 | + |
| 47 | +For features that add new benchmark payloads or alter CLI flows, update fixtures in `jobs/` and document the change in the `CLI Workflows` guide under `docs/source/` if appropriate. |
| 48 | + |
| 49 | +## Commit and PR guidelines |
| 50 | + |
| 51 | +- Use Conventional Commit prefixes (e.g. `fix:`, `feat:`, `chore:`) and keep each commit focused. |
| 52 | +- Rebase on the latest `main` before raising a pull request. |
| 53 | +- Include a clear description, linked issues, and CLI output or screenshots for user-facing changes. |
| 54 | +- Confirm lint, type, and test commands in the PR template or description. |
| 55 | +- Coordinate dependency bumps or submodule updates with maintainers when in doubt. |
| 56 | + |
| 57 | +## Questions and support |
| 58 | + |
| 59 | +- Open a [discussion thread](https://github.com/unitaryfoundation/metriq-gym/discussions) for design questions or roadmap ideas. |
| 60 | +- For quick help, join the `#metriq` channel on [Discord](http://discord.unitary.foundation). |
| 61 | +- Security disclosures should be sent privately to the maintainers listed in `pyproject.toml`. |
0 commit comments