|
| 1 | +# RocketPy Workspace Instructions |
| 2 | + |
| 3 | +## Code Style |
| 4 | +- Use snake_case for variables, functions, methods, and modules. Use descriptive names. |
| 5 | +- Use PascalCase for classes and UPPER_SNAKE_CASE for constants. |
| 6 | +- Keep lines at 88 characters and follow PEP 8 unless existing code in the target file differs. |
| 7 | +- Run Ruff as the source of truth for formatting/import organization: |
| 8 | + - `make format` |
| 9 | + - `make lint` |
| 10 | +- Use NumPy-style docstrings for public classes, methods, and functions, including units. |
| 11 | +- In case of tooling drift between docs and config, prefer current repository tooling in `Makefile` |
| 12 | + and `pyproject.toml`. |
| 13 | + |
| 14 | +## Architecture |
| 15 | +- RocketPy is a modular Python library; keep feature logic in the correct package boundary: |
| 16 | + - `rocketpy/simulation`: flight simulation and Monte Carlo orchestration. |
| 17 | + - `rocketpy/rocket`, `rocketpy/motors`, `rocketpy/environment`: domain models. |
| 18 | + - `rocketpy/mathutils`: numerical primitives and interpolation utilities. |
| 19 | + - `rocketpy/plots`, `rocketpy/prints`: output and visualization layers. |
| 20 | +- Prefer extending existing classes/patterns over introducing new top-level abstractions. |
| 21 | +- Preserve public API stability in `rocketpy/__init__.py` exports. |
| 22 | + |
| 23 | +## Build and Test |
| 24 | +- Use Makefile targets for OS-agnostic workflows: |
| 25 | + - `make install` |
| 26 | + - `make pytest` |
| 27 | + - `make pytest-slow` |
| 28 | + - `make coverage` |
| 29 | + - `make coverage-report` |
| 30 | + - `make build-docs` |
| 31 | +- Before finishing code changes, run focused tests first, then broader relevant suites. |
| 32 | +- When running Python directly in this workspace, prefer `.venv/Scripts/python.exe`. |
| 33 | +- Slow tests are explicitly marked with `@pytest.mark.slow` and are run with `make pytest-slow`. |
| 34 | +- For docs changes, check `make build-docs` output and resolve warnings/errors when practical. |
| 35 | + |
| 36 | +## Development Workflow |
| 37 | +- Target pull requests to `develop` by default; `master` is the stable branch. |
| 38 | +- Use branch names in `type/description` format, such as: |
| 39 | + - `bug/<description>` |
| 40 | + - `doc/<description>` |
| 41 | + - `enh/<description>` |
| 42 | + - `mnt/<description>` |
| 43 | + - `tst/<description>` |
| 44 | +- Prefer rebasing feature branches on top of `develop` to keep history linear. |
| 45 | +- Keep commit and PR titles explicit and prefixed with project acronyms when possible: |
| 46 | + - `BUG`, `DOC`, `ENH`, `MNT`, `TST`, `BLD`, `REL`, `REV`, `STY`, `DEV`. |
| 47 | + |
| 48 | +## Conventions |
| 49 | +- SI units are the default. Document units and coordinate-system references explicitly. |
| 50 | +- Position/reference-frame arguments are critical in this codebase. Be explicit about orientation |
| 51 | + (for example, `tail_to_nose`, `nozzle_to_combustion_chamber`). |
| 52 | +- Include unit tests for new behavior. Follow AAA structure and clear test names. |
| 53 | +- Use fixtures from `tests/fixtures`; if adding a new fixture module, update `tests/conftest.py`. |
| 54 | +- Use `pytest.approx` for floating-point checks where appropriate. |
| 55 | +- Use `@cached_property` for expensive computations when helpful, and be careful with stale-cache |
| 56 | + behavior when underlying mutable state changes. |
| 57 | +- Keep behavior backward compatible across the public API exported via `rocketpy/__init__.py`. |
| 58 | +- Prefer extending existing module patterns over creating new top-level package structure. |
| 59 | + |
| 60 | +## Testing Taxonomy |
| 61 | +- Unit tests are mandatory for new behavior. |
| 62 | +- Unit tests in RocketPy can be sociable (real collaborators allowed) but should still be fast and |
| 63 | + method-focused. |
| 64 | +- Treat tests as integration tests when they are strongly I/O-oriented or broad across many methods, |
| 65 | + including `all_info()` convention cases. |
| 66 | +- Acceptance tests represent realistic user/flight scenarios and may compare simulation thresholds to |
| 67 | + known flight data. |
| 68 | + |
| 69 | +## Documentation Links |
| 70 | +- Contributor workflow and setup: `docs/development/setting_up.rst` |
| 71 | +- Style and naming details: `docs/development/style_guide.rst` |
| 72 | +- Testing philosophy and structure: `docs/development/testing.rst` |
| 73 | +- API reference conventions: `docs/reference/index.rst` |
| 74 | +- Domain/physics background: `docs/technical/index.rst` |
| 75 | + |
| 76 | +## Scoped Customizations |
| 77 | +- Simulation-specific rules: `.github/instructions/simulation-safety.instructions.md` |
| 78 | +- Test-authoring rules: `.github/instructions/tests-python.instructions.md` |
| 79 | +- RST/Sphinx documentation rules: `.github/instructions/sphinx-docs.instructions.md` |
| 80 | +- Specialized review persona: `.github/agents/rocketpy-reviewer.agent.md` |
0 commit comments