summaryrefslogtreecommitdiffstats
path: root/docs/python-support.md
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2023-10-14 02:10:39 +0545
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-10-14 06:22:53 +0000
commit1544afe460b6d206d5494d1970db33e7f8cdfab0 (patch)
treea6a8a8bc2ed756880ebbf60f274bbbde941646bc /docs/python-support.md
parent3b8f9535c772178d8adeb1e0e4fc5916e311490a (diff)
downloadgit-repo-1544afe460b6d206d5494d1970db33e7f8cdfab0.tar.gz
python-support: update with current status & guidelines
This doc was written back in 2019 when we were planning on the Python 3 migration. It isn't relevant anymore, and people are reading it thinking we still support Python 2. Rewrite it to match current requirements and to make it clear there is no support for older versions. Bug: 302871152 Change-Id: I2acf3aee1816a03ee0a70774db8bf4a23713a03f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/389455 Commit-Queue: Mike Frysinger <vapier@google.com> Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com> Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'docs/python-support.md')
-rw-r--r--docs/python-support.md104
1 files changed, 75 insertions, 29 deletions
diff --git a/docs/python-support.md b/docs/python-support.md
index 3eaaba33..e4ee96c4 100644
--- a/docs/python-support.md
+++ b/docs/python-support.md
@@ -1,47 +1,93 @@
1# Supported Python Versions 1# Supported Python Versions
2 2
3With Python 2.7 officially going EOL on [01 Jan 2020](https://pythonclock.org/), 3This documents the current supported Python versions, and tries to provide
4we need a support plan for the repo project itself. 4guidance for when we decide to drop support for older versions.
5Inevitably, there will be a long tail of users who still want to use Python 2 on
6their old LTS/corp systems and have little power to change the system.
7 5
8## Summary 6## Summary
9 7
10* Python 3.6 (released Dec 2016) is required by default starting with repo-2.x. 8* Python 3.6 (released Dec 2016) is required starting with repo-2.0.
11* Older versions of Python (e.g. v2.7) may use the legacy feature-frozen branch 9* Older versions of Python (e.g. v2.7) may use old releases via the repo-1.x
12 based on repo-1.x. 10 branch, but no support is provided.
13 11
14## Overview 12## repo hooks
15 13
16We provide a branch for Python 2 users that is feature-frozen. 14Projects that use [repo hooks] run on independent schedules.
17Bugfixes may be added on a best-effort basis or from the community, but largely 15Since it's not possible to detect what version of Python the hooks were written
18no new features will be added, nor is support guaranteed. 16or tested against, we always import & exec them with the active Python version.
19 17
20Users can select this during `repo init` time via the [repo launcher]. 18If the user's Python is too new for the [repo hooks], then it is up to the hooks
21Otherwise the default branches (e.g. stable & main) will be used which will 19maintainer to update.
22require Python 3.
23 20
24This means the [repo launcher] needs to support both Python 2 & Python 3, but 21## Repo launcher
25since it doesn't import any other repo code, this shouldn't be too problematic.
26 22
27The main branch will require Python 3.6 at a minimum. 23The [repo launcher] is an independent script that can support older versions of
28If the system has an older version of Python 3, then users will have to select 24Python without holding back the rest of the codebase.
29the legacy Python 2 branch instead. 25If it detects the current version of Python is too old, it will try to reexec
26via a newer version of Python via standard `pythonX.Y` interpreter names.
30 27
31### repo hooks 28However, this is provided as a nicety when it is not onerous, and there is no
29official support for older versions of Python than the rest of the codebase.
32 30
33Projects that use [repo hooks] run on independent schedules. 31If your default python interpreters are too old to run the launcher even though
34They might migrate to Python 3 earlier or later than us. 32you have newer versions installed, your choices are:
35To support them, we'll probe the shebang of the hook script and if we find an 33
36interpreter in there that indicates a different version than repo is currently 34* Modify the [repo launcher]'s shebang to suite your environment.
37running under, we'll attempt to reexec ourselves under that. 35* Download an older version of the [repo launcher] and don't upgrade it.
36 Be aware that there is no guarantee old repo launchers are WILL work with
37 current versions of repo. Bug reports using old launchers will not be
38 accepted.
39
40## When to drop support
41
42So far, Python 3.6 has provided most of the interesting features that we want
43(e.g. typing & f-strings), and there haven't been features in newer versions
44that are critical to us.
45
46That said, let's assume we need functionality that only exists in Python 3.7.
47How do we decide when it's acceptable to drop Python 3.6?
48
491. Review the [Project References](./release-process.md#project-references) to
50 see what major distros are using the previous version of Python, and when
51 they go EOL. Generally we care about Ubuntu LTS & current/previous Debian
52 stable versions.
53 * If they're all EOL already, then go for it, drop support.
54 * If they aren't EOL, start a thread on [repo-discuss] to see how the user
55 base feels about the proposal.
561. Update the "soft" versions in the codebase. This will start warning users
57 that the older version is deprecated.
58 * Update [repo](/repo) if the launcher needs updating.
59 This only helps with people who download newer launchers.
60 * Update [main.py](/main.py) for the main codebase.
61 This warns for everyone regardless of [repo launcher] version.
62 * Update [requirements.json](/requirements.json).
63 This allows [repo launcher] to display warnings/errors without having
64 to execute the new codebase. This helps in case of syntax or module
65 changes where older versions won't even be able to import the new code.
661. After some grace period (ideally at least 2 quarters after the first release
67 with the updated soft requirements), update the "hard" versions, and then
68 start using the new functionality.
69
70## Python 2.7 & 3.0-3.5
71
72> **There is no support for these versions.**
73> **Do not file bugs if you are using old Python versions.**
74> **Any such reports will be marked invalid and ignored.**
75> **Upgrade your distro and/or runtime instead.**
76
77Fetch an old version of the [repo launcher]:
78
79```sh
80$ curl https://storage.googleapis.com/git-repo-downloads/repo-2.32 > ~/.bin/repo-2.32
81$ chmod a+rx ~/.bin/repo-2.32
82```
38 83
39For example, a hook with a header like `#!/usr/bin/python2` will have repo 84Then initialize an old version of repo:
40execute `/usr/bin/python2` to execute the hook code specifically if repo is
41currently running Python 3.
42 85
43For more details, consult the [repo hooks] documentation. 86```sh
87$ repo-2.32 init --repo-rev=repo-1 ...
88```
44 89
45 90
91[repo-discuss]: https://groups.google.com/forum/#!forum/repo-discuss
46[repo hooks]: ./repo-hooks.md 92[repo hooks]: ./repo-hooks.md
47[repo launcher]: ../repo 93[repo launcher]: ../repo