Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Report bugs at https://github.com/nanograv/pint/issues.
If you are reporting a bug, please include:
- The output of
pint.print_info()
. This command provides the version information of the OS, Python, PINT, and the various dependencies along with other information about your system. - Any details about your local setup that might be helpful in troubleshooting, such as the command used to install PINT and whether you are using a virtualenv, conda environment, etc.
- Detailed steps to reproduce the bug, as simply as possible. A self-contained code snippet that triggers the issue will be most helpful.
The best way to send feedback is to file an issue at https://github.com/nanograv/pint/issues.
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome :)
Look through the GitHub issues for bugs. Anything tagged with good first issue, help wanted, or bug is open to whoever wants to implement it. If you want to fix a bug or add any other code, please use GitHub and suggest your changes in the form of a Pull Request (see below); this makes it easy for everyone to examine your changes, discuss them with you, and update them as needed.
Look through the GitHub issues for features. Anything tagged with "enhancement" and "help wanted" is open to whoever wants to implement it. If your idea is for a new feature or an important change, you may want to open an issue where the idea can be discussed before you write too much code.
PINT could always use more documentation, whether as part of the official pint docs, in docstrings, or even on the web in blog posts, articles, and such.
Writing documentation is a great way to get started: everyone wants there to be documentation, but no one wants to stop writing code long enough to write it, so we are all very grateful when you do. And as a result of figuring out enough to write good documentation, you come to understand the code very well.
Ready to contribute? Here's how to set up PINT for local development.
Fork the PINT repo on GitHub.
Clone your fork locally:
$ git clone git@github.com:your_name_here/pint.git
Install your local copy into a conda environment. Assuming you have conda installed, this is how you set up your fork for local development:
$ conda create -n pint-devel python=3.10 $ conda activate pint-devel $ cd PINT/ $ conda install -c conda-forge --file requirements_dev.txt $ conda install -c conda-forge --file requirements.txt $ pip install -e . $ pre-commit install
The last command installs pre-commit hooks which will squawk at you while trying to commit changes that don't adhere to our Coding Style.
Alternatively, this can also be done using virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
$ mkvirtualenv pint-devel $ cd PINT/ $ pip install -r requirements_dev.txt $ pip install -e . $ pre-commit install
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you're done making changes, check that your changes pass the tests. Also check that any new docs are formatted correctly:
$ make test $ tox $ make docs
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Check that our automatic testing in "GitHub Actions" passes for your code. If problems crop up, fix them, commit the changes, and push a new version, which will automatically update the pull request:
$ git add pint/file-i-just-fixed.py $ git commit -m "Fixed bug where..." $ git push
The maintainers will review and comment on the PR. They may ask why you made certain design decisions or ask you to make some stylistic or functional changes. If accepted, it will be merged into the master branch.
Before you submit a pull request, check that it meets these guidelines:
- Try to write clear Pythonic code, follow our Coding Style, and think about how others might use your new code.
- The pull request should include tests that cover both the expected behavior and sensible error reporting when given bad input.
- If the pull request adds or changes functionality, the docs should
be updated. Put your new functionality into a function with a
docstring. Check the HTML documentation produced by
make docs
to make sure your new documentation appears and looks reasonable. If the new functionality needs a more detailed explanation than can be put in a docstring, add it todocs/explanation.rst
. Make sure that the docstring contains a brief description as well. - The pull request should work for and 3.8+. Make sure that all the CI tests for the pull request pass.
- Update
CHANGELOG-unreleased.md
with an appropriate entry. Please note thatCHANGELOG.md
should not be updated for pull requests.