Skip to content

Commit 699c36d

Browse files
Upgraded project and dependencies (#42)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent a561c0a commit 699c36d

File tree

159 files changed

+1268
-991
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+1268
-991
lines changed

.flake8

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,11 @@ per-file-ignores =
3131
# F405: 'name' may be undefined, or defined from star imports: 'module'
3232
src/pydiamond/__init__.py:F401
3333
src/pydiamond/*/__init__.py:F401,F403,F405
34+
.github/*.py:DALL001
35+
tests/*.py:DALL001
3436
#### Stub errors ignore ####
3537
# E301,E302: expected 1/2 blank line(s)
3638
# E701: multiple statements on one line
3739
# F821: undefined name (useless for stub files)
3840
src/pydiamond/__init__.pyi:F401
3941
*.pyi:E301,E302,E701,F821
40-
41-
42-
[flake8:local-plugins]
43-
extension =
44-
DAL = flake8_extensions.dunder_all:DunderAll
45-
paths =
46-
./devtools/linting

.github/actions/pdm.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This file is loaded in runner environment by:
2+
# - setup-tox
3+
4+
PDM_VERSION=2.22.3
5+
PDM_CHECK_UPDATE=False
6+
WORKFLOW_CACHE_KEY_FILE=.github/.workflow.cache.key

.github/actions/setup-tox/action.yml

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,58 @@
11
name: 'Setup tox'
22
description: 'Install tox and restore cache'
3-
outputs:
4-
cache-hit:
5-
description: 'A boolean value to indicate an exact match was found.'
6-
value: ${{ steps.cache.outputs.cache-hit }}
3+
inputs:
4+
python-version:
5+
description: "Version range or exact version of Python or PyPy to use, using SemVer's version range syntax."
6+
required: false
7+
default: '3.x'
78

89
runs:
910
using: 'composite'
1011
steps:
11-
- name: Compile requirements
12-
run: python -m devtools --no-venv repo --no-sync
12+
- name: Load PDM configuration from pdm.conf
13+
uses: cardinalby/export-env-action@v2
14+
with:
15+
envFile: .github/actions/pdm.conf
16+
- name: Create cache key from workflow
17+
run: |
18+
echo "Runner=${{ runner.os }}-${{ runner.arch }}; Workflow=${{ github.workflow }}/${{ github.job }}" > $WORKFLOW_CACHE_KEY_FILE
19+
echo "Workflow Cache Version: $CACHE_CONFIGURATION_VERSION" >> $WORKFLOW_CACHE_KEY_FILE
20+
env:
21+
# Increment the version each time the uploaded cache must be invalidated
22+
# because the data stored have changed.
23+
# - 1.0: Initial
24+
CACHE_CONFIGURATION_VERSION: '1.0'
25+
shell: bash
26+
- name: Show cache key
27+
run: cat ${{ env.WORKFLOW_CACHE_KEY_FILE }}
1328
shell: bash
29+
- name: Install PDM
30+
uses: pdm-project/[email protected]
31+
id: pdm
32+
with:
33+
version: ${{ env.PDM_VERSION }}
34+
python-version: ${{ inputs.python-version }}
35+
cache: true
36+
cache-restore-exact-match: true
37+
cache-dependency-path: |
38+
./pdm.lock
39+
${{ env.WORKFLOW_CACHE_KEY_FILE }}
1440
- name: Install dependencies
15-
run: pip install tox -c requirements-dev.txt
41+
run: |
42+
pdm install --verbose --frozen-lockfile --global --project=. --no-self --no-default --dev --group=tox
43+
tox --version
44+
ls -lA
45+
env:
46+
PDM_USE_VENV: False
1647
shell: bash
17-
- name: Get python info
18-
id: python
19-
run: echo "checksum=$(python -VV | (sha256sum || shasum -a 256) | awk '{ print $1 }')" >> $GITHUB_OUTPUT
48+
- name: Disable tox parallel spinner by default
49+
run: echo "TOX_PARALLEL_NO_SPINNER=1" >> $GITHUB_ENV
2050
shell: bash
21-
- name: Restore tox environment
22-
id: cache
23-
uses: actions/cache@v3
51+
- name: Cache .tox
52+
uses: actions/cache@v4
2453
with:
54+
key: tox-${{ runner.os }}-${{ runner.arch }}-python-${{ env.PYTHON_VERSION }}-${{ env.KEY_HASH }}
2555
path: .tox
26-
key: tox|${{ runner.os }}|${{ github.workflow }}|${{ github.job }}|${{ steps.python.outputs.checksum }}|${{ hashFiles( 'tox.ini' , 'requirements*.txt') }}
56+
env:
57+
PYTHON_VERSION: ${{ steps.pdm.outputs.python-version }}
58+
KEY_HASH: ${{ hashFiles('./pdm.lock', './tox.ini', env.WORKFLOW_CACHE_KEY_FILE ) }}

.github/scripts/rewrite_bumpversion_cfg.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python3
2-
# -*- coding: Utf-8 -*-
32

43
from __future__ import annotations
54

@@ -26,13 +25,13 @@ def rewrite_bumpversion_cfg(filepath: str, *, dry_run: bool = False) -> None:
2625

2726
major, minor = map(str, version_match.group("major", "minor"))
2827

29-
config.set("bumpversion", "parse", r"{major}\.{minor}\.(?P<patch>\d+)".format(major=major, minor=minor))
28+
config.set("bumpversion", "parse", fr"{major}\.{minor}\.(?P<patch>\d+)")
3029
config.set("bumpversion", "serialize", f"{major}.{minor}.{{patch}}")
3130

3231
for section in filter(BUMPVERSION_PART_SECTION_PATTERN.match, config.sections()):
3332
config.remove_section(section)
3433

35-
with (open(filepath, "wt") if not dry_run else nullcontext(sys.stdout)) as output: # type: ignore[attr-defined]
34+
with (open(filepath, "w") if not dry_run else nullcontext(sys.stdout)) as output:
3635
config.write(output)
3736

3837

.github/workflows/build.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,24 +66,15 @@ concurrency:
6666
jobs:
6767
build:
6868
if: github.event_name != 'push' || !startsWith(github.event.head_commit.message, 'Bump version:')
69-
runs-on: ubuntu-20.04
69+
runs-on: ubuntu-24.04
7070
env:
7171
SOURCE_DATE_EPOCH: ${{ inputs.SOURCE_DATE_EPOCH }}
7272
steps:
7373
- uses: actions/checkout@v4
74-
with:
75-
submodules: true
76-
- uses: actions/setup-python@v5
77-
with:
78-
python-version: '3.10'
7974
- name: Setup tox
8075
uses: ./.github/actions/setup-tox
81-
- name: Check source distribution consistency
82-
if: github.event_name != 'workflow_call'
83-
run: tox run -e check-build-sdist
84-
- name: Post-check cleanup
85-
if: always()
86-
run: rm -rf .tox/check-build-sdist
76+
with:
77+
python-version: '3.13'
8778
- name: Compute SOURCE_DATE_EPOCH from commit date
8879
if: env.SOURCE_DATE_EPOCH == ''
8980
run: |

.github/workflows/lint.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,15 @@ jobs:
4242
strategy:
4343
fail-fast: false
4444
matrix:
45-
os: [ubuntu-20.04, windows-2022, macos-12]
45+
os: [ubuntu-24.04, windows-2022, macos-14]
4646

4747
steps:
4848
- uses: actions/checkout@v4
4949
with:
5050
submodules: true
51-
- uses: actions/setup-python@v5
52-
id: setup-python
53-
with:
54-
python-version: '3.10'
5551
- name: Setup tox
5652
uses: ./.github/actions/setup-tox
53+
with:
54+
python-version: '3.13'
5755
- name: Launch checks
58-
run: tox run -e mypy
56+
run: tox run -f mypy

.github/workflows/test.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,18 @@ jobs:
4646
strategy:
4747
fail-fast: false
4848
matrix:
49-
os: [ubuntu-20.04, windows-2022, macos-12]
50-
python_version: ['3.10']
49+
os: [ubuntu-24.04, windows-2022, macos-14]
50+
python_version: ['3.13']
51+
include:
52+
- python_version: '3.13'
53+
tox_py: py313
5154

5255
steps:
5356
- uses: actions/checkout@v4
54-
with:
55-
submodules: true
56-
- name: Setup Python ${{ matrix.python_version }}
57-
id: setup-python
58-
uses: actions/setup-python@v5
59-
with:
60-
python-version: ${{ matrix.python_version }}
6157
- name: Setup tox
6258
uses: ./.github/actions/setup-tox
59+
with:
60+
python-version: ${{ matrix.python_version }}
6361
- name: Launch tests
64-
run: tox run -f py$(echo ${{ matrix.python_version }} | tr -d .)
62+
timeout-minutes: 20
63+
run: tox run -f ${{ matrix.tox_py }}

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
.vscode/*
33
!.vscode/settings.example.json
44

5-
# Compiled requirements
6-
requirements*.txt
5+
# Github Actions
6+
.github/.*.key
7+
.github/requirements*.txt
78

89
# Byte-compiled / optimized / DLL files
910
__pycache__/
1011
*.py[cod]
1112
*$py.class
1213

14+
# pdm
15+
.pdm-python
16+
1317
# C extensions
1418
*.so
1519

.gitmodules

Lines changed: 0 additions & 4 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,51 @@
11
default_language_version:
2-
python: python3.10
2+
python: python3.13
33
minimum_pre_commit_version: '2.20.0'
44

55
ci:
6-
skip: [mypy]
7-
submodules: true
86
autoupdate_schedule: 'quarterly'
97

108
repos:
11-
- repo: local
9+
- repo: https://github.com/asottile/pyupgrade
10+
rev: v3.19.1
1211
hooks:
13-
- id: mypy
14-
name: mypy (project + examples)
15-
entry: tox run -q -e mypy -- src demo.py
16-
language: system
17-
files: ^(src/|demo\.py)
18-
types_or: [python, pyi]
19-
require_serial: true
20-
pass_filenames: false
21-
- id: mypy
22-
name: mypy (tests)
23-
files: ^((src|tests)/)
24-
entry: tox run -q -e mypy -- tests
25-
language: system
26-
types_or: [python, pyi]
27-
require_serial: true
28-
pass_filenames: false
12+
- id: pyupgrade
13+
args: ['--py313-plus']
2914
- repo: https://github.com/PyCQA/isort
30-
rev: '6.0.0' # Keep in sync with requirements-dev.txt
15+
rev: '6.0.0'
3116
hooks:
3217
- id: isort
3318
exclude: ^(devtools|demo_resources|\.github)/
3419
args: ['--filter-files', '--settings-file', 'pyproject.toml']
3520
- repo: https://github.com/psf/black
36-
rev: '25.1.0' # Keep in sync with requirements-dev.txt
21+
rev: '25.1.0'
3722
hooks:
3823
- id: black
3924
exclude: ^(devtools|demo_resources|\.github)/
4025
args: ['--config', 'pyproject.toml']
4126
- repo: https://github.com/PyCQA/flake8
42-
rev: '7.1.1' # Keep in sync with requirements-dev.txt
27+
rev: '7.1.1'
4328
hooks:
4429
- id: flake8
4530
exclude: ^(devtools|demo_resources|\.github)/
4631
args: ['--config', '.flake8']
4732
types: [] # Overwrite with empty in order to fallback to types_or
4833
types_or: [python, pyi]
49-
additional_dependencies: [ # keep in sync with requirements/requirement-dev.in
34+
additional_dependencies: [
5035
flake8-pyi>=22.11.0,
36+
'git+https://github.com/francis-clairicia/[email protected]',
5137
]
5238
- repo: https://github.com/aio-libs/sort-all
5339
rev: 'v1.3.0'
5440
hooks:
5541
- id: sort-all
56-
exclude: ^(devtools|demo_resources|\.github)/
42+
exclude: ^(demo_resources|\.github)/
5743
types: [] # Overwrite with empty in order to fallback to types_or
5844
types_or: [python, pyi]
45+
- repo: https://github.com/pdm-project/pdm
46+
rev: '2.22.3'
47+
hooks:
48+
- id: pdm-lock-check
5949
- repo: https://github.com/pre-commit/pre-commit-hooks
6050
rev: 'v5.0.0'
6151
hooks:

0 commit comments

Comments
 (0)