Skip to content

Commit

Permalink
Add more info to CONTRIBUTING.md
Browse files Browse the repository at this point in the history
This adds more general information, along with an important warning
about AI-generated code.
  • Loading branch information
mhucka committed Feb 28, 2025
1 parent 8cdfd99 commit c117090
Showing 1 changed file with 114 additions and 20 deletions.
134 changes: 114 additions & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,123 @@
# How to Contribute
# How to contribute

We'd love to accept your patches and contributions to this project. There are
just a few small guidelines you need to follow.
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.

## Contributor License Agreement
## Before you begin

Contributions to this project must be accompanied by a Contributor License
Agreement (CLA). You (or your employer) retain the copyright to your
contribution; this simply gives us permission to use and redistribute your
contributions as part of the project. Head over to
<https://cla.developers.google.com/> to see your current agreements on file or
to sign a new one.
### Sign our Contributor License Agreement

You generally only need to submit a 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.
Contributions to this project must be accompanied by a [Contributor License
Agreement](https://cla.developers.google.com/about) (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.

## Code Reviews
> [!WARNING]
> Please note carefully clauses [#5](https://cla.developers.google.com/about/google-corporate#:~:text=You%20represent%20that%20each%20of%20Your%20Contributions%20is%20Your%20original%20creation)
> and [#7](https://cla.developers.google.com/about/google-corporate#:~:text=Should%20You%20wish%20to%20submit%20work%20that%20is%20not%20Your%20original%20creation%2C%20You%20may%20submit%20it%20to%20Google%20separately)
> 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.
### Review our community guidelines

We have a [code of conduct](CODE_OF_CONDUCT.md) to make the Stim project an open
and welcoming community environment. Please make sure to read and abide by the
code of conduct.

## Contribution process

All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
information on using pull requests.
use the tools provided by GitHub for [pull
requests](https://help.github.com/articles/about-pull-requests/) for this
purpose. The preferred manner for submitting pull requests is to fork the Stim
[repository](https://github.com/quantumlib/Stim), create a [git
branch](https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell) in
this fork to do your work, and when ready, create a pull request from this
branch to the main Stim repository. The subsections below describe the process
in more detail.

Pleae make sure to follow the [Google Style
Guides](https://google.github.io/styleguide/) in your code, particularly the
[style guide for Python](https://google.github.io/styleguide/pyguide.html).

### Repository forks

1. Fork the Stim repository (you can use the _Fork_ button in upper right
corner of the [repository page](https://github.com/quantumlib/Stim)).
Forking creates a new GitHub repo at the location
`https://github.com/USERNAME/Stim`, where `USERNAME` is your GitHub user
name.

1. 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.

1. Check out the `main` branch and create a new git branch from `main`:

```shell
git checkout main -b YOUR_BRANCH_NAME
```

where `YOUR_BRANCH_NAME` is the name of your new branch.

### Development and testing

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/`](./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

### Pull requests and code reviews

1. If your local copy has drifted out of sync with the `main` branch of the
main Stim repository, you may need to merge the latest changes into
your branch. To do this, first update your local `main` and then merge your
local `main` into your branch:

```shell
# Track the upstream repo (if your local repo hasn't):
git remote add upstream https://github.com/quantumlib/Stim.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](
https://docs.github.com/articles/about-merge-conflicts) before continuing.

1. Finally, push your changes to your fork of the Stim repo on GitHub:

```shell
git push origin YOUR_BRANCH_NAME
```

## Community Guidelines
1. Now when you navigate to the Stim repository on GitHub
(https://github.com/quantumlib/Stim), 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.

This project follows
[Google's Open Source Community Guidelines](https://opensource.google/conduct/).
1. A reviewer from the Stim 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.

0 comments on commit c117090

Please sign in to comment.