Thank you for considering to contribute to pycpd
.
This guide is inspired by DOSMA.
There are many ways to contribute:
- Issues: Submitting bugs or suggesting new features
- Documentation: Adding to the documentation or to the examples
- Features: Implementing new features or bug fixes
- Community: Answering questions and helping others get started
Please do your best to follow these guidelines when opening an issue. It will make it signficantly easier to give useful feedback and resolve the issue faster.
We would very much appreciate if you could make sure the bug was not already reported (use the search bar on Github under Issues). If you cannot find you bug, follow the instructions in the Bug Report template.
A world-class feature request addresses the following points:
- Motivation first:
- Is it related to a problem/frustration with the library? If so, please explain why. Providing a code snippet that demonstrates the problem is best.
- Is it related to something you would need for a project? We'd love to hear about it!
- Is it something you worked on and think could benefit the community? Awesome! Tell us what problem it solved for you.
- Write a full paragraph describing the feature;
- Provide a code snippet that demonstrates its future use;
- In case this is related to a paper, please attach a link;
- Attach any additional information (drawings, screenshots, etc.) you think may help.
If your issue is well written we're already 80% of the way there by the time you post it. Follow the instructions in the Feature Request
Before writing code, we strongly advise you to search through the existing PRs or issues to make sure that nobody is already working on the same thing. If you are unsure, it is always a good idea to open an issue to get some feedback.
You will need basic git proficiency to be able to contribute to pycpd. git is not the easiest tool to use but it has the greatest manual. Type git --help in a shell and enjoy. If you prefer books, Pro Git is a very good reference.
Follow these steps to start contributing:
-
Fork the
repository
by clicking on the 'Fork' button the repository's page. This creates a copy of the code under your GitHub user account. -
Clone your fork to your local disk, and add the base repository as a remote:
$ git clone [email protected]:<your Github handle>/pycpd.git $ cd pycpd $ git remote add upstream https://github.com/siavashk/pycpd.git
-
Create a development branch - all changes should merged with the
pycpd
-development
branch:$ git checkout -b development
Do not work on the
master
branch.You can also work on another branch that is named specifically for your problem e.g.,
$ git checkout -b fix_examples
Once you are done with making changes, you can
add
andcommit
them:$ git add . # the . means all files are added $ git commit
and then merge with development before pushing development to your repository:
$ git checkout development $ git merge fix_examples
- pushing to remote is described below.
-
Before making changes etc. set up a development environment by running the following command in a virtual environment:
make dev make requirements
-
Develop features on your branch.
As you work on the features, you should make sure that the test suite passes:
$ make test
Once you're happy with your changes, add changed files using
git add
and make a commit withgit commit
to record your changes locally:$ git add modified_file.py $ git commit
Please write good commit messages.
It is a good idea to sync your copy of the code with the original repository regularly. This way you can quickly account for changes:
$ git fetch upstream $ git rebase upstream/main
Push the changes to the development branch on your repository:
$ git push origin development
-
Once you are satisfied (and the checklist below is happy too), go to the webpage of your fork on GitHub. Click on 'Pull request' to send your changes to the project maintainers for review.
-
It's ok if maintainers ask you for changes. It happens to core contributors too! So everyone can see the changes in the Pull request, work in your local branch and push the changes to your fork. They will automatically appear in the pull request.
Running tests should be done before pushing your changes to your respository to ensure that the code works.
- Make the title of your pull request should be a summary of its contribution;
- If your pull request addresses an issue, mention the issue number in the pull request description
- If your PR is a work in progress, start the title with
[WIP]
- Make sure existing tests pass;
- Add high-coverage tests. Additions without tests will not be merged
Library tests can be found in the tests folder.
From the root of the repository, here's how to run tests with pytest
for the library:
$ make test