Git(flow)¶
We use Git for version control and the project is hosted at Github. We use Gitflow (see also this description) for PyRigi development. In a nutshell, this means that there are two prominent branches in PyRigi’s Git repository:
main
, which contains the stable version of the packagedev
, which is used for the development.
Collaborators are not allowed to push their Git commits directly to these two branches. Rather, they should employ pull requests (PR). Say Alice and Bob want to implement feature X in PyRigi. These are the tasks to be performed:
they branch from
dev
, creating a branch calledfeature-X
, and there they develop the intended functionality;once they are done, they push
feature-X
to GitHub and solicit a pull request offeature-X
intodev
;After creating a pull request, but before the branch is merged into
dev
, the code is checked by the maintainers, who may ask some other collaborator to serve as reviewer to ensure that the coding standards and other requirements are satisfied. In a review, Alice and Bob will get comments about specific pieces of code or other further suggestions. Once they think that they have adequately addressed a comment, Alice and Bob can use a tick in the GitHub GUI (:white_check_mark:
✅ or:heavy_check_mark:
✔️ ) to indicate that. If the reviewer agrees, they will resolve the comment.Once the pull request is approved, a maintainer merges
feature-X
intodev
and during the next version release cycle, it will be merged intomain
, making the code available through thepip
installation of PyRigi.
The branch prefixes should be named according the following convention:
Branch prefix |
Usage |
Usual PR prefix |
---|---|---|
|
adding new features, parameters or algorithms* |
|
|
fixing bugs on |
|
|
changing the documentation (including fixes) |
|
|
fixing bugs on |
|
|
adding and refactoring tests |
|
|
refactoring the package source code* |
|
|
creating new release |
|
|
changing technical setting (e.g. GitHub workflows) |
|
|
introducing backward incompatible changes |
|
* Only in backward compatible manner.
Warning
Changes that are not backward compatible can only be introduced on a major-
branch.
When such a branch is merged to dev
, only a major release can follow.
Pull request titles¶
The pull request titles are used for Release Notes. Hence, each PR title has to start with one of the prefixes from the table above followed by a capitalized verb as a past participle. The maintainer who approves and merges a PR is responsible for checking (and possible adjusting) the prefix to match the section in which it should be listed in the Release Notes according to the following tables. The first part of Release Notes is aimed at users:
PR prefix |
Release notes section |
Information about |
---|---|---|
|
New features |
new functionality |
|
Updates |
improvements, interface changes |
|
Bug fixes |
fixed bugs since the last release |
|
Documentation |
changes to User guide or Math documentation |
The second part is meant for developers:
PR prefix |
Release notes section |
Information about |
---|---|---|
|
Testing |
new or changed tests |
|
Technical setup |
changes to technical setting |
|
Code changes |
refactoring and restructuring the code |
|
Development guide |
changes to Development guide |
|
Minor changes |
fixed typos, minor refactoring etc. |
The release notes generated on GitHub stored in doc/release_notes.txt
can be automatically
grouped according to the prefixes by python sort_release_notes.py release_notes.txt
in the doc
folder.
After that, manual adjustments should be made.
For instance:
If a feature was developed (and bug fixed) on several PRs, the latter should be listed under the same item under New features.
If a bug is discovered on
main
, only hot fixed onmain
by disabling the functionality and properly fixed ondev
via afeature-
branch, all corresponding PRs should be in the same item under Bug fixes.
Version Release¶
Once in a while, the maintainers merge the branch dev
into main
and create a new release.
The release numbers follow this scheme:
MAJOR version: significant functionality extensions yielding possibly incompatible API changes (x+1.y.z)
MINOR version: new functionality in a backward compatible manner (x.y+1.z)
PATCH version: backward compatible bug fixes (x.y.z+1).
To create a new MAJOR/MINOR version, the following steps should be taken by the maintainers:
Create a release branch
release-x.y.z
ondev
.Update the
version
andrelease
indoc/conf.py
and theversion
inpyproject.toml
.Update the
contributors.md
.Merge the branch into
dev
.Continue on the release branch and remove the files that are not supposed to be in the release (e.g.
poetry.lock
).Merge the branch into
main
.Check that the online documentation has been deployed correctly.
Add a new release tag in GitHub and generate the corresponding release notes according to the instructions above.
Review the upload to PyPi.
Run
poetry update
and commitpoetry.lock
to update the dependencies ondev
.
To release a new PATCH version, the following should be taken using some steps from above:
Create a release branch
release-x.y.z
onmain
.Step 2. (and 3. if the patch involves a new contributor).
Steps 6.-9.
Pull
main
.Create branch
release-x.y.z-main-to-dev
ondev
.Merge
main
intorelease-x.y.z-main-to-dev
while keeping thepoetry.lock
file fromrelease-x.y.z-main-to-dev
.Merge the branch
release-x.y.z-main-to-dev
via a PR todev
.