Skip to content

Commit

Permalink
Drop Python 3.7 in favor of 3.11 and 3.12 (#1752)
Browse files Browse the repository at this point in the history
Python 3.7 is end of life. We should support the newer versions instead.

I also changed tox to only run against the minimum dependency versions
on the lowest Python version, since this should lead to the lowest
versions over all Python versions, and hopefully helps speed up our
pipelines :)
  • Loading branch information
RobbeSneyders authored Oct 23, 2023
1 parent 79fd9ed commit a210917
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion connexion/apps/flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _set_base_path(self, base_path: t.Optional[str] = None) -> None:
self._set_blueprint()

def _set_blueprint(self):
endpoint = flask_utils.flaskify_endpoint(self.base_path)
endpoint = flask_utils.flaskify_endpoint(self.base_path) or "/"
self.blueprint = flask.Blueprint(
endpoint,
__name__,
Expand Down
8 changes: 2 additions & 6 deletions connexion/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
starting point for developing your API with Connexion.
"""

import importlib.metadata
import logging
import sys
from os import path
Expand All @@ -13,11 +14,6 @@
import connexion
from connexion.mock import MockResolver

try:
import importlib_metadata
except ImportError:
import importlib.metadata as importlib_metadata # type: ignore

logger = logging.getLogger("connexion.cli")

FLASK_APP = "flask"
Expand All @@ -35,7 +31,7 @@
def print_version(ctx, param, value):
if not value or ctx.resilient_parsing:
return
click.echo(f"Connexion {importlib_metadata.version('connexion')}")
click.echo(f"Connexion {importlib.metadata.version('connexion')}")
ctx.exit()


Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Internet",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
Expand All @@ -44,11 +44,10 @@ classifiers = [
connexion = 'connexion.cli:main'

[tool.poetry.dependencies]
python = '^3.7'
python = '^3.8'
asgiref = ">= 3.4"
clickclick = ">= 1.2"
httpx = ">= 0.23"
importlib_metadata = { version = ">=6.0.0", python = "<3.8" }
inflection = ">= 0.3.1"
jsonschema = ">= 4.0.1"
Jinja2 = ">= 3.0.0"
Expand Down
8 changes: 1 addition & 7 deletions tests/decorators/test_parameter.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import sys
from unittest.mock import MagicMock

try:
from unittest.mock import AsyncMock
except ImportError:
# Python 3.7
AsyncMock = None
from unittest.mock import AsyncMock, MagicMock

import pytest
from connexion.decorators.parameter import (
Expand Down
2 changes: 1 addition & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_api():

def test_api_base_path_slash():
api = FlaskApi(TEST_FOLDER / "fixtures/simple/basepath-slash.yaml")
assert api.blueprint.name == ""
assert api.blueprint.name == "/"
assert api.blueprint.url_prefix == ""


Expand Down
10 changes: 6 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ extend-ignore=E203,RST303
[tox]
isolated_build = True
envlist =
{py37,py38,py39,py310}-{min,pypi}
py38-min
{py38,py39,py310,py311,py312}-pypi
pre-commit

[gh-actions]
python =
3.7: py37-min,py37-pypi
3.8: py38-min,py38-pypi
3.9: py39-min,py39-pypi
3.10: py310-min,py310-pypi,pre-commit
3.9: py39-pypi
3.10: py310-pypi
3.11: py311-pypi,pre-commit
3.12: py312-pypi

[testenv]
setenv=PYTHONPATH = {toxinidir}:{toxinidir}
Expand Down

0 comments on commit a210917

Please sign in to comment.