We welcome contributions of all types: from fixing typos to bug fixes to new features.
Help wanted: identifying bad error messages
We strive—but sometimes fail—to make every error message easy to understand and to give insight into what went wrong and how to fix it.
If you ever encounter a confusing or mediocre error message, we would love your help to identify the error message. Please open a GitHub issue with the original Pants command, the error message, and what you found confusing or think could be improved.
(If you'd be interested in then changing the code, we'd be happy to point you in the right direction!)
Most of Pants is written in Python 3. The majority of contributions touch this Python codebase.
We rely on several Python features that you will want to acquaint yourself with:
- Type hints and MyPy
- We do not use
asyncio. The scheduler is implemented in Rust. We only use
- We do not use
Pants's engine is written in Rust. See Developing Rust for a guide on making changes to the internals of Pants's engine.
Before investing your time into a code change, it helps to share your interest. This will allow us to give you initial feedback that will save you time, such as pointing you to related code.
To share your plan, please either open a GitHub issue or message us on Slack (you can start with the #general channel). Briefly describe the change you'd like to make, including a motivation for the change.
If we do not respond within 24 business hours, please gently ping us by commenting "ping" on your GitHub issue or messaging on Slack asking if someone could please take a look.
Tip: Can you split out any "prework"?
If your change is big, such as adding a new feature, it can help to split it up into multiple pull requests. This makes it easier for us to review and to get passing CI.
This is a reason we encourage you to share your plan with us - we can help you to scope out if it would make sense to split into multiple PRs.
To begin, set up Pants on your local machine.
In the Pants repository, we usually use the
./v2 script to run Pants, instead of the normal
./pants script. This will run Pants using the improved V2 experience.
For example, to run a test, run:
$ ./v2 test src/python/pants/util/frozendict_test.py
Periodically, you will want to run MyPy and the autoformatters and linters:
# Format un-committed changes $ ./v2 --changed-since=HEAD fmt # Lint un-comitted changes $ ./v2 --changed-since=HEAD lint # Run MyPy $ build-support/bin/mypy.py # Run the pre-commit checks, including MyPy and `lint` $ build-support/githooks/pre-commit
See our Style guide for some Python conventions we follow.
You can share works in progress!
You do not need to fully finish your change before asking for feedback. We'd be eager to help you while iterating.
If doing this, please open your pull request as a "Draft" and prefix your PR title with "WIP". Then, comment on the PR asking for feedback and/or post a link to the PR in Slack.
When opening a pull request, start by providing a concise and descriptive title. It's okay if you aren't sure what to put - we can help you to reword it.
- Fix typo in
- Add Thrift code generator for Python
- Fix crash when running
testwith Python 3.9
- Fix bug
- Fix #8313
- Add support for Thrift code generation by first adding the file
codegen.py, then hooking it up, and finally adding tests
Then, include a description. You can use the default template if you'd like, or use a normal description instead. Link to any corresponding GitHub issues.
Tip: Review your own PR
It is often helpful to other reviewers if you proactively review your own code. Specifically, add comments to parts where you want extra attention.
- "Do you know of a better way to do this? This felt clunky to write."
- "This was really tricky to figure out because there are so many edge cases. I'd appreciate extra attention here, please."
- "Note that I did not use a dataclass here because I do not want any of the methods like
__eq__to be generated."
FYI: we squash merge
This means that the final commit message will come from your PR description, rather than your commit messages.
Good commit messages are still very helpful for people reviewing your code; but, your PR description is what will show up in the changelog.
We use Travis CI for continous integration. Look for your build in https://travis-ci.com/github/pantsbuild/pants/pull_requests.
If you encounter a failure and can't figure out what it is, don't panic - this might be a flaky test or a test timing out.
When this happens, please comment on your pull request or send a message to the #infra channel in Slack for someone to restart the shard and document the flake.
One or more reviewers will leave feedback. If you are confused by any of the feedback, please do not be afraid to ask for clarification!
If we do not respond within 24 business hours, please gently ping us by commenting "ping" on your pull request or messaging on Slack asking if someone could please take a look.
Once one or more reviewers have approved—and CI goes green—a reviewer will merge your change.
When will your change be released?
Your change will be included in the next weekly dev release, which usually happens every Friday or Monday. If you fixed a bug, your change may also be cherry-picked into a release candidate from the prior release series.
See Release strategy.
Updated over 3 years ago