or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing
xxxxxxxxxx
Fedora Python interpreters maintenance guide
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →By we, we mean Red Hat's python-maint team, which currently handles Python interpreter maintenance in Fedora.
If you're not in the team, you're certainly welcome to look how we do things and follow/improve this guide (or parts of it) if you want to, but your time might be better spent learning other things :)
It's perfectly OK to just file bugs in Bugzilla, submit Pull Requests in Pagure, and talk on the mailing list.
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →What is covered by this guide?
Follow the guide when you need to:
Things not yet covered:
Which dist-git component?
8 module, SCLSCL8 module, SCLThe above Python releases are about CPython. However, there are also other Python implementations in Fedora:
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →pypy
) and- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →pypy3.X
), which are not covered by this guide.Where should I fix a problem?
When applicable, always fix issue in upstream first. Then if possible, wait for the next CPython release that will contain the fix. If you need an upstream fix in an older Python release, help backporting it in upstream if not already done. Note that some Python versions are security only or even EOL, this means backporting in upstream and waiting for the next version is not always an option.
If waiting for the next CPython release is not an option, backport the merged changes to Fedora. Only in extreme/time-critical circumstances can you fix the problem in a downstream patch first and then work to upstream it.
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →The "main" Python
Each Fedora release has only one "main" Python version. This is the version you'll get when you
dnf install python3
or use/usr/bin/python3
in a given Fedora release. When the version is upgraded, this is coordinated through the Fedora change process. See for example: https://fedoraproject.org/wiki/Changes/Python3.9The established procedure is that we only ship stable or release candidate versions of Python in released Fedoras. Therefore we look at the planned release schedule of the Python version and compare with the Fedora release schedule. We check if the first release candidate of that Python version is planned to be shipped well before the Final Freeze of the Fedora release (in case there are slip ups). If so, we upgrade the "main" Python to the latest development release of the Python version (usually a beta or rc).
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →See also an older document: https://fedoraproject.org/wiki/SIGs/Python/UpgradingPython
Since Fedora 33, you can see the definition of the "main" Python version in the
python-rpm-macros
component (%__default_python3_version
). In Fedora 32 and earlier, thepython3
component was the "main" Python.General issues should be fixed in the "main" Python versions for each Fedora, starting from the highest affected Fedora version. Changes are only backported to older Fedoras when backwards compatible.
Changes in the "main" Python can affect critical Fedora components, such as dnf, anaconda, fedpkg stack etc. When creating bodhi updates for stable Fedora releases, set high karma limits (countless +1s without context are very common).
The "next main" Python
The "next main" Python version is a package containing Python 3.N+1 (where 3.N is the "main" Python in rawhide). Such package might not exist yet, it's created during the alpha phase of the next Python release upstream.
Other Python versions
We don't generally actively fix non-packaging problems in the "non-main" Python packages. For upstream supported Python versions, the fix will get to Fedora with the next rebase. For EOL versions upstream, we don't offer additional support, we only provide them as-is.
As an exception, we generally backport fixes for problems that makes the packages fail to build. When not trivial, we skip some tests with a rationale.
For Python 2.7, we might backport security fixes from RHEL (this has not happened yet).
Packaging problems are usually fixed in rawhide, backported to older Fedora releases only if they affect their users (Python developers using multiple Python versions to test their software). We want to fix packaging problems even in older Python versions that are EOL upstream, so that developers can use them for testing.
Where do we update (rebase) to new releases
XXX When to update and where to find out the dates? See also https://github.com/fedora-python/python-release-schedule-ical
Stable versions of Python
Bugfix and security releases
When a new stable version of Python bugfix or security release (e.g. 3.8.1) is released, we update Python X.Y to that version as soon as possible everywhere, starting with rawhide.
Release candidates of bugfix and security releases
When a new release candidate version of Python bugfix or security release (e.g. 3.8.1rc1) is released, we update Python X.Y to that rc version as soon as possible in rawhide. For branched Fedora, we treat it like rawhide until the Beta freeze is approaching. Consider if the final version will be released before the Fedora Beta freeze with time to spare. We don't generally update to bugfix/security release candidates in stable Fedoras.
Updating to release candidate versions allows to discover problems early, but we don't want to ship them to users of stable Fedoras in case we actually discover issues.
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Development versions of Python
For Python versions that have not yet reached 3.XX.0 final, we update to a new alpha, beta, rc version as soon as possible. We start with rawhide and proceed with older Fedora releases.
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Where do we do enhancements
Python enhancements
We do them in upstream. Possibly, we use Fedora to pioneer an upstream change, see for example:
Packaging enhancements
Generally, we only do packaging enhancements in rawhide (possibly also in branched before the Beta Freeze).
Backwards compatible enhancements can optionally be backported to older Fedora, usually when deemed useful or when easier to backport together with a bugfix or a rebase.
Backwards incompatible enhancements (unusual but possible) are not backported.
Generally we start with the highest relevant Python version and optionally we proceed to lower versions later. It's also possible to start with the "main" Python (if not yet the highest), however, it's not advised as one may forget to "backport" the enhancement to the highest Python version.
Patches
Maintenance cost of every downstream-only patch is high as we have to keep rebasing and maitaining it with every new Python version. We try to avoid such patches if at all possible and fix the issue instead in upstream. However, we use patches to:
We do not use patches for Fedora/EL-only changes if there is no plan to eventually bring those to upstream. Every change should either be temporary or a (long term) plan must exist to include it upstream.
XXX (Security) fixes that are only relevant to an EOL version of Python are always Fedora/EL-only – an exception?
Tracking patches
We keep track of our patches in https://fedoraproject.org/wiki/SIGs/Python/PythonPatches. The patch numbers are shared between Python versions packaged in Fedora, RHEL, EPEL, SCLs, modules etc. A patch with a common number doesn't need to be bit-by-bit identical between different Python components/branches, but it must have the same purpose.
We keep our Fedora patches in https://github.com/fedora-python/cpython – the main purpose is to make creating and rebasing patches easier.
In the repo there are branches named
fedora-X.Y
, where X.Y is the Python version (e.g.fedora-3.8
). Such branch is forked from the latest tag of that Python minor version (e.g.v3.8.3
) from CPython upstream git repo: https://github.com/python/cpython. On top of that tag we put the current patches for Fedora. We put the patch number at the start of the commit message (e.g.00666: The patch of the beast
).When a new Python version is released, the patches are rebased via git on top of the new latest tag for that upstream release, tagged with a new
fedora-
tag and force pushed to thefedora-X.YY
branch for later use. Thefedora-X.YY.ZZ-R
tags serve as history references, so we can see the content otherwise erased by the force push.Patches can change during one upstream release, therefore the git tag includes the Fedora release number (without the dist tag), e.g.
fedora-3.8.3-1
for python3.8-3.8.3-1.fc33.In theory, patches can differ between Fedora releases. We generally assume the git repo represents rawhide. If needed, new branches or tags will be created, named according to the Fedora version they are for (there is no scheme for this, it has never been needed so far).
See existing tags for inspiration, e.g.:
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Converting git commits to dist git patch files
To import patches from a GitHub branch to dist-git (and the spec file), we use a script called importpatches.
See its README for installation and usage.
The script automates a previously manual process. Always check its results, and if necessary, amend them or (better) improve the script.
Assuming you have
importpatches
inPATH
and have it configured, then the process is roughly:fedora-X.Y-R
tag in your local CPython clone (see above, or Creating new patches below).Notes on the manual process (you should not need to know this)
We use
git format-patch
to create patch files:(The option
--no-numbered
relates to the subject lines inside the patches. There's currently no known way to generate unnumbered filenames.)Unfortunately, the filenames in dist git do not correspond to the filenames generated by
git format-patch
. When moving the patches to dist git, one needs to get creative (this is the best place for improvements of the process), for example (from the dist-git folder):Don't forget to manually check for obsoleted patches,
git rm
them from dist-git and to copy andgit add
any new patches. You will also need to add and/or remove patches into/from the spec file.- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →bundled()
provides in spec need to be updated together with the patch when the versions are bumped by upstream.- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →The Python 2 patches include the name of the patch as the commit message title, and the comment that goes into the spec file as the body. They can be made into patches with:
(This works for most of them. If you're touching the problematic one, fix it.)
Creating new patches
fedora-X.YY
, add the commit either by one of the following:git cherry-pick
/git revert
an upstream commitgit cherry-pick
a downstream commit from a differentfedora-X.YY
branchgit commit --amend
on the cherry-picked upstream commit).fedora-X.YY
branch.If the patch number is lower than the highest existing patch number currently in
fedora-X.YY
, keep your commit on top for easier Pull Request review. It will be reordered once merged.You can use your open GitHub pull request to create patch files for new a dist-git pull request on src.fedoraproject.org, or you can first wait for the GitHub pull request to be reviewed and merged.
After the pull request is merged, the branch must be rebased to properly reorder patches if necessary, and new tags must be created according to the related dist git change. Coordinate with the reviewer on who does this.
Alternatively, push directly to
fedora-X.YY
but be prepared to rebase if there is feedback.Modifying existing patches
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Follow the creating patches section. Send pull request with a fixup commit on top of the
fedora-X.YY
branch. When a new commit message is required, include it in the pull request description and/or discussion and make sure it is updated after the PR is merged, and the branch rebased and fixup commit squashed. Example:Rationale: When you modify an existing commit, the git history of every commit afterwards is changed. That is very unpleasant to work with when reviewing a Pull Request, for example because it's not easy to tell if the commits after the changed one were changed as well or just rebased.
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Removing no longer needed patches
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Follow the creating patches section. Send pull request with a revert commit. It will be rebased after the PR is merged.
For a dist-git pull request, feel free to just remove the patch without regenerating the others (by
git format-patch
). They will be regenerated with the next change. However, don't forget to also do the change on GitHub, so the commit/patch is not reintroduced later.How to backport changes
If you want to backport a change from one Python/Fedora version to another, it's tedious to manually have to edit the files over and over. But you can use git to make it easier and to preserve commit authorship, messages etc.
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Within the same component: Prefer FF merge, cherry-pick otherwise
In this section, we'll use
rawhide
as the reference to the branch you take the backport from andfcXX
as a reference to the branch you want the backport to land into. However, this guide also applies to other kinds of backports (for example fromfc34
tofc33
as well).When you want to backport a commit within the same component, always consider fast-forward (FF) merging if possible. Ask yourself the following questions:
fcXX
branch an ancestor of the HEAD of therawhide
branch?If the answer to all of these questions is yes, use a fast-forward merge.
If the answer to any of these questions is no, use a cherry-pick instead.
Note there is no harm in backporting moot commits (such as backporting "Fedora 35 mass rebuild" to Fedora 34) – trying to skip such commits only makes things harder for both you and the person who will backport the next thing.
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →rawhide
intof32
and you need to use cherry-pick, you don't necessarily need to cherry-pick tof31
separately, but you can FF mergef32
intof31
after the merge. Often, you can even open multiple pull requests from a single feature branch to more Fedora branches – when possible, this is the preferred approach because we can see multiple CI results before we decide whether to merge as is.How to cherry pick commits from different dist-git components
If you need to cherry-pick a commit from one component to another, a trivial git merge or cherry-pick does not work. Different components have different git repos and also different spec filenames, which complicates cherry-picking.
The tested way of cherry-picking commits from one component to another is:
git format-patch
to create patch file(s) of the commits you want to backport.git am
(possibly with--reject
) to apply the commits into the target dist-git repo.Changelog entries and release bumps are often causing conflicts that need to be solved manually.
When cherry-picking commits across components that represent the same Python version (e.g. from
python3.6
topython36
), the changes in patch files will likely apply cleanly. However when backporting changes from one Python version to another (e.g. frompython3.9
topython3.8
), it may be easier to avoid manually resolve cherry-pick conflicts in the dist-git Python patch files (which can lead to serious brain damage, because it's applying patches onto patches). Use the GitHub fork to re-generate them instead. (XXX link to the above guide).- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →fedpkg new-sources
), because the lookaside cache is namespaced by component name.Ferrypick
There is a alpha-quality tool that can help you do steps 1, 2 & 3 from the previous section to cherry-pick commits from a different dist-git component. You can use ferrypick to cherry-pick changes from the same component as well if you prefer.
https://github.com/fedora-python/ferrypick
Use it as this: XXX example from readme.
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →