Skip to content

Commit

Permalink
Add support to Python 3.12 (#431)
Browse files Browse the repository at this point in the history
* Drop support to Python 3.7
* Bump Flask version to >=3.0.0
* Bump several dependencies versions
* Migrate configuration to pyproject.toml
* Remove flask_jsonrpc.__version__ attribute in favor to pyproject.toml version attribute

Resolve: #430
  • Loading branch information
nycholas authored Jan 18, 2024
1 parent a1fd76c commit 98a3aec
Show file tree
Hide file tree
Showing 57 changed files with 1,840 additions and 585 deletions.
29 changes: 0 additions & 29 deletions .coveragerc

This file was deleted.

17 changes: 17 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "cenobites/flask-jsonrpc",
"image": "mcr.microsoft.com/devcontainers/python:3",
"customizations": {
"vscode": {
"settings": {
"python.defaultInterpreterPath": "${workspaceFolder}/.venv",
"python.terminal.activateEnvInCurrentTerminal": true,
"python.terminal.launchArgs": [
"-X",
"dev"
]
}
}
},
"onCreateCommand": ".devcontainer/on-create-command.sh"
}
9 changes: 9 additions & 0 deletions .devcontainer/on-create-command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -e

python3 -m venv .venv
. .venv/bin/activate
pip install -U pip
pip install -r requirements/local.txt
pip install -e .
pre-commit install --install-hooks
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120
quote_type = single

[Makefile]
indent_style = tab
Expand Down
18 changes: 15 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/requirements"
- package-ecosystem: github-actions
directory: /
schedule:
interval: "daily"
interval: monthly
groups:
github-actions:
patterns:
- '*'
- package-ecosystem: pip
directory: /requirements
schedule:
interval: daily
groups:
python-requirements:
patterns:
- '*'
2 changes: 1 addition & 1 deletion .github/workflows/codeql_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
if: ${{ matrix.language == 'python' }}
uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.12'
- name: Build Application using script
if: ${{ matrix.language == 'python' }}
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/on_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
matrix:
platform:
- ubuntu-latest
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v3
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
matrix:
platform:
- ubuntu-latest
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v3
Expand All @@ -72,7 +72,7 @@ jobs:
matrix:
platform:
- ubuntu-latest
python-version: ["3.11"]
python-version: ["3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v3
Expand All @@ -87,4 +87,4 @@ jobs:
python -m pip install --upgrade pip tox
- name: Run tox
run: |
tox -e py,py-async,style,typing,security,docs
tox -e py,py-async,style,typing,pytype,security,docs
28 changes: 15 additions & 13 deletions .github/workflows/pre_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- release/**

permissions:
contents: read
Expand All @@ -17,7 +18,7 @@ jobs:
matrix:
platform:
- ubuntu-latest
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v3
Expand Down Expand Up @@ -49,7 +50,7 @@ jobs:
matrix:
platform:
- ubuntu-latest
python-version: ["3.10"]
python-version: ["3.11"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v3
Expand Down Expand Up @@ -78,7 +79,7 @@ jobs:
matrix:
platform:
- ubuntu-latest
python-version: ["3.11"]
python-version: ["3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v3
Expand Down Expand Up @@ -107,7 +108,7 @@ jobs:
matrix:
platform:
- ubuntu-latest
python-version: ["3.11"]
python-version: ["3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v3
Expand All @@ -129,7 +130,7 @@ jobs:
bandit -r src/
- name: Check dependencies for known security vulnerabilities with Safety
run: |
safety check -i 52495 -i 51457
safety check
test:
name: Test
Expand All @@ -142,7 +143,7 @@ jobs:
- ubuntu-latest
- macos-latest
- windows-latest
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v3
Expand All @@ -163,7 +164,7 @@ jobs:
run: |
py.test
- name: Upload coverage JUint report
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.11' }}
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.12' }}
uses: actions/upload-artifact@v3
with:
name: test-n-coverage-report
Expand All @@ -181,7 +182,7 @@ jobs:
matrix:
platform:
- ubuntu-latest
python-version: ["3.11"]
python-version: ["3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v3
Expand All @@ -204,8 +205,9 @@ jobs:
- name: Send coverage stats to Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
coveralls --service=github
coveralls
build:
name: Build source
Expand All @@ -218,7 +220,7 @@ jobs:
- ubuntu-latest
- macos-latest
- windows-latest
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v3
Expand All @@ -233,12 +235,12 @@ jobs:
python -m pip install --upgrade pip setuptools build
python -m build --outdir dist-${{ matrix.platform }}-${{ matrix.python-version }}
- name: Tar build and wheel distributions files
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.11' }}
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.12' }}
run: |
mv dist-${{ matrix.platform }}-${{ matrix.python-version }} dist
tar -cvf dist.tar dist
- name: Upload build and wheel distributions files
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.11' }}
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.12' }}
uses: actions/upload-artifact@v3
with:
name: pre-release-build
Expand All @@ -255,7 +257,7 @@ jobs:
matrix:
platform:
- ubuntu-latest
python-version: ["3.11"]
python-version: ["3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
matrix:
platform:
- ubuntu-latest
python-version: ["3.11"]
python-version: ["3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v3
Expand Down
27 changes: 14 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ exclude: '.git|.tox|.venv|.vscode|__pycache__|.pytest_cache|.eggs|.mypy_cache|.p
default_stages: [commit]
fail_fast: true
default_language_version:
python: python3.11
python: python3.12
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-byte-order-marker
- id: check-case-conflict
Expand All @@ -17,37 +17,38 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
rev: v3.15.0
hooks:
- id: pyupgrade
args: ['--py37-plus']
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.12.1
hooks:
- id: black
args: ['--safe']
- repo: https://github.com/asottile/blacken-docs
rev: 1.13.0
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies:
- black==23.3.0
- black==23.12.1
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies:
- flake8-isort==6.0.0
- flake8-bugbear==23.3.23
- flake8-pyi==23.3.1
- flake8-isort==6.1.1
- flake8-bugbear==24.1.17
- flake8-pyi==24.1.0
- flake8-quotes==3.3.2
- flake8-implicit-str-concat==0.4.0
args: ['--config=setup.cfg']
- flake8-pyproject==1.2.3
args: ['--toml-config=pyproject.toml']
- repo: https://github.com/PyCQA/pylint
rev: v2.17.1
rev: v3.0.3
hooks:
- id: pylint
6 changes: 5 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
version: 2
build:
os: ubuntu-22.04
tools:
python: '3.12'
python:
install:
- requirements: requirements/docs.txt
- method: pip
path: .
sphinx:
builder: htmldoc
builder: dirhtml
fail_on_warning: true
6 changes: 3 additions & 3 deletions Dockerfile.it
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11-alpine as builder
FROM python:3.12-alpine as builder

RUN apk add --no-cache --update --virtual .build-deps \
build-base \
Expand All @@ -18,7 +18,7 @@ RUN pip install pip setuptools wheel --upgrade \
&& pip wheel --wheel-dir=/svc/wheels -r test.txt \
poetry-core>=1.0.0

FROM python:3.11-alpine
FROM python:3.12-alpine

ENV PYTHONUNBUFFERED=1 \
DEBUG=0 \
Expand Down Expand Up @@ -56,7 +56,7 @@ WORKDIR /app
ARG VERSION=1
RUN echo "Version: ${VERSION}"

COPY .docker/* requirements/test.txt tests/test_apps/*.py tests/test_apps/*.ini /app/
COPY .docker/* requirements/test.txt tests/integration/*.py tests/integration/*.ini /app/

RUN pip install pip setuptools wheel --upgrade \
&& pip install --no-index --find-links=/svc/wheels -r test.txt \
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.local
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11-alpine as builder
FROM python:3.12-alpine as builder

RUN apk add --no-cache --update --virtual .build-deps \
build-base \
Expand All @@ -23,7 +23,7 @@ RUN pip install pip setuptools wheel --upgrade \
&& [[ ${FLASK_ASYNC} = 1 ]] && PROJECT_PATH=".[async]" || PROJECT_PATH="." \
&& pip wheel --wheel-dir=/svc/wheels -e ${PROJECT_PATH}

FROM python:3.11-alpine
FROM python:3.12-alpine

ENV PYTHONUNBUFFERED=1 \
DEBUG=0 \
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile.py310.test
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ RUN set -ex \
&& pip install -r requirements/base.txt \
&& pip install -r requirements/test.txt \
poetry-core>=1.0.0 \
&& cat requirements/ci.txt | grep -wv ^mypy | grep -vw ^pytype > requirements/ci-updated.txt \
&& pip install -r requirements/ci-updated.txt \
&& pip install -r requirements/ci.txt \
&& apk del .build-deps \
&& addgroup -S kuchulu \
&& adduser \
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile.py311.test
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ RUN set -ex \
&& pip install -r requirements/base.txt \
&& pip install -r requirements/test.txt \
poetry-core>=1.0.0 \
&& cat requirements/ci.txt | grep -wv ^mypy | grep -vw ^pytype > requirements/ci-updated.txt \
&& pip install -r requirements/ci-updated.txt \
&& pip install -r requirements/ci.txt \
&& apk del .build-deps \
&& addgroup -S kuchulu \
&& adduser \
Expand Down
Loading

0 comments on commit 98a3aec

Please sign in to comment.