Skip to content

Commit fd4aafc

Browse files
authored
Merge pull request #524: Bump minimum Python version to 3.10
2 parents a978a75 + bd7fb42 commit fd4aafc

21 files changed

Lines changed: 53 additions & 105 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ jobs:
3535
- macos-latest
3636
- windows-latest
3737
python:
38-
- '3.8'
39-
- '3.9'
4038
- '3.10'
4139
- '3.11'
4240
- '3.12'
@@ -253,8 +251,6 @@ jobs:
253251
- macos-latest
254252
- windows-latest
255253
python:
256-
- '3.8'
257-
- '3.9'
258254
- '3.10'
259255
- '3.11'
260256
- '3.12'
@@ -274,12 +270,6 @@ jobs:
274270
with:
275271
python-version: ${{ matrix.python }}
276272

277-
# Skip ambient runtime testing on 3.8, as it forces an old version of
278-
# Augur (26.2.0, last with 3.8 support) that is not compatible with
279-
# Nextstrain CLI >10.3.0 installed in the same Python environment due
280-
# to conflicting jsonschema dependencies.
281-
ambient: ${{ matrix.python != '3.8' }}
282-
283273
- uses: actions/download-artifact@v8
284274
with:
285275
name: dist
@@ -289,12 +279,6 @@ jobs:
289279
run: python3 -m pip install --upgrade dist/nextstrain_cli-*-py3-none-any.whl
290280

291281
- uses: ./src/.github/actions/run-integration-tests
292-
with:
293-
# Skip ambient runtime testing on 3.8, as it forces an old version of
294-
# Augur (26.2.0, last with 3.8 support) that is not compatible with
295-
# Nextstrain CLI >10.3.0 installed in the same Python environment due
296-
# to conflicting jsonschema dependencies.
297-
ambient: ${{ matrix.python != '3.8' }}
298282

299283
test-standalone:
300284
needs: build-standalone
@@ -336,7 +320,7 @@ jobs:
336320

337321
- uses: ./src/.github/actions/setup-integration-tests
338322
with:
339-
python-version: '3.9'
323+
python-version: '3.10'
340324

341325
# Download and extract the installation archive.
342326
- uses: actions/download-artifact@v8

CHANGES.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ development source code and as such may not be routinely kept up to date.
1313

1414
# __NEXT__
1515

16+
This release drops support for Python versions 3.8 and 3.9.
17+
18+
Note that this Python version support only matters if you're installing
19+
Nextstrain CLI from PyPI or Bioconda
20+
([c.f.](https://docs.nextstrain.org/projects/cli/en/__NEXT__/installation/)). It
21+
does not apply if you're installing Nextstrain CLI using the standalone
22+
installation method we recommend in the [Nextstrain installation
23+
documentation](https://docs.nextstrain.org/page/install.html). In that case, a
24+
supported Python version is always bundled with `nextstrain`.
25+
1626
## Improvements
1727

1828
* `nextstrain build` now runs Snakemake with the `--rerun-incomplete` option,

doc/changes.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ development source code and as such may not be routinely kept up to date.
1616
(v-next)=
1717
## __NEXT__
1818

19+
This release drops support for Python versions 3.8 and 3.9.
20+
21+
Note that this Python version support only matters if you're installing
22+
Nextstrain CLI from PyPI or Bioconda
23+
([c.f.](https://docs.nextstrain.org/projects/cli/en/__NEXT__/installation/)). It
24+
does not apply if you're installing Nextstrain CLI using the standalone
25+
installation method we recommend in the [Nextstrain installation
26+
documentation](https://docs.nextstrain.org/page/install.html). In that case, a
27+
supported Python version is always bundled with `nextstrain`.
28+
1929
(v-next-improvements)=
2030
### Improvements
2131

doc/development.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Development of `nextstrain-cli` happens at <https://github.com/nextstrain/cli>.
44

5-
We currently target compatibility with Python 3.8 and higher.
5+
We currently target compatibility with Python 3.10 and higher.
66

77
Versions for this project follow the [Semantic Versioning rules][].
88

@@ -176,9 +176,6 @@ During development you can run static type checks using [pyright][]:
176176

177177
There are also many [editor integrations for Pyright][].
178178

179-
The [`typing_extensions`][] module should be used for features not yet available
180-
in the the standard `typings` module of supported Python versions.
181-
182179
We also use [Flake8][] for some static analysis checks focusing on runtime
183180
safety and correctness. You can run them like this:
184181

@@ -238,7 +235,6 @@ environmental factors.
238235
[type annotations]: https://www.python.org/dev/peps/pep-0484/
239236
[pyright]: https://github.com/microsoft/pyright
240237
[editor integrations for Pyright]: https://microsoft.github.io/pyright/#/installation
241-
[`typing_extensions`]: https://pypi.org/project/typing-extensions
242238
[Flake8]: https://flake8.pycqa.org
243239
[post-release version]: https://peps.python.org/pep-0440/#post-releases
244240
[autobump PR]: https://github.com/bioconda/bioconda-recipes/pulls?q=is%3Apr+author%3Abiocondabot+nextstrain-cli

doc/installation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ From PyPI
4242
---------
4343

4444
.. note::
45-
Nextstrain CLI is written in Python 3 and requires at least Python 3.8. There
45+
Nextstrain CLI is written in Python 3 and requires at least Python 3.10. There
4646
are many ways to install Python 3 on Windows, macOS, or Linux, including the
4747
`official packages`_, `Homebrew`_ for macOS, and the `Anaconda Distribution`_.
4848
Details are beyond the scope of this guide, but make sure you install Python
49-
3.8 or higher. You may already have Python 3 installed, especially if you're on
49+
3.10 or higher. You may already have Python 3 installed, especially if you're on
5050
Linux. Check by running ``python --version`` or ``python3 --version``.
5151

5252
.. _official packages: https://www.python.org/downloads/

nextstrain/cli/argparse.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Custom helpers for extending the behaviour of argparse standard library.
33
"""
44
import os
5-
import sys
65
from argparse import Action, ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError, SUPPRESS, _SubParsersAction # pyright: ignore[reportPrivateUsage]
76
from itertools import chain, takewhile
87
from pathlib import Path
@@ -15,10 +14,7 @@
1514
from .util import format_usage, runner_module
1615

1716

18-
# The standard argument group title for non-positional arguments. See
19-
# <https://github.com/python/cpython/pull/23858> and
20-
# <https://bugs.python.org/issue9694>.
21-
OPTIONS_TITLE = "options" if sys.version_info >= (3, 10) else "optional arguments"
17+
OPTIONS_TITLE = "options"
2218

2319

2420
# Include this in an argument help string to suppress the automatic appending

nextstrain/cli/authn/session.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,8 @@
22
Authentication sessions.
33
"""
44
import boto3
5-
import warnings
6-
7-
# Ignore noisy warning from cryptography 47.0.0 about deprecated support for Python 3.8
8-
with warnings.catch_warnings():
9-
warnings.filterwarnings(
10-
"ignore",
11-
message = "Python 3\\.8 is no longer supported by the Python core team and support for it is deprecated",
12-
category = UserWarning
13-
)
14-
import jwt
15-
import jwt.exceptions
16-
5+
import jwt
6+
import jwt.exceptions
177
import secrets
188

199
from base64 import b64encode

nextstrain/cli/command/shell.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from ..argparse import add_extended_help_flags
1111
from ..paths import SHELL_HISTORY
1212
from ..runner import docker, conda, singularity
13-
from ..util import colored, remove_prefix, runner_name
13+
from ..util import colored, runner_name
1414
from ..volume import NamedVolume
1515
from .build import assert_overlay_volumes_support, pathogen_volumes
1616

@@ -113,7 +113,7 @@ def fg(color: str) -> str: return r'\[\e[38;2;{};{};{}m\]'.format(*rgb(color))
113113
def bg(color: str) -> str: return r'\[\e[48;2;{};{};{}m\]'.format(*rgb(color))
114114

115115
def rgb(color: str) -> Tuple[int, int, int]:
116-
color = remove_prefix("#", color)
116+
color = color.removeprefix("#")
117117
r,g,b = (int(c, 16) for c in (color[0:2], color[2:4], color[4:6]))
118118
return r,g,b
119119

nextstrain/cli/command/view.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
from ..argparse import add_extended_help_flags, SUPPRESS, SKIP_AUTO_DEFAULT_IN_HELP
6060
from ..browser import BROWSER, open_browser as __open_browser
6161
from ..runner import docker, ambient, conda, singularity
62-
from ..util import colored, remove_suffix, warn
62+
from ..util import colored, warn
6363
from ..volume import NamedVolume
6464

6565

@@ -324,7 +324,7 @@ def sidecar_file(path):
324324

325325
# v1: All *_tree.json files with corresponding *_meta.json files.
326326
def meta_exists(path):
327-
return path.with_name(remove_suffix("_tree.json", path.name) + "_meta.json").exists()
327+
return path.with_name(path.name.removesuffix("_tree.json") + "_meta.json").exists()
328328

329329
datasets_v1 = set(
330330
re.sub(r"_tree$", "", path.stem).replace("_", "/")

nextstrain/cli/console.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from contextlib import contextmanager, ExitStack, redirect_stdout, redirect_stderr
77
from functools import wraps
88
from typing import Callable, TextIO
9-
from wrapt import BaseObjectProxy # pyright: ignore[reportAttributeAccessIssue]
9+
from wrapt import BaseObjectProxy
1010

1111

1212
def auto_dry_run_indicator(getter: Callable[..., bool] = lambda opts, *args, **kwargs: opts.dry_run):
@@ -83,7 +83,7 @@ def dry_run_indicator(dry_run: bool = False):
8383
yield dry_run
8484

8585

86-
class LinePrefixer(BaseObjectProxy): # pyright: ignore[reportUntypedBaseClass]
86+
class LinePrefixer(BaseObjectProxy):
8787
"""
8888
Add *prefix* to every line written to *file*.
8989
@@ -147,3 +147,8 @@ def write(self, s) -> int:
147147
s_ += re.sub(r'(?<=\n)(?!\Z)', self.__prefix, s)
148148

149149
return self.__wrapped__.write(s_)
150+
151+
# BaseObjectProxy forwards this at runtime, but Pyright is not aware of that
152+
# when checking redirect_stdout()/redirect_stderr().
153+
def flush(self) -> None:
154+
self.__wrapped__.flush()

0 commit comments

Comments
 (0)