Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Python 3.10 #1052

Merged
merged 5 commits into from
Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Features
- Generate command-line reference with sphinx-click_
- Manage project labels with `GitHub Labeler`_

The template supports Python 3.6, 3.7, 3.8, and 3.9.
The template supports Python 3.6, 3.7, 3.8, 3.9, and 3.10.

.. features-end

Expand Down
60 changes: 31 additions & 29 deletions docs/guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,23 @@ using one of the commands listed in the
__ https://github.com/pyenv/pyenv/wiki/Common-build-problems

Install the latest point release of every supported Python version.
This project template supports Python 3.6, 3.7, 3.8, and 3.9.
This project template supports Python 3.6, 3.7, 3.8, 3.9, and 3.10.

.. code:: console

$ pyenv install 3.6.12
$ pyenv install 3.7.9
$ pyenv install 3.8.6
$ pyenv install 3.9.0
$ pyenv install 3.6.15
$ pyenv install 3.7.12
$ pyenv install 3.8.12
$ pyenv install 3.9.8
$ pyenv install 3.10.0

After creating your project (see :ref:`below <Creating a project>`),
you can make these Python versions accessible in the project directory,
using the following command:

.. code:: console

$ pyenv local 3.9.0 3.8.6 3.7.9 3.6.12
$ pyenv local 3.10.0 3.9.8 3.8.12 3.7.12 3.6.15

The first version listed is the one used when you type plain ``python``.
Every version can be used by invoking ``python<major.minor>``.
Expand Down Expand Up @@ -885,9 +886,10 @@ and easily switch between them:
$ poetry env use 3.7
$ poetry env use 3.8
$ poetry env use 3.9
$ poetry env use 3.10

Only one Poetry environment can be active at any time.
Note that ``3.9`` comes last,
Note that ``3.10`` 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 @@ -1081,7 +1083,7 @@ For example, the following may be more practical during development

.. code:: console

$ nox -p 3.9 -rs tests mypy
$ nox -p 3.10 -rs tests mypy

.. _--reuse-existing-virtualenvs: https://nox.thea.codes/en/stable/usage.html#re-using-virtualenvs

Expand All @@ -1107,15 +1109,15 @@ The following table gives an overview of the available Nox sessions:
========================================== ===================================== ================== =========
Session Description Python Default
========================================== ===================================== ================== =========
:ref:`coverage <The coverage session>` Report coverage with Coverage.py_ ``3.9`` (✓)
:ref:`docs <The docs session>` Build and serve Sphinx_ documentation ``3.9``
:ref:`docs-build <The docs-build session>` Build Sphinx_ documentation ``3.9``
:ref:`mypy <The mypy session>` Type-check with mypy_ ``3.6`` … ``3.9``
:ref:`pre-commit <The pre-commit session>` Lint with pre-commit_ ``3.9``
:ref:`safety <The safety session>` Scan dependencies with Safety_ ``3.9``
:ref:`tests <The tests session>` Run tests with pytest_ ``3.6`` … ``3.9``
:ref:`typeguard <The typeguard session>` Type-check with Typeguard_ ``3.6`` … ``3.9``
:ref:`xdoctest <The xdoctest session>` Run examples with xdoctest_ ``3.6`` … ``3.9``
:ref:`coverage <The coverage session>` Report coverage with Coverage.py_ ``3.10`` (✓)
:ref:`docs <The docs session>` Build and serve Sphinx_ documentation ``3.10``
:ref:`docs-build <The docs-build session>` Build Sphinx_ documentation ``3.10``
:ref:`mypy <The mypy session>` Type-check with mypy_ ``3.6`` … ``3.10``
:ref:`pre-commit <The pre-commit session>` Lint with pre-commit_ ``3.10``
:ref:`safety <The safety session>` Scan dependencies with Safety_ ``3.10``
:ref:`tests <The tests session>` Run tests with pytest_ ``3.6`` … ``3.10``
:ref:`typeguard <The typeguard session>` Type-check with Typeguard_ ``3.6`` … ``3.10``
:ref:`xdoctest <The xdoctest session>` Run examples with xdoctest_ ``3.6`` … ``3.10``
========================================== ===================================== ================== =========


Expand Down Expand Up @@ -1180,7 +1182,7 @@ using the current stable release of Python:

.. code:: console

$ nox --session=mypy --python=3.9
$ nox --session=mypy --python=3.10

Use the separator ``--`` to pass additional options and arguments to ``mypy``.
For example, the following command type-checks only the ``__main__`` module:
Expand Down Expand Up @@ -1263,7 +1265,7 @@ using the current stable release of Python:

.. code:: console

$ nox --session=tests --python=3.9
$ nox --session=tests --python=3.10

Use the separator ``--`` to pass additional options to ``pytest``.
For example, the following command runs only the test case ``test_main_succeeds``:
Expand Down Expand Up @@ -1360,7 +1362,7 @@ with the current stable release of Python:

.. code:: console

$ nox --session=typeguard --python=3.9
$ nox --session=typeguard --python=3.10

Use the separator ``--`` to pass additional options and arguments to pytest.
For example, the following command runs only tests for the ``__main__`` module:
Expand Down Expand Up @@ -1403,7 +1405,7 @@ using the current stable release of Python:

.. code:: console

$ nox --session=xdoctest --python=3.9
$ nox --session=xdoctest --python=3.10

By default, the Nox session uses the ``all`` subcommand to run all examples.
You can also list examples using the ``list`` subcommand,
Expand Down Expand Up @@ -2280,14 +2282,14 @@ __ https://help.github.com/en/actions/automating-your-workflow-with-github-actio
========================================== ====================== ==================
Nox session Platform Python versions
========================================== ====================== ==================
:ref:`pre-commit <The pre-commit session>` Ubuntu 3.9
:ref:`safety <The safety session>` Ubuntu 3.9
:ref:`mypy <The mypy session>` Ubuntu 3.9, 3.8, 3.7, 3.6
:ref:`tests <The tests session>` Ubuntu 3.9, 3.8, 3.7, 3.6
:ref:`tests <The tests session>` Windows 3.9
:ref:`tests <The tests session>` macOS 3.9
:ref:`coverage <The coverage session>` Ubuntu 3.9
:ref:`docs-build <The docs-build session>` Ubuntu 3.8
:ref:`pre-commit <The pre-commit session>` Ubuntu 3.10
:ref:`safety <The safety session>` Ubuntu 3.10
:ref:`mypy <The mypy session>` Ubuntu 3.10, 3.9, 3.8, 3.7, 3.6
:ref:`tests <The tests session>` Ubuntu 3.10, 3.9, 3.8, 3.7, 3.6
:ref:`tests <The tests session>` Windows 3.10
:ref:`tests <The tests session>` macOS 3.10
:ref:`coverage <The coverage session>` Ubuntu 3.10
:ref:`docs-build <The docs-build session>` Ubuntu 3.10
========================================== ====================== ==================

The workflow uploads the generated documentation as a `workflow artifact`__.
Expand Down
2 changes: 1 addition & 1 deletion docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Install Nox_ and nox-poetry_:

pipx_ is preferred, but you can also install with ``pip install --user``.

It is recommended to set up Python 3.6, 3.7, 3.8, and 3.9 using pyenv_.
It is recommended to set up Python 3.6, 3.7, 3.8, 3.9, 3.10 using pyenv_.


Creating a project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2.2.2
with:
python-version: "3.9"
python-version: "3.10"

- name: Upgrade pip
run: |
Expand Down
12 changes: 7 additions & 5 deletions {{cookiecutter.project_name}}/.github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,23 @@ jobs:
fail-fast: false
matrix:
include:
- { python-version: 3.9, os: ubuntu-latest, session: "pre-commit" }
- { python-version: 3.9, os: ubuntu-latest, session: "safety" }
- { python-version: "3.10", os: ubuntu-latest, session: "pre-commit" }
- { python-version: "3.10", os: ubuntu-latest, session: "safety" }
- { python-version: "3.10", os: ubuntu-latest, session: "mypy" }
- { python-version: 3.9, os: ubuntu-latest, session: "mypy" }
- { python-version: 3.8, os: ubuntu-latest, session: "mypy" }
- { python-version: 3.7, os: ubuntu-latest, session: "mypy" }
- { python-version: 3.6, os: ubuntu-latest, session: "mypy" }
- { python-version: "3.10", os: ubuntu-latest, session: "tests" }
- { python-version: 3.9, os: ubuntu-latest, session: "tests" }
- { python-version: 3.8, os: ubuntu-latest, session: "tests" }
- { python-version: 3.7, os: ubuntu-latest, session: "tests" }
- { python-version: 3.6, os: ubuntu-latest, session: "tests" }
- { python-version: 3.9, os: windows-latest, session: "tests" }
- { python-version: 3.9, os: macos-latest, session: "tests" }
- { python-version: 3.9, os: ubuntu-latest, session: "typeguard" }
- { python-version: 3.9, os: ubuntu-latest, session: "xdoctest" }
- { python-version: 3.9, os: ubuntu-latest, session: "docs-build" }
- { python-version: "3.10", os: ubuntu-latest, session: "typeguard" }
- { python-version: "3.10", os: ubuntu-latest, session: "xdoctest" }
- { python-version: "3.10", os: ubuntu-latest, session: "docs-build" }

env:
NOXSESSION: {{ "${{ matrix.session }}" }}
Expand Down
10 changes: 5 additions & 5 deletions {{cookiecutter.project_name}}/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


package = "{{cookiecutter.package_name}}"
python_versions = ["3.9", "3.8", "3.7", "3.6"]
python_versions = ["3.10", "3.9", "3.8", "3.7", "3.6"]
nox.needs_version = ">= 2021.6.6"
nox.options.sessions = (
"pre-commit",
Expand Down Expand Up @@ -83,7 +83,7 @@ def activate_virtualenv_in_precommit_hooks(session: Session) -> None:
hook.write_text("\n".join(lines))


@session(name="pre-commit", python="3.9")
@session(name="pre-commit", python="3.10")
def precommit(session: Session) -> None:
"""Lint using pre-commit."""
args = session.posargs or ["run", "--all-files", "--show-diff-on-failure"]
Expand All @@ -105,7 +105,7 @@ def precommit(session: Session) -> None:
activate_virtualenv_in_precommit_hooks(session)


@session(python="3.9")
@session(python="3.10")
def safety(session: Session) -> None:
"""Scan dependencies for insecure packages."""
requirements = session.poetry.export_requirements()
Expand Down Expand Up @@ -166,7 +166,7 @@ def xdoctest(session: Session) -> None:
session.run("python", "-m", "xdoctest", package, *args)


@session(name="docs-build", python="3.9")
@session(name="docs-build", python="3.10")
def docs_build(session: Session) -> None:
"""Build the documentation."""
args = session.posargs or ["docs", "docs/_build"]
Expand All @@ -180,7 +180,7 @@ def docs_build(session: Session) -> None:
session.run("sphinx-build", *args)


@session(python="3.9")
@session(python="3.10")
def docs(session: Session) -> None:
"""Build and serve the documentation with live reloading on file changes."""
args = session.posargs or ["--open-browser", "docs", "docs/_build"]
Expand Down
1 change: 1 addition & 0 deletions {{cookiecutter.project_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ classifiers = [
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]

[tool.poetry.urls]
Expand Down