-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Streamlining pytest's git workflow #6571
Conversation
As promised, this is my proposal. This is really more intended for discussion. Two things I didn't consider are the CI setup and the Read The Docs setup. I can look into that, but would appreciate any help/comments. |
Thanks, I agree with your suggestion. (As for the transition plan we might want to not include |
Thanks @bluetech, looks good! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lovely expansion on what i proposed a while back on the ml,
i like the bugfix branch workflow
I added a "Contingency" section to the RFC, just for completeness (not very interesting). I added a commit to update CI branch filters -- I don't think there is anything more needed for that? Regarding RTD, I don't see a configuration file for it in the repo, but maybe I missed it. If it's updated from master, it means that it will start showing unreleased documentation. Maybe that's fine? Ideally it will render from latest tag or such. |
👍
Also, as a contributor, sometimes I don't read those until after making changes, and seeing the link in the PR editor, and then have to rebase/redo the work on the other base branch. So from a contributor point of view, definitely +1 to a single We have a similar process with Pillow (ref) and I think it works well. Essentially:
Suggestion:
Either use or don't use Existing tags don't use
Very minor suggestion: Great you have a
|
Thanks for taking a look @hugovk.
Thanks, that's a good reference, I'll add it to the text.
For some reason I thought the tags use
👍 from me. |
In order to unblock this, I tried looking at the I think the best course of action is to slightly change the transition plan so that we don't need to block on it. I'll describe the changes in a separate comment. |
I'd like to slightly amend the workflow. I'd leave it for a couple of days in case anyone would like to comment, and then apply it to the PR. After that, we could hopefully set a date for the transition. Previously, I wrote that the So I'd like to change it so the |
(Sorry, I got slightly confused, there are no changes needed. The transition plan as laid out branches |
I've pushed a 5.3.x branch (based on the 5.3.4 tag), looking into releasing 5.3.5 with the fix for #6517 |
8b12344
to
dc9653f
Compare
Thanks @blueyed. I applied your change (squashed). I also updated the text and HOWTORELEASE according to my comment above. |
dc9653f
to
1ab6167
Compare
HOWTORELEASE.rst
Outdated
|
||
* **patch releases**: from the latest ``master``; | ||
#. Create a branch ``release-MAJOR.MINOR.PATCH`` from the ``MAJOR.MINOR.x`` branch. | ||
(Note: historically, the ``4.6.x`` branch is called ``4.6-maintenance``). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might rename the branch too, I think.
Just need to update the name in py27-py34-deprecation.rst
too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, this will be more consistent. I'll go ahead and add the doc changes to this PR, and add the rename to the transition steps.
@@ -10,40 +10,38 @@ taking a lot of time to make a new one. | |||
pytest releases must be prepared on **Linux** because the docs and examples expect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might rename this to RELEASING.rst
as @hugovk suggests. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reminding me, I'll add it to this PR.
git checkout origin/master -b cherry-pick-maintenance-release | ||
git cherry-pick --no-commit -m1 origin/4.6-maintenance | ||
git checkout origin/master -b cherry-pick-release | ||
git cherry-pick --no-commit -m1 origin/MAJOR.MINOR.x | ||
git checkout origin/master -- changelog | ||
git commit # no arguments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing that is not clear for me from the docs: do we keep MAJOR.MINOR.x
branches around forever, or do we delete them when they go unsupported?
Currently a version goes unsupported when the next minor/major is released: so for example the 5.3
series gets unsupported after 5.4
gets its first release.
I think we should delete 5.3.x
when 5.4.0
is released for the first time. This avoids generating confusion that a bunch of 5.3.x
, 5.4.x
, 5.5.x
, etc, on the repository means that those versions are still supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My inclination is to keep the branches around forever, for the following reasons, however I don't feel strongly about this. If you prefer to delete, I can update the text - let me know.
-
It makes it easier to switch over to old reference points in git and in GitHub UI. Tags are less convenient because you need to check which is the latest first, while with the branch you just have
.x
. And in GitHub UI switching to old tags is takes more steps than switching to a branch. I do it often in django at least. -
You never know when you might need that branch anyway, even if it's unsupported.
-
I don't like deleting things :)
Also, I don't really think that people will construe the existence of a branch to mean it's still supported, though maybe I'll be proven wrong about it... Confusion/fat finger might happen though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you prefer to delete, I can update the text - let me know.
I don't feel strongly about it either, let's see if others chime in. If nobody does, let's go with keeping the branches around given you are the author of the PR. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it becomes a problem we can always start deleting then!
With the 5.3.5 I've created it before merging like we did before, but it is inconsistent with the 5.3.4 tag on the 5.3.x branch (which I've created based on the tag). I think it would make sense to create the tag on the 5.3.x branch directly, i.e. after merging release-5.3.5 into it.
#!/bin/sh
set -ex
tag=$(git describe --abbrev=0 --tags)
branch=${tag%.*}.x
relcommit=$(git rev-parse "origin/$branch^{/^Preparing release version}")
git checkout --no-track origin/master -b cp-release
git show "$relcommit" -- doc/en/announce doc/en/changelog.rst | git apply --index -
git commit -m "$(printf 'doc: release-%s\n\n(cherry picked from commit %s)' "$tag" "$relcommit")" This is similar to what was done for the 4.6-maintenance branch (point 6 in https://github.com/pytest-dev/pytest/blob/8b123446fd53e771c9894efbee6b987c0fee17ec/HOWTORELEASE.rst#release-procedure), and should be generalized, since our release branches are similar now. |
Indeed. We used to push the tag to In the new workflow we don't have this risk, because the branches are isolated, so 👍 from me. Also 👍 regarding cherry-picking the docs. |
Agreed. The current text does imply the tag should be created on the release branch, but I'll clarify it.
Yes, in the latest update I generalized this step of cherry-picking the doc updates to master from only running for the maintenance branch to be run on all releases. I kept the commands from the previous version, if they need improvement please push to this PR, I'll probably get it wrong myself :) |
Updated according to comments. Thanks @blueyed and @nicoddemus for kicking it off with the 5.3.5 release. Unless there are further comments, I'd like to set the transition to this Friday (2 days from now). I think I can do all of the steps myself. |
Awesome, thanks @bluetech for taking charge of this. 👍 |
This comment has been minimized.
This comment has been minimized.
8d27e92
to
dc244cf
Compare
@bluetech I know that @RonnyPfannschmidt said he cannot be bothered to do this on a separate branch in #6387 (comment), but at least would like to "warn" about this "one last time". (I think there should be a refactor-nodes branch still, where this could evolve / get done - there is no reason to break plugins unnecessarily because of this, especially since currently it is only about the redirection, and no "real changes" in general). I have not checked, but probably just running "mypy" with coverage reports before and after "node-from-parent" should indicate that we're not helping ourselves with this indirection, and from what I understood there is no plan / way to add typing to it at least. I'm sorry to be annoying in this regard and will shut up after this eventually gets merged, but since my previous comment about it appears to have been ignored I wanted to state this again ("one last time"). |
@blueyed I understand (and actually share...) your concern, but I think it shouldn't affect this transition, because the status quo regarding releases remains the same:
|
Sure, but merging features into master now makes it more complicated to back out, just like e.g. merging #6387 "just because it is tainted already" (#6387 (comment)). |
Do you mean you're OK with merging If so, I'd be really great to have assistance from an admin of the repo, because there are some things that need permissions (I think). To recap the transition steps, we should do the following, preferably in quick succession:
|
Just to clarify, you have the required permissions for all you listed. 😁 I would love to help, but I'm leaving for the day so wanted to leave that comment in case it helps. |
Maybe I'm missing something but I don't think I have permissions to do these things:
At least I hope I don't :) |
I would wait with that until all PRs have been changed to use master, otherwise PRs might be broken. Should be no problem after features is merged, but better to let PR owners do it manually I guess. PR list: https://github.com/pytest-dev/pytest/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+base%3Afeatures |
My plan was to leave comments on these PRs. Excluding PRs from us who participated in this PR, it leaves 6 open PRs.
Let's see... If it doesn't handle it, we can defer actually deleting |
In a test repo, I branched from |
Aw, so we shouldn't delete it immediately. Thanks for checking @hugovk. @nicoddemus, let's skip the "delete features branch" for now and I'll open an issue to track this afterwards. |
It's possible to change the base branch for PRs: |
Co-Authored-By: Daniel Hahler <[email protected]>
dc244cf
to
c3e53a0
Compare
@nicoddemus Updated. |
Duh the PR already contained the docs changed, so I just pushed For the next release we need to make sure to always merge |
@bluetech wanna do the honors of merging |
The features branch is no more. Development of features is now also done on master. See pytest-dev#6571.
🎉 @nicoddemus I sent a PR #6716. |
Okay, @nicoddemus did the technical part. All that's left now is to handle the open PRs against |
Thanks, appreciate it! 🙇 |
This RFC proposes changes to pytest's git workflow, with the aim of streamlining development.
Current situation
There are two branches,
master
andfeatures
.CONTRIBUTING.md and the pull request template instruct contributors to
master
for bug fixes/doc changes/trivial changes.features
for new features/improvements/functionality changes/removals/deprecations.Patch releases are made by branching from
master
, making the release and merging back tomaster
in the release PR.Minor releases are made by branching from
features
, mergingmaster
, making the release and merging back tomaster
in the release PR.Occasionally, changes that pile up in
master
are merged back intofeatures
with a "Merge master into features" PR.Problems with current situation
Contributors need to make a choice to target either
master
orfeatures
. This adds some friction.Sometimes, they don't read CONTRIBUTING.md or the pull request template, and they target
master
when they should have targetedfeatures
. The maintainers need to ask them to rebase.Sometimes, the maintainers disagree with the contributor's choice, and the contributor is asked to rebase.
Sometimes, maintainers themselves disagree if some change should go to
master
or justfeatures
.To need for "Merge master into features" PRs adds work and overhead.
Sometimes, some feature development discovers bugs or minor fixes which should go to master. They then need to be split and submitted in a separate PR. The feature PR is then blocked until a "Merge master into features" happens.
Sometimes, changes that don't really need to go to patch releases are merged to
master
, and cause regressions in patch releases, which end users expect to be safe to upgrade to.Proposed solution
The
features
branch is removed. Both feature and bugfix development happens onmaster
.Releases are made as follows:
Create a branch
MAJOR.MINOR.x
(e.g.5.3.x
), if one doesn't already exist from a previous minor/major release, branched from the latestMAJOR.MINOR.0
tag (e.g.5.3.0
), and push it to the main repository.Branch from the
MAJOR.MINOR.x
branch, cherry pick commits for the release frommaster
, make the release and merge back toMAJOR.MINOR.x
in the release PR.After the release, cherry-pick the changelog/announce from
MAJOR.MINOR.x
to master.Rationale
Developing on just the
master
branch is the most common and "default" git workflow for contributors, so should not cause any confusion, and reduce the "bureaucracy".Avoiding the two branches removes the synchronization overhead and friction.
The slight overhead of cherry-picking commits helps with ensuring that patch releases are minimal, in that only fixes that really affect some users and need to be in a patch release get picked. This reduces the chances of regressions.
If a release needs time to "bake", it is possible to create the
MAJOR.MINOR.x
branch earlier, when creating the 0 release, without blockingmaster
.pytest already sort-of works this way for major releases, with the
4.6-maintenance
branch.Prior art
The proposed workflow is quite common, but to stay close to home I'll mention two examples:
CPython (ref): All development is done on
master
. Each release (e.g. 3.7, 3.8) gets a branch namesMAJOR.MINOR
. Changes frommaster
can be backported to release branches. There seems to be a botmiss-islington
which can be ordered to automatically create cherry-pick PRs. We can try something like that if needed.Django (ref): All development is done on
master
. Release branches are calledstable/MAJOR.MINOR.x
. Backports for patch releases happen regularly as needed.Pillow (ref) - see comment by hugovk.
Transition plan
5.3.x
from existing5.3.4
tag, release5.3.5
according to new workflow.master
.features
intomaster
.features
.4.6-maintenance
branch to4.6.x
.features
to rebase againstmaster
(one last time ☺).Contingency
If the new workflow turns out to have unfixable issues, than worst case we can just revert back to change.