Skip to content

Commit

Permalink
feat: drop 3.7, add 3.12 (#850)
Browse files Browse the repository at this point in the history
* ci: update tests and precommit

* ci: bump ruff

* ci: update release workflow

* chore: bump fakeredis

* chore: bump types-chroniter

* ci: updates, pre-commit runs, etc

* chore: drop 3.7, update bandit

* ci: bump fastapi

* docs: update doc requirements
  • Loading branch information
andrewthetechie authored May 5, 2024
1 parent aa0f36c commit 67b8f08
Show file tree
Hide file tree
Showing 37 changed files with 1,320 additions and 1,760 deletions.
3 changes: 1 addition & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ updates:
directory: "/docs"
schedule:
interval: daily
commit-message:
commit-message:
prefix: docs
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
commit-message:
prefix: deps

8 changes: 3 additions & 5 deletions .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

pip==23.1.2
nox==2023.4.22
pip==24.0.0
nox==2024.4.15
nox-poetry==1.0.3
poetry==1.8.2
virtualenv==20.23.1
poetry-dynamic-versioning==0.24.0
virtualenv==20.26.1
toml==0.10.2
29 changes: 12 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,27 @@ jobs:
release:
name: Release
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pydantic-aioredis
permissions:
id-token: write
steps:
- name: Check out the repository
uses: actions/checkout@v4
uses: actions/checkout@v4.1.4
with:
fetch-depth: 2
- name: Set up Python
uses: actions/[email protected]
with:
python-version: "3.10"

- name: Upgrade pip
python-version: "3.11"
- name: Install pip and poetry
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip install --upgrade --constraint .github/workflows/constraints.txt pip poetry
pip --version
- name: Install Poetry
run: |
pip install --constraint=.github/workflows/constraints.txt poetry poetry-dynamic-versioning
poetry --version
- name: Build package
run: |
poetry build --ansi
- name: Publish package on PyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
poetry build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
98 changes: 11 additions & 87 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,14 @@ jobs:
fail-fast: false
matrix:
include:
- { python: "3.10", os: "ubuntu-latest", session: "pre-commit" }
- { python: "3.10", os: "ubuntu-latest", session: "safety" }
# - { python: "3.10", os: "ubuntu-latest", session: "mypy" }
# - { python: "3.9", os: "ubuntu-latest", session: "mypy" }
# - { python: "3.8", os: "ubuntu-latest", session: "mypy" }
# - { python: "3.7", os: "ubuntu-latest", session: "mypy" }
- { python: "3.10", os: "ubuntu-latest", session: "tests" }
- { python: "3.11", os: "ubuntu-latest", session: "pre-commit" }
- { python: "3.11", os: "ubuntu-latest", session: "safety" }
- { python: "3.12", os: "ubuntu-latest", session: "tests" }
- { python: "3.11", os: "ubuntu-latest", session: "tests" }
- { python: "3.10", os: "ubuntu-latest", session: "tests" }
- { python: "3.9", os: "ubuntu-latest", session: "tests" }
- { python: "3.8", os: "ubuntu-latest", session: "tests" }
- { python: "3.7", os: "ubuntu-latest", session: "tests" }
# - { python: "3.10", os: "windows-latest", session: "tests" }
# - { python: "3.10", os: "macos-latest", session: "tests" }
# - { python: "3.10", os: "ubuntu-latest", session: "typeguard" }
- { python: "3.10", os: "ubuntu-latest", session: "xdoctest" }
- { python: "3.10", os: "ubuntu-latest", session: "docs-build" }
- { python: "3.11", os: "ubuntu-latest", session: "docs-build" }

env:
NOXSESSION: ${{ matrix.session }}
Expand All @@ -42,30 +34,12 @@ jobs:
with:
python-version: ${{ matrix.python }}

- name: Upgrade pip
- name: Install needed tools
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip install --upgrade pip nox poetry virtualenv toml --constraint=.github/workflows/constraints.txt
pip --version
- name: Upgrade pip in virtual environments
shell: python
run: |
import os
import pip
with open(os.environ["GITHUB_ENV"], mode="a") as io:
print(f"VIRTUALENV_PIP={pip.__version__}", file=io)
- name: Install Poetry
run: |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry
poetry --version
- name: Install Nox
run: |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry
nox --version
# separate out nox-poetry until it gets a released version with support for 1.8
pip install --upgrade nox-poetry --constraint=.github/workflows/constraints.txt
- name: Compute pre-commit cache key
if: matrix.session == 'pre-commit'
Expand All @@ -80,12 +54,12 @@ jobs:
payload = sys.version.encode() + sys.executable.encode()
digest = hashlib.sha256(payload).hexdigest()
result = "${{ runner.os }}-{}-{}-pre-commit".format(python, digest[:8])
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
fh.write(f"result={result}\n")
- name: Restore pre-commit cache
uses: actions/cache@v3.0.5
uses: actions/cache@v4.0.2
if: matrix.session == 'pre-commit'
with:
path: ~/.cache/pre-commit
Expand All @@ -96,53 +70,3 @@ jobs:
- name: Run Nox
run: |
nox --force-color --python=${{ matrix.python }}
- name: Upload coverage data
if: always() && matrix.session == 'tests'
uses: "actions/[email protected]"
with:
name: coverage-data
path: ".coverage.*"

- name: Upload documentation
if: matrix.session == 'docs-build'
uses: actions/[email protected]
with:
name: docs
path: docs/_build

coverage:
runs-on: ubuntu-latest
needs: tests
steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/[email protected]
with:
python-version: "3.10"

- name: Upgrade pip
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip --version
- name: Install Poetry
run: |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry
poetry --version
- name: Install Nox
run: |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry
nox --version
- name: Download coverage data
uses: actions/[email protected]
with:
name: coverage-data

- name: Upload coverage report
uses: codecov/[email protected]
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ __pycache__/
examples/benchmarks/.benchmarks
examples/benchmarks/.coverage
.hypothesis
docs/_autosummary/*
53 changes: 27 additions & 26 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
exclude: ".*tests\/fixtures.*"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.4.3
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
- repo: https://github.com/rhysd/actionlint
rev: v1.6.27
hooks:
- id: actionlint-docker
name: Actionlint
- repo: local
hooks:
- id: black
name: black
entry: black
- id: bandit
name: bandit
entry: bandit
language: system
types: [python]
require_serial: true
args: ["-c", "pyproject.toml"]
- id: check-added-large-files
name: Check for added large files
entry: check-added-large-files
Expand All @@ -27,38 +50,16 @@ repos:
language: system
types: [text]
stages: [commit, push, manual]
- id: flake8
name: flake8
entry: flake8
language: system
types: [python]
exclude: "^(test/*|examples/*|noxfile.py)"
require_serial: true
args: ["--config=.flake8"]
- id: pyupgrade
name: pyupgrade
description: Automatically upgrade syntax for newer versions.
entry: pyupgrade
language: system
types: [python]
args: [--py37-plus]
- id: reorder-python-imports
name: Reorder python imports
entry: reorder-python-imports
language: system
types: [python]
args: [--application-directories=src]
args: [--py38-plus]
- id: trailing-whitespace
name: Trim Trailing Whitespace
entry: trailing-whitespace-fixer
language: system
types: [text]
stages: [commit, push, manual]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
- id: prettier
- repo: https://github.com/rhysd/actionlint
rev: v1.6.15
hooks:
- id: actionlint-docker
4 changes: 0 additions & 4 deletions docs/_autosummary/pydantic_aioredis.abstract.rst

This file was deleted.

47 changes: 0 additions & 47 deletions docs/_autosummary/pydantic_aioredis.config.RedisConfig.rst

This file was deleted.

22 changes: 0 additions & 22 deletions docs/_autosummary/pydantic_aioredis.config.rst

This file was deleted.

32 changes: 0 additions & 32 deletions docs/_autosummary/pydantic_aioredis.ext.FastAPI.rst

This file was deleted.

Loading

0 comments on commit 67b8f08

Please sign in to comment.