Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
koxudaxi authored Feb 1, 2025
2 parents 725775c + 4f45637 commit d97248f
Show file tree
Hide file tree
Showing 13 changed files with 721 additions and 363 deletions.
140 changes: 46 additions & 94 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,116 +9,68 @@ on:

jobs:
test:
name: Test ${{ matrix.python-version }}@${{ matrix.os }} with isort ${{ matrix.isort-version }}, pydantic ${{ matrix.pydantic-version }}, black ${{ matrix.black-version }}
runs-on: ${{ matrix.os }}
name: >-
Test ${{ matrix.py }}
${{ matrix.os == 'windows-latest' && 'Windows' || (matrix.os == 'macos-latest' && 'macOS' || 'Ubuntu') }}
${{ matrix.isort != '' && format('isort={0} ', matrix.isort) || ''}}
${{ matrix.black != '' && format('black={0} ', matrix.black) || ''}}
${{ matrix.pydantic != '' && format('pydantic={0} ', matrix.pydantic) || ''}}
strategy:
fail-fast: false
matrix:
python-version: ["3.13", "3.12", "3.11", "3.10", "3.9", "3.8"]
py: ["3.13", "3.12", "3.11", "3.10", "3.9", "3.8"]
os: [ubuntu-24.04, windows-latest, macos-latest]
isort-version: [4.3.21, 5.6.4, default]
black-version: [default]
pydantic-version: [1.10.9, 2.10.3]
isort: [''] # '' mean not set, aka use the default
black: ['']
pydantic: ['']
include:
- os: ubuntu-24.04
isort-version: 4.3.21
black-version: default
python-version: 3.8
pydantic-version: 1.5.1
- os: ubuntu-24.04
isort-version: 5.6.4
black-version: default
python-version: 3.8
pydantic-version: 1.8.2
- os: ubuntu-24.04
isort-version: 5.6.4
black-version: 19.10b0
python-version: 3.9
pydantic-version: 1.8.2
- os: ubuntu-24.04
isort-version: 5.6.4
black-version: 24.1.0
python-version: 3.12
pydantic-version: 2.4.2
- os: ubuntu-24.04
isort-version: 5.6.4
black-version: 23.12.1
python-version: 3.12
pydantic-version: 2.4.2
- os: ubuntu-24.04
isort-version: 5.6.4
black-version: 22.1.0
python-version: 3.12
pydantic-version: 2.4.2
exclude:
- isort-version: 4.3.21
- isort-version: 5.6.4
- os: windows-latest
black-version: 22.1.0
- os: macos-latest
black-version: 22.1.0
- os: windows-latest
pydantic-version: 1.10.9
- os: macos-latest
pydantic-version: 1.10.9
- os: windows-latest
python-version: 3.8
- os: macos-latest
python-version: 3.8
- os: windows-latest
python-version: 3.9
- os: macos-latest
python-version: 3.9
- os: windows-latest
python-version: 3.10
- os: macos-latest
python-version: 3.10
- os: windows-latest
python-version: 3.11
- os: macos-latest
python-version: 3.11
- os: windows-latest
python-version: 3.12
- os: macos-latest
python-version: 3.12
- os: macos-latest
isort-version: 4.3.21
- isort-version: 5.6.4
pydantic-version: 1.10.9
defaults:
run:
shell: bash
- py: 3.12
black: 24.1.0
- py: 3.12
black: 23.12.1
- py: 3.12
black: 22.1.0
- py: 3.9
black: 19.10b0
pydantic: 1.8.2
- py: 3.8
pydantic: 1.8.2
- py: 3.8
isort: 4.3.21
pydantic: 1.5.1
runs-on: ${{ matrix.os == '' && 'ubuntu-24.04' || matrix.os }}
env:
OS: ${{ matrix.os }}
OS: ${{ matrix.os == '' && 'ubuntu-24.04' || matrix.os}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync
- name: Install isort ${{ matrix.isort-version }} for Linux/macOS
if: "runner.os != 'Windows' && matrix.isort-version != 'default'"
run: uv pip install isort==${{ matrix.isort-version }}
- name: Install Pydantic ${{ matrix.pydantic-version }}
if: matrix.pydantic-version != 'default'
run: uv pip install pydantic=="${{ matrix.pydantic-version }}"
- name: Install Black ${{ matrix.black-version }}
if: matrix.black-version != 'default'
run: uv pip install black=="${{ matrix.black-version }}"
- name: Lint
if: matrix.pydantic-version == 'default'
run: ./scripts/lint.sh
- name: Unit Test
run: ./scripts/test.sh
python-version: ${{ matrix.py }}
- name: Install tox
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv
- name: Setup Python test environment
run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.py }}
- name: Install custom package versions
if: ${{ matrix.isort != '' || matrix.black != '' || matrix.pydantic != ''}}
run: >-
tox exec --no-list-dependencies --skip-pkg-install -e ${{ matrix.py }} -- uv pip install
${{ matrix.isort != '' && format('isort=={0} ', matrix.isort) || ''}}
${{ matrix.black != '' && format('black=={0} ', matrix.black) || ''}}
${{ matrix.pydantic != '' && format('pydantic=={0} ', matrix.pydantic) || ''}}
- name: Run test suite
run: tox run --skip-pkg-install -e ${{ matrix.py }}
env:
COVERAGE_XML: ./coverage.xml
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-24.04'
if: matrix.os == 'ubuntu-24.04' || matrix.os == ''
uses: codecov/codecov-action@v5
with:
flags: unittests
files: ./coverage.xml
fail_ci_if_error: true
env_vars: OS,PYTHON,ISORT
env_vars: OS,PY,ISORT
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
179 changes: 2 additions & 177 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,179 +1,4 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
.*_cache
__pycache__
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
.envrc

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/


# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

.idea

.vscode
22 changes: 16 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
repos:
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.31.1
hooks:
- id: check-github-workflows
args: [ "--verbose" ]
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: "1.5.0"
hooks:
- id: tox-ini-fmt
args: ["-p", "fix"]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.5.0
hooks:
- id: pyproject-fmt
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.9.1'
rev: 'v0.9.4'
hooks:
- id: ruff
files: "^datamodel_code_generator|^tests"
Expand All @@ -11,13 +25,9 @@ repos:
exclude: "^tests/data"
- repo: https://github.com/codespell-project/codespell
# Configuration for codespell is in pyproject.toml
rev: v2.3.0
rev: v2.4.1
hooks:
- id: codespell
additional_dependencies:
- tomli
exclude: "^tests/|^CODE_OF_CONDUCT.md"
- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.5.0
hooks:
- id: pyproject-fmt
Loading

0 comments on commit d97248f

Please sign in to comment.