-
Notifications
You must be signed in to change notification settings - Fork 143
Add Copilot instructions file for repository onboarding #1643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: ricardoV94 <[email protected]>
Updated PyTensor instructions to clarify environment usage, testing commands, and design principles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a comprehensive .github/copilot-instructions.md
file to enhance GitHub Copilot coding agents' efficiency when working with the PyTensor repository. The instructions provide essential information about environment setup, build processes, design principles, and repository structure to minimize exploration time and prevent common failures.
- Establishes mandatory micromamba environment usage for all commands
- Documents PyTensor-specific design principles and API differences from NumPy
- Provides complete testing, building, and validation workflows with execution guidance
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
@ricardoV94 Sorry, I don't use Copilot and would prefer not interact with it or with LLMs in general |
I think the onboard is useful for regular folks as well, that's why I tagged other people for review. |
Also, as someone who reviews 99% of the PRs in this repo, and has to deal with an increasing amount of AI slop, I would rather reduce my work upfront. All the recommendations on testing and design principles that I manually included, are things I see myself mentioning over and over again. Even if one chooses not to use copilot/LLMs themselves, they will have to see work done by those tools sooner or later, and if we can make that better everybody wins. |
- `gradient.py`: Auto-differentiation | ||
- `compile/`: Function compilation | ||
- `graph/`: IR and optimization (`graph/rewriting/`) | ||
- `link/`: Backends (`c/`, `jax/`, `numba/`, `pytorch/`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add mlx?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bleeding edge
|
||
Tests are run with `config.floatX == "float32"` and `config.mode = "FAST_COMPILE"`. If needed: | ||
- Cast numerical values `test_value.astype(symbolic_var.type.dtype)` | ||
- Use custom function mode `get_default_mode().excluding("fusion")` or skip tests in `FAST_COMPILE` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does "skip tests in FAST_COMPILE" mean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a test is only relevant in fast run, skip in fast compile. I'll remove that or reword
## Trust These Instructions | ||
These instructions are comprehensive and tested. Only search for additional information if: | ||
1. Instructions are incomplete for your specific task | ||
2. Instructions are found to be incorrect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it effective to give it an "out" like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the prompt they suggested on the GitHub docs
This PR adds a comprehensive
.github/copilot-instructions.md
file to onboard GitHub Copilot coding agents to the PyTensor repository. The goal is to significantly improve agent efficiency by reducing exploration time and build/test failures.What's Included
The instructions file provides essential information that agents need to work effectively:
Critical Environment Setup
micromamba run -n pytensor-test <command>
since PyTensor is pre-installed via.github/workflows/copilot-setup-steps.yml
Build & Test Instructions
PyTensor-Specific Design Principles
config.floatX == "float32"
andconfig.mode = "FAST_COMPILE"
, requiring special handlingRepository Structure
configdefaults.py
,gradient.py
,compile/
,graph/
,link/
,tensor/
, etc.)CI/CD Pipeline
Common Issues
Benefits
This file will help Copilot agents:
assert_equal_computations
, minimizing compilation)File Size
The instructions are 119 lines (~2 pages), meeting the size requirement while remaining comprehensive.
All commands in the instructions have been tested and validated to work correctly.
Original prompt
Your task is to "onboard" this repository to Copilot coding agent by adding a .github/copilot-instructions.md file in the repository that contains information describing how a coding agent seeing it for the first time can work most efficiently.
You will do this task only one time per repository and doing a good job can SIGNIFICANTLY improve the quality of the agent's work, so take your time, think carefully, and search thoroughly before writing the instructions.
- Reduce the likelihood of a coding agent pull request getting rejected by the user due to generating code that fails the continuous integration build, fails a validation pipeline, or having misbehavior. - Minimize bash command and build failures. - Allow the agent to complete its task more quickly by minimizing the need for exploration using grep, find, str_replace_editor, and code search tools. - Instructions must be no longer than 2 pages. - Instructions must not be task specific.Add the following high level details about the codebase to reduce the amount of searching the agent has to do to understand the codebase each time:
Add information about how to build and validate changes so the agent does not need to search and find it each time.
List key facts about the layout and architecture of the codebase to help the agent find where to make changes with minimal searching.
of configuration files for linting, compilation, testing, and preferences.
contents of the README, the contents of any key source files, the list of files in the next level down of directories, giving priority to the more structurally important and snippets of code from key source files, such as the one containing the main method.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.