Skip to content

Commit b0ef661

Browse files
mhauruAoifepenelopeysm
authored
Add a section on pull requests to contributing instructions (#635)
* Add a section on pull requests to contributing instructions * Improvements to contribution guide * Add semantic line breaks * Add note about breaking releases * Respond to review feedback * Fix a typo * Tone adjustment * misc grammar tweaks * Update developers/contributing/index.qmd Co-authored-by: Penelope Yong <penelopeysm@gmail.com> --------- Co-authored-by: Aoife <aoife1hughes@gmail.com> Co-authored-by: Penelope Yong <penelopeysm@gmail.com>
1 parent 9b10aed commit b0ef661

File tree

1 file changed

+93
-2
lines changed

1 file changed

+93
-2
lines changed

developers/contributing/index.qmd

Lines changed: 93 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Closing one of these may involve implementing new features, fixing bugs, or writ
1515

1616
You can also join the `#turing` channel on the [Julia Slack](https://julialang.org/slack/) and say hello!
1717

18-
If you are new to open-source software, please see [GitHub's introduction](https://guides.github.com/introduction/flow/) or [Julia's contribution guide](https://github.com/JuliaLang/julia/blob/master/CONTRIBUTING.md) on using version control for collaboration.
18+
If you are new to open source software, please see [GitHub's introduction](https://guides.github.com/introduction/flow/) or [Julia's contribution guide](https://github.com/JuliaLang/julia/blob/master/CONTRIBUTING.md) on using version control for collaboration.
1919

2020
### Documentation
2121

@@ -47,7 +47,98 @@ This one would run all files with "optim" or "hmc" in their path, such as `test/
4747
julia --project=. -e 'import Pkg; Pkg.test(; test_args=ARGS)' -- optim hmc --skip ext
4848
```
4949

50-
Or otherwise, set the global `ARGS` variable, and call `include("test/runtests.jl")`.
50+
Alternatively, set the global `ARGS` variable, and call `include("test/runtests.jl")`.
51+
52+
### Pull requests, versions, and releases
53+
54+
We merge all code changes through pull requests on GitHub.
55+
To make a contribution to one of the Turing packages, fork it on GitHub, start a new branch on your fork, and add commits to it.
56+
Once you're done, open a pull request to the main repository under [TuringLang](https://github.com/TuringLang).
57+
Someone from the dev team will review your code (if they don't, ping `@TuringLang/maintainers` in a comment to get their attention) and check that the continuous integration tests pass (with some allowed exceptions, see below).
58+
If all looks good, we'll merge your PR with gratitude.
59+
If not, we'll help you fix it and then merge it with gratitude.
60+
61+
Everything in this section about pull requests and branches applies to the Turing.jl and DynamicPPL.jl repositories.
62+
Most of it also applies to other repositories under the TuringLang ecosystem, though some do not bother with the `main`/`breaking` distinction or with a `HISTORY.md`.
63+
As at August 2025 we are slowly moving towards having all repos do the full process, so a new `HISTORY.md` in a repo that doesn't yet have one is always welcome.
64+
65+
#### Branches
66+
67+
Like Julia packages generally, Turing.jl follows [semantic versioning](https://semver.org/).
68+
Because of this, we have two persistently alive branches in our repository: `main` and `breaking`.
69+
All code that gets released as a new version of Turing gets merged into `main`, and a release is made from there.
70+
However, any breaking changes should first be merged into `breaking`.
71+
`breaking` will then periodically be merged into `main`.
72+
73+
The idea is that `breaking` always contains commits that build towards the next breaking release in the semantic versioning sense.
74+
That is, if the changes you make might break or change the behaviour of correctly written code that uses Turing.jl, your PR should target the `breaking` branch, and your code should be merged into `breaking`.
75+
If your changes cause no such breakage for users, your PR should target `main`.
76+
Notably, any bug fixes should merge directly into `main`.
77+
78+
This way we can frequently release new patch version from `main`, while developing breaking changes in parallel on `breaking`.
79+
E.g. if the current version is 0.19.3, and someone fixes a bug, we can merge the fix into `main` and release it as 0.19.4.
80+
Meanwhile, breaking changes can be developed and merged into `breaking`, which is building towards a release of 0.20.0.
81+
Multiple breaking changes may be accumulated into `breaking`, before finally the `breaking`-to-`main` merge is done, and 0.20.0 is released.
82+
On `breaking` the version number should then immediately be bumped to 0.21.
83+
84+
We do not generally backport bug fixes, although we may consider doing so in special circumstances.
85+
86+
#### Change history
87+
88+
We keep a cumulative changelog in a file called `HISTORY.md` at the root of the repository.
89+
It should have an entry for every new breaking release, explaining everything our users need to know about the changes, such as what may have broken and how to fix things to work with the new version.
90+
Any major new features should also be described in `HISTORY.md`, as may any other changes that are useful for users to know about.
91+
Bug fixes generally don't need an entry in `HISTORY.md`.
92+
Any new breaking release must have an entry in `HISTORY.md`, entries for non-breaking releases are optional.
93+
94+
#### Continuous integration (CI) tests
95+
96+
We generally run the whole test suite of each repository in a GitHub action, typically for a few different versions of Julia, including the earliest supported version and the latest stable release.
97+
On some repositories we also run a few other checks in CI, such as code formatting and simple benchmarks.
98+
Generally all tests except those run on a prerelease version of Julia (e.g. a release candidate of an upcoming Julia release), and all code formatting checks, should pass before merging a PR.
99+
Exceptions can be made if the cause of the failure is known and unrelated to the PR.
100+
CI checks other than tests and formatting serve various purposes, and some of them can be allowed to fail.
101+
Some examples are
102+
103+
- Anything running on a prerelease of Julia. These inform us of trouble ahead when that prerelease becomes an actual release, but don't require fixing for a PR to be merged.
104+
- Any code coverage checks. Code coverage numbers can be helpful in catching missing tests or cases where the tests don't test what they are intended to. However, we do not insist on any particular coverage figures, since they are not a very good metric of a test suite's extensiveness.
105+
- The benchmarks on DynamicPPL repo. These should be investigated to understand why they fail. If the reason is a bug in the PR, an actual test should be added to the test suite to catch it. However, sometimes they fail for unrelated reasons.
106+
- Occasionally CI failures are caused by bugs that require upstream fixes (such as for AD backends, or base Julia). Please ping a maintainer if you are unsure if this is the case. A good indicator for this is if the same test is failing on the base branch of your pull request.
107+
- The CI check in the `docs` repo for whether the docs are built with the latest Turing.jl release. This test failing is a reminder that we should make a PR to update to the latest version, but does not need fixing when working on a PR that makes unrelated changes to the documentation.
108+
109+
If you are ever unsure whether some CI check needs to pass, or if the reason why one is failing is mysterious or seems unrelated to the PR, ask a maintainer and they'll help you out.
110+
111+
#### Please make mistakes
112+
113+
Getting pull requests from outside the core developer team is one of the greatest joys of open source maintenance, and Turing's community of contributors is its greatest asset.
114+
If you are thinking of contributing, please do open a pull request, even an imperfect or half-finished one, or an issue to discuss it first if you prefer.
115+
You don't need to nail all of the above details on the first go, the dev team is very happy to help you figure out how to bump version numbers or whether you need to target `main` or `breaking`.
116+
117+
#### For Turing.jl core developers
118+
119+
If you are a core developer of TuringLang, two notes, in addition to the above, apply:
120+
121+
1. You don't need to make your own fork of the package you are editing.
122+
Just make a new branch on the main repository, usually named `your-username/change-you-are-making` (we don't strictly enforce this convention though).
123+
You should definitely still make a branch and a PR, and never push directly to `main` or `breaking`.
124+
2. You can make a release of the package after your work is merged into `main`.
125+
This is done by leaving a comment on the latest commit on `main`, saying
126+
127+
```
128+
@JuliaRegistrator register
129+
130+
Release notes:
131+
[YOUR RELEASE NOTES HERE]
132+
```
133+
134+
If you are making a breaking release, your release notes must also contain the string `Breaking changes` somewhere in them (this is mandated by the `@JuliaRegistrator` bot, described below).
135+
136+
The `@JuliaRegistrator` bot will handle creating a pull request into the Julia central package repository and tagging a new release in the repository.
137+
The release notes should be a copy-paste of the notes written in `HISTORY.md` if such an entry exists, or otherwise (for a patch release) a short summary of changes.
138+
139+
Even core devs should always merge all their code through pull requests into `main` or `breaking`.
140+
All code should generally be reviewed by another core developer and pass continuous integration (CI) checks.
141+
Exceptions can be made in some cases though, such as ignoring failing CI checks where the cause is known and not due to the current pull request, or skipping code review when the pull request author is an experienced developer of the package and the changes are trivial.
51142

52143
### Code Formatting
53144

0 commit comments

Comments
 (0)