diff options
-rw-r--r-- | docs/python-support.md | 104 |
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 | ||
3 | With Python 2.7 officially going EOL on [01 Jan 2020](https://pythonclock.org/), | 3 | This documents the current supported Python versions, and tries to provide |
4 | we need a support plan for the repo project itself. | 4 | guidance for when we decide to drop support for older versions. |
5 | Inevitably, there will be a long tail of users who still want to use Python 2 on | ||
6 | their 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 | ||
16 | We provide a branch for Python 2 users that is feature-frozen. | 14 | Projects that use [repo hooks] run on independent schedules. |
17 | Bugfixes may be added on a best-effort basis or from the community, but largely | 15 | Since it's not possible to detect what version of Python the hooks were written |
18 | no new features will be added, nor is support guaranteed. | 16 | or tested against, we always import & exec them with the active Python version. |
19 | 17 | ||
20 | Users can select this during `repo init` time via the [repo launcher]. | 18 | If the user's Python is too new for the [repo hooks], then it is up to the hooks |
21 | Otherwise the default branches (e.g. stable & main) will be used which will | 19 | maintainer to update. |
22 | require Python 3. | ||
23 | 20 | ||
24 | This means the [repo launcher] needs to support both Python 2 & Python 3, but | 21 | ## Repo launcher |
25 | since it doesn't import any other repo code, this shouldn't be too problematic. | ||
26 | 22 | ||
27 | The main branch will require Python 3.6 at a minimum. | 23 | The [repo launcher] is an independent script that can support older versions of |
28 | If the system has an older version of Python 3, then users will have to select | 24 | Python without holding back the rest of the codebase. |
29 | the legacy Python 2 branch instead. | 25 | If it detects the current version of Python is too old, it will try to reexec |
26 | via a newer version of Python via standard `pythonX.Y` interpreter names. | ||
30 | 27 | ||
31 | ### repo hooks | 28 | However, this is provided as a nicety when it is not onerous, and there is no |
29 | official support for older versions of Python than the rest of the codebase. | ||
32 | 30 | ||
33 | Projects that use [repo hooks] run on independent schedules. | 31 | If your default python interpreters are too old to run the launcher even though |
34 | They might migrate to Python 3 earlier or later than us. | 32 | you have newer versions installed, your choices are: |
35 | To support them, we'll probe the shebang of the hook script and if we find an | 33 | |
36 | interpreter in there that indicates a different version than repo is currently | 34 | * Modify the [repo launcher]'s shebang to suite your environment. |
37 | running 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 | |||
42 | So 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 | ||
44 | that are critical to us. | ||
45 | |||
46 | That said, let's assume we need functionality that only exists in Python 3.7. | ||
47 | How do we decide when it's acceptable to drop Python 3.6? | ||
48 | |||
49 | 1. 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. | ||
56 | 1. 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. | ||
66 | 1. 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 | |||
77 | Fetch 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 | ||
39 | For example, a hook with a header like `#!/usr/bin/python2` will have repo | 84 | Then initialize an old version of repo: |
40 | execute `/usr/bin/python2` to execute the hook code specifically if repo is | ||
41 | currently running Python 3. | ||
42 | 85 | ||
43 | For 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 |