Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
cf44b23
Changes test matrix in github actions to match 3.9-3.12.
56kyle Mar 17, 2024
bc27ea3
Updates all references to versions of Python aside from in the poetry…
56kyle Mar 17, 2024
6fc921a
Merge branch 'develop' into update-python-versions
56kyle Mar 17, 2024
ee1ceb4
Fixes broken anchor in link.
56kyle Mar 17, 2024
9e7b463
Replaces gitlab link with github repo due to gitlab signin breaking l…
56kyle Mar 17, 2024
120f90e
Updates poetry install recommendation to use pipx as recommended by t…
56kyle Mar 17, 2024
5963d09
Removes now obsolete install-poetry.py link.
56kyle Mar 17, 2024
373ce9a
Updates poetry install recomendation to use pipx and removes link to …
56kyle Mar 17, 2024
e35fb15
Merge remote-tracking branch 'origin/update-python-versions' into upd…
56kyle Mar 17, 2024
118b9d1
Adds some escapes for portions that shouldn't evaluate in cookiecutte…
56kyle Mar 17, 2024
85917b6
Adds another escaped portion to release.yml.
56kyle Mar 17, 2024
472204e
Adds one more escaped portion to release.yml.
56kyle Mar 17, 2024
c2d0885
Tries to undo somer of the faulty changes done to the github actions …
56kyle Mar 17, 2024
4e4cb71
Removes line breaking pre-commit in ci/cd.
56kyle Mar 17, 2024
ff573bc
Runs poetry update in a generated project and updates poetry.lock.
56kyle Mar 17, 2024
4296565
Updates ci/cd constraints in main project to match the generated one'…
56kyle Mar 17, 2024
797148b
Adds some blank lines that error in the 3.12 pre-commit only.
56kyle Mar 17, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pip==23.0.1
pip==23.2.1
cookiecutter==2.1.1
cutty==0.18.0
nox==2022.11.21
nox-poetry==1.0.2
poetry==1.3.2
poetry==1.6.1
pre-commit==3.1.0
virtualenv==20.14.1
virtualenv==20.25.0
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ 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.10", os: ubuntu-latest }
- { python-version: "3.10", os: windows-latest }
- { python-version: "3.10", os: macos-latest }
- { python-version: "3.9", os: ubuntu-latest }
- { python-version: "3.8", os: ubuntu-latest }
- { python-version: "3.7", os: ubuntu-latest }
name: Python ${{ matrix.python-version }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-instance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
repository: "cjolowicz/${{ env.PROJECT }}"
path: ${{ env.PROJECT }}
token: ${{ secrets.X_GITHUB_TOKEN }}
- name: Set up Python 3.10
- name: Set up Python 3.12
uses: actions/setup-python@v4.5.0
with:
python-version: "3.10"
python-version: "3.12"
- name: Install cutty
working-directory: ${{ env.TEMPLATE }}
run: |
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.7+ and the following tools:
You need Python 3.9+ 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 @@ -78,7 +78,7 @@ cookiecutter gh:cjolowicz/cookiecutter-hypermodern-python --checkout=2022.6.3
- Generate command-line reference with [sphinx-click]
- Manage project labels with [GitHub Labeler]

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

[autodoc]: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
[bandit]: https://github.com/PyCQA/bandit
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Sphinx configuration."""

from datetime import datetime


Expand Down
82 changes: 38 additions & 44 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ python -VV
py -VV
```

Both of these commands should display the latest Python version, 3.10.
Both of these commands should display the latest Python version, 3.12.

For local testing with multiple Python versions,
repeat these steps for the latest bugfix releases of Python 3.7+,
repeat these steps for the latest bugfix releases of Python 3.9+,
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.9 -VV`) should display the exact version you just installed.

Note that binary installers are not provided for security releases.

Expand Down Expand Up @@ -137,26 +137,26 @@ 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.7, 3.8, 3.9, and 3.10.
This project template supports Python 3.9, 3.10, 3.11, and 3.12.

```console
$ pyenv install 3.7.12
$ pyenv install 3.8.12
$ pyenv install 3.9.10
$ pyenv install 3.10.2
$ pyenv install 3.9.13
$ pyenv install 3.10.11
$ pyenv install 3.11.8
$ 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.10.2 3.9.10 3.8.12 3.7.12
$ pyenv local 3.12.2 3.11.8 3.10.11 3.9.13
```

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.7` to invoke Python 3.7.
For example, use `python3.9` to invoke Python 3.9.

### Requirements

Expand All @@ -182,15 +182,10 @@ Install [Cookiecutter] using pipx:
$ pipx install cookiecutter
```

Install [Poetry] by downloading and running [install-poetry.py]:

```console
$ python install-poetry.py
```

Install [Nox] and [nox-poetry] using pipx:
Install [Poetry], [Nox], and [nox-poetry] using pipx:

```console
$ pipx install poetry
$ pipx install nox
$ pipx inject nox nox-poetry
```
Expand Down Expand Up @@ -981,14 +976,14 @@ for every Python version supported by your project,
and easily switch between them:

```console
$ poetry env use 3.7
$ poetry env use 3.8
$ 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.10` 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 @@ -1161,7 +1156,7 @@ For example, the following may be more practical during development
(this will only run tests and type checks, on the current Python release):

```console
$ nox -p 3.10 -rs tests mypy
$ nox -p 3.12 -rs tests mypy
```

Many sessions accept additional options after `--` separator.
Expand All @@ -1187,39 +1182,39 @@ The following table gives an overview of the available Nox sessions:
- Default
- - [coverage](the-coverage-session)
- Report coverage with [Coverage.py]
- `3.10`
- `3.12`
- (✓)
- - [docs](the-docs-session)
- Build and serve [Sphinx] documentation
- `3.10`
- `3.12`
-
- - [docs-build](the-docs-build-session)
- Build [Sphinx] documentation
- `3.10`
- `3.12`
- ✓
- - [mypy](the-mypy-session)
- Type-check with [mypy]
- `3.7` … `3.10`
- `3.9` … `3.12`
- ✓
- - [pre-commit](the-pre-commit-session)
- Lint with [pre-commit]
- `3.10`
- `3.12`
- ✓
- - [safety](the-safety-session)
- Scan dependencies with [Safety]
- `3.10`
- `3.12`
- ✓
- - [tests](the-tests-session)
- Run tests with [pytest]
- `3.7` … `3.10`
- `3.9` … `3.12`
- ✓
- - [typeguard](the-typeguard-session)
- Type-check with [Typeguard]
- `3.10`
- `3.12`
- ✓
- - [xdoctest](the-xdoctest-session)
- Run examples with [xdoctest]
- `3.7` … `3.10`
- `3.9` … `3.12`
- ✓

:::
Expand Down Expand Up @@ -1279,7 +1274,7 @@ For example, the following command runs mypy
using the current stable release of Python:

```console
$ nox --session=mypy --python=3.10
$ nox --session=mypy --python=3.12
```

Use the separator `--` to pass additional options and arguments to `mypy`.
Expand Down Expand Up @@ -1353,7 +1348,7 @@ For example, the following command runs the test suite
using the current stable release of Python:

```console
$ nox --session=tests --python=3.10
$ nox --session=tests --python=3.12
```

Use the separator `--` to pass additional options to `pytest`.
Expand Down Expand Up @@ -1480,7 +1475,7 @@ For example, the following command runs the examples
using the current stable release of Python:

```console
$ nox --session=xdoctest --python=3.10
$ nox --session=xdoctest --python=3.12
```

By default, the Nox session uses the `all` subcommand to run all examples.
Expand Down Expand Up @@ -2274,28 +2269,28 @@ as shown in the table below:
- Python versions
- - [pre-commit](the-pre-commit-session)
- Ubuntu
- 3.10
- 3.12
- - [safety](the-safety-session)
- Ubuntu
- 3.10
- 3.12
- - [mypy](the-mypy-session)
- Ubuntu
- 3.10, 3.9, 3.8, 3.7
- 3.12, 3.11, 3.10, 3.9
- - [tests](the-tests-session)
- Ubuntu
- 3.10, 3.9, 3.8, 3.7
- 3.12, 3.11, 3.10, 3.9
- - [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 Expand Up @@ -2625,7 +2620,7 @@ You can also read the articles on [this blog][hypermodern python blog].
[flake8-bandit]: https://github.com/tylerwince/flake8-bandit
[flake8-bugbear codes]: https://github.com/PyCQA/flake8-bugbear#list-of-warnings
[flake8-bugbear]: https://github.com/PyCQA/flake8-bugbear
[flake8-docstrings]: https://gitlab.com/pycqa/flake8-docstrings
[flake8-docstrings]: https://github.com/pycqa/flake8-docstrings
[flake8-rst-docstrings codes]: https://github.com/peterjc/flake8-rst-docstrings#flake8-validation-codes
[flake8-rst-docstrings]: https://github.com/peterjc/flake8-rst-docstrings
[flake8]: http://flake8.pycqa.org
Expand Down Expand Up @@ -2653,7 +2648,6 @@ You can also read the articles on [this blog][hypermodern python blog].
[hypermodern python cookiecutter]: https://github.com/cjolowicz/cookiecutter-hypermodern-python
[hypermodern python]: https://medium.com/@cjolowicz/hypermodern-python-d44485d9d769
[import hook]: https://docs.python.org/3/reference/import.html#import-hooks
[install-poetry.py]: https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py
[isort black profile]: https://pycqa.github.io/isort/docs/configuration/black_compatibility.html
[isort force_single_line]: https://pycqa.github.io/isort/docs/configuration/options.html#force-single-line
[isort lines_after_imports]: https://pycqa.github.io/isort/docs/configuration/options.html#lines-after-imports
Expand Down Expand Up @@ -2711,7 +2705,7 @@ You can also read the articles on [this blog][hypermodern python blog].
[pypa/gh-action-pypi-publish]: https://github.com/pypa/gh-action-pypi-publish
[pypi]: https://pypi.org/
[pyproject.toml]: https://python-poetry.org/docs/pyproject/
[pytest layout]: https://docs.pytest.org/en/latest/explanation/goodpractices.html#choosing-a-test-layout-import-rules
[pytest layout]: https://docs.pytest.org/en/latest/explanation/goodpractices.html#choosing-a-test-layout
[pytest]: https://docs.pytest.org/en/latest/
[python build]: https://python-poetry.org/docs/cli/#build
[python package]: https://docs.python.org/3/tutorial/modules.html#packages
Expand Down
12 changes: 3 additions & 9 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,17 @@ Install [Cookiecutter]:
$ pipx install cookiecutter
```

Install [Poetry] by downloading and running [install-poetry.py]:

```console
$ python install-poetry.py
```

Install [Nox] and [nox-poetry]:
Install [Poetry], [Nox], and [nox-poetry]:

```console
$ pipx install poetry
$ pipx install nox
$ 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.7, 3.8, 3.9, 3.10 using [pyenv].
It is recommended to set up Python 3.9, 3.10, 3.11, and 3.12 using [pyenv].

## Creating a project

Expand Down Expand Up @@ -159,7 +154,6 @@ by applying labels to them, like this:
[codecov]: https://codecov.io/
[cookiecutter]: https://github.com/audreyr/cookiecutter
[github]: https://github.com/
[install-poetry.py]: https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py
[nox]: https://nox.thea.codes/
[nox-poetry]: https://nox-poetry.readthedocs.io/
[pipx]: https://pipxproject.github.io/pipx/
Expand Down
1 change: 1 addition & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Nox sessions."""

from pathlib import Path
import shutil

Expand Down
14 changes: 7 additions & 7 deletions {{cookiecutter.project_name}}/.github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
fetch-depth: 2

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v4.6.3
with:
python-version: "3.10"
python-version: "3.12"

- name: Upgrade pip
run: |
Expand Down Expand Up @@ -63,20 +63,20 @@ jobs:
uses: pypa/gh-action-pypi-publish@v1.8.10
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
password: {{ "${{ secrets.PYPI_TOKEN }}" }}

- name: Publish package on TestPyPI
if: "! steps.check-version.outputs.tag"
uses: pypa/gh-action-pypi-publish@v1.8.10
with:
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
password: {{ "${{ secrets.TEST_PYPI_TOKEN }}" }}
repository_url: https://test.pypi.org/legacy/

- name: Publish the release notes
uses: release-drafter/release-drafter@v5.23.0
with:
publish: ${{ steps.check-version.outputs.tag != '' }}
tag: ${{ steps.check-version.outputs.tag }}
publish: {{ "${{ steps.check-version.outputs.tag != '' }}" }}
tag: {{ "${{ steps.check-version.outputs.tag }}" }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: {{ "${{ secrets.GITHUB_TOKEN }}" }}
Loading