We'd love to accept your patches and contributions to this project. We do have some guidelines to follow, covered in this document, but don't be concerned about getting everything right the first time! Create a pull request (discussed below) and we'll nudge you in the right direction.
Contributions to this project must be accompanied by a Contributor License Agreement (CLA). You (or your employer) retain the copyright to your contribution; the CLA simply gives us permission to use and redistribute your contributions as part of the project. Please visit https://cla.developers.google.com/ to see your current agreements on file or to sign a new one. You generally only need to submit a Google CLA once, so if you've already submitted one (even if it was for a different project), you probably don't need to do it again.
Warning
Please note carefully clauses #5 and #7 in the CLA. Any code that you contribute to this project must be your original creation. Code generated by artificial intelligence tools does not qualify as your original creation.
We have a code of conduct to make the Qualtran project an open and welcoming community environment. Please make sure to read and abide by the code of conduct.
All submissions, including submissions by project members, require review. We use the tools provided by GitHub for pull requests for this purpose. The preferred manner for submitting pull requests is to fork the Qualtran repository, create a git branch in this fork to do your work, and when ready, create a pull request from this branch to the main Qualtran repository. The subsections below describe the process in more detail.
Pleae make sure to follow the Google Style Guides in your code, particularly the style guide for Python.
-
Fork the Qualtran repository (you can use the Fork button in upper right corner of the repository page). Forking creates a new GitHub repo at the location
https://github.com/USERNAME/Qualtran
, whereUSERNAME
is your GitHub user name. -
Clone (using
git clone
) or otherwise download your forked repository to your local computer, so that you have a local copy where you can do your development work using your preferred editor and development tools. -
Check out the
main
branch and create a new git branch frommain
:git checkout main -b YOUR_BRANCH_NAME
where
YOUR_BRANCH_NAME
is the name of your new branch.
Do your work and git commit
your changes to your branch as needed.
We use several tools to test code and perform other activities such as
checking formatting against the style guidelines. You can run those tools
locally during development. Wrapper scripts are located in the
check/
subdirectory to simplify running the tools.
- Run
check/pytest
to run the Pytest suite - Run
check/mypy
to run the Mypy type checker - Run
check/pylint
to run the Pylint code linter
-
If your local copy has drifted out of sync with the
main
branch of the main Qualtran repo, you may need to merge the latest changes into your branch. To do this, first update your localmain
and then merge your localmain
into your branch:# Track the upstream repo (if your local repo hasn't): git remote add upstream https://github.com/quantumlib/Qualtran.git # Update your local main. git fetch upstream git checkout main git merge upstream/main # Merge local main into your branch. git checkout YOUR_BRANCH_NAME git merge main
If git reports conflicts during one or both of these merge processes, you may need to resolve the merge conflicts before continuing.
-
Finally, push your changes to your fork of the Qualtran repo on GitHub:
git push origin YOUR_BRANCH_NAME
-
Now when you navigate to the Qualtran repository on GitHub (https://github.com/quantumlib/Qualtran), you should see the option to create a new pull request from your forked repository. Alternatively, you can create the pull request by navigating to the "Pull requests" tab near the top of the page, and selecting the appropriate branches.
-
A reviewer from the Qualtran team will comment on your code and may ask for changes. You can perform the necessary changes locally, commit them to your branch as usual, and then push changes to your fork on GitHub following the same process as above. When you do that, GitHub will update the code in the pull request automatically.