Skip to content

Commit

Permalink
only support python 3.10+
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile-sentry committed Jan 31, 2024
1 parent 0ca956a commit 7f21b65
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 29 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ jobs:
- uses: actions/checkout@v3
- run: python3 -u docker/install-pythons --dest pythons
- run: |
echo "$PWD/pythons/cp38-cp38/bin" >> "$GITHUB_PATH"
echo "$PWD/pythons/cp39-cp39/bin" >> "$GITHUB_PATH"
echo "$PWD/pythons/cp310-cp310/bin" >> "$GITHUB_PATH"
echo "$PWD/pythons/cp311-cp311/bin" >> "$GITHUB_PATH"
echo "$PWD/venv/bin" >> "$GITHUB_PATH"
Expand Down Expand Up @@ -65,7 +63,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: '3.10'
- run: pip install -r docker/requirements.txt
- uses: actions/download-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: '3.10'
- uses: pre-commit/action@v3.0.0
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: '3.10'
- run: pip install tox
- run: tox -e py
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ repos:
rev: v3.12.0
hooks:
- id: reorder-python-imports
args: [--py39-plus, --add-import, 'from __future__ import annotations']
args: [--py310-plus, --add-import, 'from __future__ import annotations']
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py39-plus]
args: [--py310-plus]
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
Expand Down
4 changes: 2 additions & 2 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
import urllib.parse
import urllib.request
import zipfile
from collections.abc import Callable
from collections.abc import Generator
from collections.abc import Mapping
from collections.abc import MutableMapping
from typing import Callable
from typing import ContextManager
from typing import NamedTuple

Expand All @@ -32,7 +32,7 @@
from packaging.utils import parse_wheel_filename
from packaging.version import Version

PYTHONS = ((3, 9), (3, 10), (3, 11))
PYTHONS = ((3, 10), (3, 11))

BINARY_EXTS = frozenset(
(".c", ".cc", ".cpp", ".cxx", ".pxd", ".pxi", ".pyx", ".go", ".rs")
Expand Down
6 changes: 3 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9.16-slim-buster
FROM python:3.10.12-slim-buster
RUN : \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install \
Expand Down Expand Up @@ -45,7 +45,7 @@ RUN : \

ENV \
BUILD_IN_CONTAINER=1 \
PATH=/venv/bin:/opt/python/cp38-cp38/bin:/opt/python/cp39-cp39/bin:/opt/python/cp310-cp310/bin:/opt/python/cp311-cp311/bin:$PATH \
PATH=/venv/bin:/opt/python/cp310-cp310/bin:/opt/python/cp311-cp311/bin:$PATH \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
PIP_NO_WARN_ABOUT_ROOT_USER=0
Expand All @@ -55,7 +55,7 @@ RUN /tmp/install-pythons

COPY requirements.txt /tmp/requirements.txt
RUN : \
&& /opt/python/cp39-cp39/bin/python3.9 -m venv /venv \
&& /opt/python/cp310-cp310/bin/python3.10 -m venv /venv \
&& /venv/bin/pip install --no-cache-dir -r /tmp/requirements.txt

ENTRYPOINT ["dumb-init", "--"]
10 changes: 3 additions & 7 deletions docker/install-pythons
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3.9
#!/usr/bin/env python3.10
from __future__ import annotations

import argparse
Expand All @@ -11,12 +11,8 @@ import subprocess
import sys
import tempfile

# gsutil cp gs://sentry-dev-infra-assets/prebuilt-pythons/python-{3.9.15+0,3.10.8+0,3.11.0+0}.sha256sums -
# gsutil cp gs://sentry-dev-infra-assets/prebuilt-pythons/python-{3.10.8+0,3.11.0+0}.sha256sums -
CHECKSUMS = """\
24e0e6a5f0441ec6a037d55930b201c46eefb4559945ded8f670211680c03fe9 python-3.9.16+0-macosx_12_0_arm64.tgz
e08d2874414df8dd1a44a507339884266de5193dd9e637375c7c16ddfc3296e7 python-3.9.16+0-macosx_12_0_x86_64.tgz
acfa20f500332e6f3c4d900db611ba069b52965973c77b03a8af5c774cf51730 python-3.9.16+0-manylinux_2_28_aarch64.tgz
0a50b871ab5ff2e945a461f00589089c944ffee7f049c8c06be7a15e86745fc1 python-3.9.16+0-manylinux_2_28_x86_64.tgz
503f2b82d52647c322af626052995cded0a23899cca94600aa80eb193e4b926a python-3.10.9+0-macosx_12_0_arm64.tgz
30c919dd9be7767488d7953946c6dd39d058571b85c280c7e33df2fb771149cc python-3.10.9+0-macosx_12_0_x86_64.tgz
2ca822fa3c09e515dcbdcf7c8f4b091cc47b5c935b44083f69fd572580f9ceca python-3.10.9+0-manylinux_2_28_aarch64.tgz
Expand All @@ -26,7 +22,7 @@ ffdf9ade5d7023921a175294248003ac95f4c4ee6babb5c3d7f9f7650146a96e python-3.11.1+
42fba60f08fffc41e2a2eed0763eb8df57c7e79a56809d883c73efdc3dbba0e2 python-3.11.1+0-manylinux_2_28_aarch64.tgz
be999ab895e67ebf7b199108090c0c09a0fad6cd9f1034dd9bd15ba61f8ef05f python-3.11.1+0-manylinux_2_28_x86_64.tgz
"""
VERSIONS = ("3.9.16+0", "3.10.9+0", "3.11.1+0")
VERSIONS = ("3.10.9+0", "3.11.1+0")
PLAT_TAG = {"linux": "manylinux", "darwin": "macosx"}
PLAT_RE = re.compile(f"{PLAT_TAG[sys.platform]}_.+{platform.machine()}$")

Expand Down
2 changes: 1 addition & 1 deletion docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.9
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --allow-unsafe --no-annotate
Expand Down
14 changes: 7 additions & 7 deletions tests/validate_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,30 @@ def test_pythons_to_check_no_pythons_raises_error():

def test_pythons_to_check_py2_ignored():
ret = validate._pythons_to_check(parse_tag("py2.py3-none-any"))
assert ret == ("python3.10", "python3.11", "python3.9")
assert ret == ("python3.10", "python3.11")


def test_pythons_to_check_py3_gives_all():
ret = validate._pythons_to_check(parse_tag("py3-none-any"))
assert ret == ("python3.10", "python3.11", "python3.9")
assert ret == ("python3.10", "python3.11")


def test_pythons_to_check_abi3():
tag = "cp37-abi3-manylinux1_x86_64"
ret = validate._pythons_to_check(parse_tag(tag))
assert ret == ("python3.10", "python3.11", "python3.9")
assert ret == ("python3.10", "python3.11")


def test_pythons_to_check_minimum_abi3():
tag = "cp39-abi3-manylinux1_x86_64"
tag = "cp311-abi3-manylinux1_x86_64"
ret = validate._pythons_to_check(parse_tag(tag))
assert ret == ("python3.10", "python3.11", "python3.9")
assert ret == ("python3.11",)


def test_pythons_to_check_specific_cpython_tag():
tag = "cp39-cp39-manylinux1_aarch64.whl"
tag = "cp311-cp311-manylinux1_aarch64.whl"
ret = validate._pythons_to_check(parse_tag(tag))
assert ret == ("python3.9",)
assert ret == ("python3.11",)


def test_top_imports_record(tmp_path):
Expand Down
2 changes: 1 addition & 1 deletion validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from packaging.utils import parse_wheel_filename
from packaging.version import Version

PYTHONS = ((3, 9), (3, 10), (3, 11))
PYTHONS = ((3, 10), (3, 11))
DIST_INFO_RE = re.compile(r"^[^/]+.dist-info/[^/]+$")


Expand Down

0 comments on commit 7f21b65

Please sign in to comment.