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

chore: raise minimum version to Python 3.10 #239

Merged
merged 4 commits into from
Apr 24, 2024
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
20 changes: 11 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ jobs:
name: htmlcov
path: htmlcov/

test_39:
name: "Python 3.9 Tests"
test_310:
name: "Python 3.10 Tests"

runs-on: ubuntu-22.04

Expand All @@ -74,37 +74,39 @@ jobs:
with:
cachix_auth_token: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: unit tests
- name: Run linters and unit tests
run: |
nix-shell --run "PYTHON=python3.9 make unit"
nix-shell --run "PYTHON=python3.10 make lint all=true"
nix-shell --run "PYTHON=python3.10 make types"
nix-shell --run "PYTHON=python3.10 make unit"

- name: Run tests for the singlefile example
run: |
cd examples/singlefile
nix-shell --run "python3.9 -m unittest app.py"
nix-shell --run "python3.10 -m unittest app.py"

- name: Run tests for the todoapp example
run: |
cd examples/todoapp
nix-shell --run "python3.9 -m unittest tests.py"
nix-shell --run "python3.10 -m unittest tests.py"

- name: Run tests for the splitfile example
run: |
cd examples/splitfile
nix-shell --run "python3.9 -m unittest tests.py"
nix-shell --run "python3.10 -m unittest tests.py"

- name: Save coverage report
uses: actions/upload-artifact@v4
with:
name: htmlcov-py39
name: htmlcov-py310
path: htmlcov/


release:
name: "Release to PyPI"

if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
needs: [test_312, test_39]
needs: [test_312, test_310]
runs-on: ubuntu-22.04

# To test publishing to testpypi:
Expand Down
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ default_stages: [commit,push]
repos:
- repo: local
hooks:
- id: pyupgrade
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

name: pyupgrade
description: Upgrades syntax for modern versions of Python.
entry: pyupgrade
language: system
types: [python]
args: [--py310-plus]

- id: isort
name: isort
description: A Python utility that sorts imports alphabetically.
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ In CI, we want to test the oldest supported versions of `openapi-core` and `pyra
* Have the `py39` folder with additional `pyproject.toml` and `poetry.lock` files
that are changed to pin `openapi-core` and `pyramid` to minimally supported version.
* They are auto-generated when running `make lock`.
* They are used by Nix to prepare the Python 3.9 env.
* `PYTHON=python3.9 make tests` then run tests with an older Python version.
* They are used by Nix to prepare the Python 3.10 env.
* `PYTHON=python3.10 make tests` then run tests with an older Python version.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ lock:
@cat pyproject.toml \
| sed 's/openapi-core = ">=/openapi-core = "==/g' \
| sed 's/pyramid = ">=/pyramid = "==/g' \
> py39/pyproject.toml
> py310/pyproject.toml
@rm -rf .venv/
@poetry lock --no-update --directory py39
@poetry lock --no-update --directory py310
@rm -rf .venv/
@nix-shell --run true
@direnv reload
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ The authors of pyramid_openapi3 believe that the approach of validating a manual

## Running tests

You need to have [poetry](https://python-poetry.org/) and Python 3.9 & 3.12 installed on your machine. All `Makefile` commands assume you have the Poetry environment activated, i.e. `poetry shell`.
You need to have [poetry](https://python-poetry.org/) and Python 3.10 & 3.12 installed on your machine. All `Makefile` commands assume you have the Poetry environment activated, i.e. `poetry shell`.

Alternatively, if you use [nix](https://nix.dev/tutorials/declarative-and-reproducible-developer-environments), run `nix-shell` to drop into a shell that has everything prepared for development.

Expand All @@ -206,7 +206,7 @@ These packages tackle the same problem-space:

We do our best to follow the rules below.

- Support the latest few releases of Python, currently Python 3.9 through 3.12.
- Support the latest few releases of Python, currently Python 3.10 through 3.12.
- Support the latest few releases of Pyramid, currently 1.10.7 through 2.0.2.
- Support the latest few releases of `openapi-core`, currently just 0.19.0.
- See `poetry.lock` for a frozen-in-time known-good-set of all dependencies.
Expand Down
2 changes: 1 addition & 1 deletion examples/singlefile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The `app.py` file in this folder showcases how to use the [pyramid_openapi3](htt
```bash
* git clone https://github.com/Pylons/pyramid_openapi3.git
* cd pyramid_openapi3/examples/singlefile
* virtualenv -p python3.9 .
* virtualenv -p python3.10 .
* source bin/activate
* pip install pyramid_openapi3
* python app.py
Expand Down
2 changes: 1 addition & 1 deletion examples/splitfile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This folder showcases how to use the [pyramid_openapi3](https://github.com/Pylon
```bash
$ git clone https://github.com/Pylons/pyramid_openapi3.git
$ cd pyramid_openapi3/examples/splitfile
$ virtualenv -p python3.9 .
$ virtualenv -p python3.10 .
$ source bin/activate
$ pip install pyramid_openapi3
$ python app.py
Expand Down
2 changes: 1 addition & 1 deletion examples/todoapp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This folder showcases how to use the [pyramid_openapi3](https://github.com/Pylon
```bash
$ git clone https://github.com/Pylons/pyramid_openapi3.git
$ cd pyramid_openapi3/examples/todoapp
$ virtualenv -p python3.9 .
$ virtualenv -p python3.10 .
$ source bin/activate
$ pip install pyramid_openapi3
$ python app.py
Expand Down
41 changes: 3 additions & 38 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 3 additions & 38 deletions py39/poetry.lock → py310/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion py39/pyproject.toml → py310/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ exclude = ["pyramid_openapi3/tests/"]


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

openapi-core = "==0.19.1"
pyramid = "==1.10.7"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ exclude = ["pyramid_openapi3/tests/"]


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

openapi-core = ">=0.19.1"
pyramid = ">=1.10.7"
Expand Down
2 changes: 1 addition & 1 deletion pyramid_openapi3/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,4 @@ class MissingEndpointsError(Exception):
def __init__(self, missing: t.List[str]) -> None:
self.missing = missing
message = f"Unable to find routes for endpoints: {', '.join(missing)}"
super(MissingEndpointsError, self).__init__(message)
super().__init__(message)
2 changes: 1 addition & 1 deletion pyramid_openapi3/tests/test_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
]


class DummyDefaultContext(object): # noqa: D101
class DummyDefaultContext: # noqa: D101

__acl__ = DEFAULT_ACL

Expand Down
2 changes: 1 addition & 1 deletion pyramid_openapi3/tests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DummyRoute: # noqa: D101
pattern: str


class DummyStartResponse(object): # noqa: D101
class DummyStartResponse: # noqa: D101
def __call__(self, status: str, headerlist: t.List[t.Tuple[str, str]]) -> None:
"""WSGI start_response protocol."""
self.status = status
Expand Down
2 changes: 1 addition & 1 deletion pyramid_openapi3/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import typing as t


class DummyStartResponse(object): # noqa: D101
class DummyStartResponse: # noqa: D101
def __call__(self, status: str, headerlist: t.List[t.Tuple[str, str]]) -> None:
"""WSGI start_response protocol."""
self.status = status
Expand Down
10 changes: 5 additions & 5 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ let
python = pkgs.python312;
});

devEnv_39 = poetry2nix.mkPoetryEnv (commonPoetryArgs // {
python = pkgs.python39;
pyproject = ./py39/pyproject.toml;
poetrylock = ./py39/poetry.lock;
devEnv_310 = poetry2nix.mkPoetryEnv (commonPoetryArgs // {
python = pkgs.python310;
pyproject = ./py310/pyproject.toml;
poetrylock = ./py310/poetry.lock;
});

in
Expand All @@ -42,7 +42,7 @@ pkgs.mkShell {

buildInputs = with pkgs; [
devEnv_312
devEnv_39
devEnv_310
poetry
gitAndTools.pre-commit
nixpkgs-fmt
Expand Down