Skip to content

Commit

Permalink
Merge pull request #59 from statisticsnorway/python312
Browse files Browse the repository at this point in the history
Add support for python 3.12, remove support for python 3.9
  • Loading branch information
arneso-ssb authored Mar 25, 2024
2 parents fe9e103 + 458c350 commit 08df7f0
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ cutty==0.18.0
nox==2024.3.2
nox-poetry==1.0.3
poetry==1.8.2
pre-commit==3.6.2
pre-commit==3.7.0
virtualenv==20.25.1
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/[email protected]
with:
python-version: "3.11"
python-version: "3.12"
- run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip install --constraint=.github/workflows/constraints.txt nox
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 @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/[email protected]
with:
python-version: "3.11"
python-version: "3.12"
- run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip install --constraint=.github/workflows/constraints.txt pre-commit
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
fail-fast: false
matrix:
include:
- { python-version: "3.12", os: ubuntu-latest }
- { python-version: "3.12", os: windows-latest }
- { python-version: "3.12", os: macos-latest }
- { python-version: "3.11", os: ubuntu-latest }
- { python-version: "3.11", os: windows-latest }
- { python-version: "3.11", os: macos-latest }
- { python-version: "3.10", os: ubuntu-latest }
- { python-version: "3.9", os: ubuntu-latest }
name: Python ${{ matrix.python-version }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/[email protected]
with:
python-version: "3.11"
python-version: "3.12"
- run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip install --constraint=.github/workflows/constraints.txt nox
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Request features on the [Issue Tracker].

## How to set up your development environment

You need Python 3.9+ and the following tools:
You need Python 3.10+ and the following tools:

- [Cookiecutter]
- [Poetry]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ cruft update
- Generate command-line reference with [sphinx-click]
- Manage project labels with [GitHub Labeler]

The template supports Python 3.9, 3.10 and 3.11.
The template supports Python 3.10, 3.10 and 3.12.

[autodoc]: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
[black]: https://github.com/psf/black
Expand Down
53 changes: 23 additions & 30 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ py -VV
Both of these commands should display the latest Python version, 3.10.

For local testing with multiple Python versions,
repeat these steps for the latest bugfix releases of Python 3.9+,
repeat these steps for the latest bugfix releases of Python 3.10+,
with the following changes:

- Do _not_ enable the option to add Python to the `PATH` environment variable.
- `py -VV` and `python -VV` should still display the version of the latest stable release.
- `py -X.Y -VV` (e.g. `py -3.7 -VV`) should display the exact version you just installed.
- `py -X.Y -VV` (e.g. `py -3.12 -VV`) should display the exact version you just installed.

Note that binary installers are not provided for security releases.

Expand Down Expand Up @@ -139,25 +139,25 @@ Install the Python build dependencies for your platform,
using one of the commands listed in the [official instructions][pyenv wiki].

Install the latest point release of every supported Python version.
This project template supports Python 3.9, 3.10 and 3.11.
This project template supports Python 3.10, 3.11 and 3.12.

```console
pyenv install 3.9.18
pyenv install 3.10.13
pyenv install 3.11.6
pyenv install 3.12.2
```

After creating your project (see [below](creating-a-project)),
you can make these Python versions accessible in the project directory,
using the following command:

```console
pyenv local 3.11.6 3.10.13 3.9.18
pyenv local 3.11.6 3.10.13 3.12.2
```

The first version listed is the one used when you type plain `python`.
Every version can be used by invoking `python<major.minor>`.
For example, use `python3.9` to invoke Python 3.9.
For example, use `python3.10` to invoke Python 3.10.

### Requirements

Expand Down Expand Up @@ -980,13 +980,13 @@ for every Python version supported by your project,
and easily switch between them:

```console
poetry env use 3.9
poetry env use 3.10
poetry env use 3.11
poetry env use 3.12
```

Only one Poetry environment can be active at any time.
Note that `3.11` comes last,
Note that `3.12` comes last,
to ensure that the current Python release is the active environment.
Install your package with `poetry install` into each environment after creating it.

Expand Down Expand Up @@ -1185,39 +1185,35 @@ The following table gives an overview of the available Nox sessions:
- Default
- - [coverage](the-coverage-session)
- Report coverage with [Coverage.py]
- `3.11`
- `3.10`
- (✓)
- - [docs](the-docs-session)
- Build and serve [Sphinx] documentation
- `3.11`
- `3.10`
-
- - [docs-build](the-docs-build-session)
- Build [Sphinx] documentation
- `3.11`
- `3.10`
-
- - [mypy](the-mypy-session)
- Type-check with [mypy]
- `3.9``3.11`
- `3.10``3.12`
-
- - [pre-commit](the-pre-commit-session)
- Lint with [pre-commit]
- `3.11`
-
- - [safety](the-safety-session)
- Scan dependencies with [Safety]
- `3.11`
- `3.10`
-
- - [tests](the-tests-session)
- Run tests with [pytest]
- `3.9``3.11`
- `3.10``3.12`
-
- - [typeguard](the-typeguard-session)
- Type-check with [Typeguard]
- `3.11`
- `3.10`
-
- - [xdoctest](the-xdoctest-session)
- Run examples with [xdoctest]
- `3.9``3.11`
- `3.10``3.12`
-

:::
Expand Down Expand Up @@ -2264,28 +2260,25 @@ as shown in the table below:
- Python versions
- - [pre-commit](the-pre-commit-session)
- Ubuntu
- 3.10
- - [safety](the-safety-session)
- Ubuntu
- 3.10
- 3.12
- - [mypy](the-mypy-session)
- Ubuntu
- 3.10, 3.9, 3.8, 3.7
- 3.10, 3.11, 3.12
- - [tests](the-tests-session)
- Ubuntu
- 3.10, 3.9, 3.8, 3.7
- 3.10, 3.11, 3.12
- - [tests](the-tests-session)
- Windows
- 3.10
- 3.12
- - [tests](the-tests-session)
- macOS
- 3.10
- 3.12
- - [coverage](the-coverage-session)
- Ubuntu
- 3.10
- 3.12
- - [docs-build](the-docs-build-session)
- Ubuntu
- 3.10
- 3.12

:::

Expand Down
2 changes: 1 addition & 1 deletion docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pipx inject nox nox-poetry

[pipx] is preferred, but you can also install with `pip install --user`.

It is recommended to set up Python 3.9, 3.10 and 3.11 using [pyenv].
It is recommended to set up Python 3.10, 3.11 and 3.12 using [pyenv].

## Creating a project

Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_name}}/.github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Set up Python
uses: actions/[email protected]
with:
python-version: "3.11"
python-version: "3.12"
cache: "poetry"

- name: Install dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Set up Python
uses: actions/[email protected]
with:
python-version: "3.11"
python-version: "3.12"

- name: Upgrade pip
run: |
Expand Down
20 changes: 10 additions & 10 deletions {{cookiecutter.project_name}}/.github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ jobs:
matrix:
include:
- { python: "3.10", os: "ubuntu-latest", session: "pre-commit" }
- { python: "3.11", os: "ubuntu-latest", session: "mypy" }
- { python: "3.10", os: "ubuntu-latest", session: "mypy" }
- { python: "3.9", os: "ubuntu-latest", session: "mypy" }
- { python: "3.11", os: "ubuntu-latest", session: "tests" }
- { python: "3.11", os: "ubuntu-latest", session: "mypy" }
- { python: "3.12", os: "ubuntu-latest", session: "mypy" }
- { python: "3.10", os: "ubuntu-latest", session: "tests" }
- { python: "3.9", os: "ubuntu-latest", session: "tests" }
- { python: "3.11", os: "windows-latest", session: "tests" }
- { python: "3.11", os: "macos-latest", session: "tests" }
- { python: "3.10", os: "ubuntu-latest", session: "typeguard" }
- { python: "3.11", os: "ubuntu-latest", session: "xdoctest" }
- { python: "3.10", os: "ubuntu-latest", session: "docs-build" }
- { python: "3.11", os: "ubuntu-latest", session: "tests" }
- { python: "3.12", os: "ubuntu-latest", session: "tests" }
- { python: "3.12", os: "windows-latest", session: "tests" }
- { python: "3.12", os: "macos-latest", session: "tests" }
- { python: "3.12", os: "ubuntu-latest", session: "typeguard" }
- { python: "3.12", os: "ubuntu-latest", session: "xdoctest" }
- { python: "3.12", os: "ubuntu-latest", session: "docs-build" }

env:
NOXSESSION: ${{"{{"}} matrix.session {{"}}"}}
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
- name: Set up Python
uses: actions/[email protected]
with:
python-version: "3.11"
python-version: "3.12"

- name: Upgrade pip
run: |
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_name}}/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Request features on the [Issue Tracker].

## How to set up your development environment

You need Python 3.9+ and the following tools:
You need Python 3.10+ and the following tools:

- [Poetry]
- [Nox]
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_name}}/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
raise SystemExit(dedent(message)) from None

package = "{{cookiecutter.package_name}}"
python_versions = ["3.10", "3.11", "3.9"]
python_versions = ["3.10", "3.11", "3.12"]
nox.needs_version = ">= 2021.6.6"
nox.options.sessions = (
"pre-commit",
Expand Down
4 changes: 2 additions & 2 deletions {{cookiecutter.project_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ classifiers = ["{{cookiecutter.development_status}}"]
Changelog = "https://github.com/{{cookiecutter.github_organization}}/{{cookiecutter.project_name}}/releases"

[tool.poetry.dependencies]
python = "^3.9"
python = "^3.10"
click = ">=8.0.1"

[tool.poetry.group.dev.dependencies]
Expand Down Expand Up @@ -75,7 +75,7 @@ show_error_context = true
force-exclude = true # Apply excludes to pre-commit
show-fixes = true
src = ["src", "tests"]
target-version = "py39" # Minimum Python version supported
target-version = "py310" # Minimum Python version supported
include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
extend-exclude = [
"__pycache__",
Expand Down

0 comments on commit 08df7f0

Please sign in to comment.