Add .github/copilot-instructions.md for Copilot coding agent#157
Open
Add .github/copilot-instructions.md for Copilot coding agent#157
Conversation
Documents project architecture, code conventions, testing patterns, reviewer preferences, and PR review workflow so that the Copilot coding agent can handle review comments autonomously.
- Add style rule: no decorative section separators or redundant comments - Add testing rule: use @pytest.mark.parametrize for variations - Both learned from RotemKalisch's review feedback on PR #156
RotemKalisch
requested changes
Apr 5, 2026
| - `ramanujantools/flint_core/symbolic_matrix.py` — `SymbolicMatrix`. | ||
| - `Matrix.walk()` dispatches to `NumericMatrix.walk()` or `SymbolicMatrix.walk()` based on input type. | ||
| - `@batched` decorator (`ramanujantools/utils/batched.py`) allows `iterations` to be scalar or list. | ||
| - `NumericMatrix.lambda_from_rt()` compiles a SymPy matrix into a fast FLINT evaluator. |
| - `Matrix.walk()` dispatches to `NumericMatrix.walk()` or `SymbolicMatrix.walk()` based on input type. | ||
| - `@batched` decorator (`ramanujantools/utils/batched.py`) allows `iterations` to be scalar or list. | ||
| - `NumericMatrix.lambda_from_rt()` compiles a SymPy matrix into a fast FLINT evaluator. | ||
| - `Matrix._walk_inner` has an LRU cache; clear with `Matrix._walk_inner.cache_clear()` before benchmarks. |
| ### Testing | ||
| - Tests live next to source as `*_test.py` files (e.g., `numeric_matrix_test.py`). | ||
| - Run with `pytest`. Benchmarks use `pytest-benchmark`. | ||
| - Benchmarks live in `matrix_benchmark.py` and run **strictly via pytest**, never as standalone scripts. |
| ## Code conventions | ||
|
|
||
| ### Testing | ||
| - Tests live next to source as `*_test.py` files (e.g., `numeric_matrix_test.py`). |
Member
There was a problem hiding this comment.
Give matrix_test.py as an example, a more central code example.
| ### Numeric precision | ||
| - **Never use Python `float`** for mathematical verification. Use `mpmath.mpf`, `sympy.Rational`, or FLINT types. | ||
| - Set `mpmath.mp.dps` to at least 2× the digits you need. | ||
| - Verify formulas to 100+ decimal places. |
Member
There was a problem hiding this comment.
Kinda arbitrary, I'd remove this
| 1. Read every review comment carefully before making changes. | ||
| 2. Prefer the simplest fix that addresses the reviewer's concern. | ||
| 3. Run the relevant tests after every change (`pytest <test_file> -v`). | ||
| 4. If the reviewer asks to check for existing utilities/packages, do the research and report findings even if no suitable alternative exists. |
| 3. Run the relevant tests after every change (`pytest <test_file> -v`). | ||
| 4. If the reviewer asks to check for existing utilities/packages, do the research and report findings even if no suitable alternative exists. | ||
| 5. Commit with a clear message referencing which review comments are addressed. | ||
|
|
Member
There was a problem hiding this comment.
Add: When resolving a comment, mark it as resolved. When unsure how to proceed, ask in a comment.
| ## Reviewer preferences (RotemKalisch) | ||
|
|
||
| - Benchmarks must be pytest-only — no `if __name__ == "__main__"` standalone scripts. | ||
| - Test through the public `Matrix` class API where possible. |
|
|
||
| - Benchmarks must be pytest-only — no `if __name__ == "__main__"` standalone scripts. | ||
| - Test through the public `Matrix` class API where possible. | ||
| - Check for existing pythonic utilities/packages before writing custom algorithms. |
Member
There was a problem hiding this comment.
Only if they do not introduce new dependencies. If they do - need to weigh the pros and cons. Should discuss with the user.
|
|
||
| ## Repository rules | ||
|
|
||
| - Do not push to `master` directly. Use feature branches and PRs. |
Member
There was a problem hiding this comment.
Branch style: x/y where x is feature, bugfix, hotfix, refactororoptimization, and y` is a short description
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a .github/copilot-instructions.md file so the GitHub Copilot coding agent can work autonomously on this repo with full project context.
What it covers
Why
Enables the Copilot coding agent to handle PR review comments, issue assignments, and code changes while following the team's established conventions.
How to enable
A repo admin needs to go to Settings -> Copilot -> Coding agent and toggle it on. Then use @copilot in any PR comment or issue to invoke it with these instructions loaded.