How to contribute
Thank you for thinking of contributing!
Reporting issues
Include the following information in your post:
Describe what you expected to happen.
If possible, include a minimal reproducible example to help us identify the issue. This also helps check that the issue is not with your own code.
Describe what actually happened. Include the full traceback if there was an exception.
List your Python and other versions. If possible, check if this issue is already fixed in the latest releases or the latest code in the repository.
Submitting patches
If there is not an open issue for what you want to submit, prefer opening one for discussion before working on a PR. You can work on any issue that doesn’t have an open PR linked to it or a maintainer assigned to it. These show up in the sidebar. No need to ask if you can work on an issue that interests you.
Include the following in your patch:
Use Black to format your code. This and other tools will run automatically if you install pre-commit using the instructions below.
Include tests if your patch adds or changes code. Make sure the test fails without your patch.
Update any relevant docs pages and docstrings. Docs pages and docstrings should be wrapped at 72 characters.
Add an entry in
CHANGES.rst
. Use the same style as other entries. Also include.. versionchanged::
inline changelogs in relevant docstrings.
Setting up
Download and install:
Make sure you have a GitHub account.
Configure git with your username and email.
> git config --global user.name "<your full name>"" > git config --global user.email <your email address>
-
Expiration: No expiration
Permissions: “repo” and “workflow”
Configure git with your token:
> git config --global credential.helper manager > git clone https://github.com/cr3/python-template Cloning into 'python-template'...
Select “manager”
Check “Always use this from now on” and press “Select”
Sign in with token and paste your token
Clone the main repository locally.
> git clone https://github.com/cr3/pytest_unique > cd pytest_unique
Create a virtualenv.
> make setup
Troubleshooting
Solving environment: failed ResolvePackageNotFound: - python=3.11
The cache is probably corrupt - run
conda clean -a
.
Starting to code
Create a branch to identify the issue you would like to work on.
> git fetch origin > git checkout -b <your branch name> origin/main
Using your favorite editor, make your changes, committing as you go.
Include tests that cover any code changes you make. Make sure the test fails without your patch. Run the tests as described below.
Push your commits to your branch on GitHub and create a pull request. Link to the issue being addressed with
fixes #123
in the pull request.> git push origin <your branch name>
Running the tests
Run the basic test suite with pytest:
> make test
Checking the syntax
Check syntax with black
and ruff
:
> poetry install --with check
> make check
Building the docs
Build the docs in the docs
directory using Sphinx:
> poetry install --with docs
> make docs
Update the apidoc when adding new modules:
> sphinx-apidoc --force --implicit-namespaces -o docs pytest_unique
Open build/html/index.html
in your browser to view the docs.
Read more about Sphinx.