Skip to content

Commit

Permalink
Drop support for EOL Python 3.7 (#206)
Browse files Browse the repository at this point in the history
* Add support for Python 3.12, drop EOL 3.7

* Allow testing feature branches

* Simplify caching

---------

Co-authored-by: Bartosz Sokorski <[email protected]>
  • Loading branch information
hugovk and Secrus authored Dec 21, 2023
1 parent b23f89b commit c98aa54
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 35 deletions.
34 changes: 11 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: CI
on:
pull_request:
push:
branches: [main]

on: [push, pull_request, workflow_dispatch]

env:
FORCE_COLOR: 1

concurrency:
# prettier-ignore
Expand All @@ -20,34 +21,21 @@ jobs:
strategy:
matrix:
os: [Windows, Ubuntu, MacOS]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
include:
# Only run PyPy jobs, on Ubuntu.
- os: Ubuntu
python-version: pypy-3.7
python-version: pypy3.10

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# Get Python to test against
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

# Setup pip's cache
- name: Save date (for cache)
id: date
run: echo "::set-output name=date::$(date +%F)"
- name: Save pip cache dir
id: pip-cache-dir
run: echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache-dir.outputs.dir }}
key: pip-v1-${{ runner.os }}-${{ steps.date.outputs.date }}
restore-keys: pip-v1-${{ runner.os }}
cache: pip

- run: pip install nox

Expand All @@ -57,7 +45,7 @@ jobs:
-s test-${{ matrix.python-version }}
doctest-${{ matrix.python-version }}
--error-on-missing-interpreters
if: matrix.python-version != 'pypy-3.7'
if: matrix.python-version != 'pypy3.10'
- run: nox --error-on-missing-interpreters -s test-pypy3 doctest-pypy3
if: matrix.python-version == 'pypy-3.7'
if: matrix.python-version == 'pypy3.10'
4 changes: 2 additions & 2 deletions docs/development/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The repository layout is pretty standard for a modern pure-Python project.

## Initial Setup

To work on this project, you need to have git 2.17+ and Python 3.7+.
To work on this project, you need to have git 2.17+ and Python 3.8+.

- Clone this project using git:

Expand Down Expand Up @@ -73,7 +73,7 @@ nox -s test-3.9
```

Run the tests against Python 3.9. It is also possible to specify other supported
Python versions (like `3.7` or `pypy3`).
Python versions (like `3.12` or `pypy3`).

### Documentation

Expand Down
12 changes: 6 additions & 6 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
nox.options.reuse_existing_virtualenvs = True


@nox.session(python="3.11")
@nox.session(python="3.12")
def lint(session):
session.install("pre-commit")

Expand All @@ -22,7 +22,7 @@ def lint(session):
session.run("pre-commit", "run", "--all-files", *args)


@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "pypy3"])
@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "pypy3"])
def test(session):
session.install(".")
session.install("-r", "tests/requirements.txt")
Expand All @@ -42,15 +42,15 @@ def test(session):
)


@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "pypy3"])
@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "pypy3"])
def doctest(session):
session.install(".")
session.install("-r", "docs/requirements.txt")

session.run("sphinx-build", "-b", "doctest", "docs/", "build/doctest")


@nox.session(python="3.11", name="update-launchers")
@nox.session(python="3.12", name="update-launchers")
def update_launchers(session):
session.install("httpx")
session.run("python", "tools/update_launchers.py")
Expand All @@ -59,7 +59,7 @@ def update_launchers(session):
#
# Documentation
#
@nox.session(python="3.11")
@nox.session(python="3.12")
def docs(session):
session.install(".")
session.install("-r", "docs/requirements.txt")
Expand All @@ -68,7 +68,7 @@ def docs(session):
session.run("sphinx-build", "-W", "-b", "html", "docs/", "build/docs")


@nox.session(name="docs-live", python="3.11")
@nox.session(name="docs-live", python="3.12")
def docs_live(session):
session.install("-e", ".")
session.install("-r", "docs/requirements.txt")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readme = "README.md"
classifiers = [
"License :: OSI Approved :: MIT License",
]
requires-python = ">=3.7"
requires-python = ">=3.8"
dynamic = [
"version",
"description",
Expand Down
6 changes: 3 additions & 3 deletions tools/update_launchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ async def main() -> None:
await asyncio.gather(*(_download(client, name) for name in LAUNCHERS))


def _patch_windows_38() -> None:
def _patch_windows() -> None:
# https://github.com/encode/httpx/issues/914
if sys.version_info >= (3, 8) and sys.platform.startswith("win"):
if sys.platform.startswith("win"):
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())


if __name__ == "__main__":
_patch_windows_38()
_patch_windows()
asyncio.run(main())

0 comments on commit c98aa54

Please sign in to comment.