Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintenance: Upgrade to recent versions of pydantic #58

Merged
merged 11 commits into from
Apr 7, 2024
Merged
38 changes: 19 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
name: CI
name: Publish package on pypi

on:
pull_request:
push:
branches: [master]

jobs:
test-and-publish-flow:
publish-flow:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Check out repository
uses: actions/checkout@v4

- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.11
python-version: 3.12

- name: Run Poetry image
uses: abatilo/actions-poetry@v2
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: 1.5.0
poetry-version: 1.7.1

- name: Install library
run: poetry install --no-interaction

- name: Run tests
run: poetry run pytest

# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v3
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

# publish version only when pyproject.toml is changed in master
# publish version only when pyproject.toml is changed in master
- name: Filter changes in pyproject
uses: dorny/paths-filter@v2
id: changes
Expand All @@ -40,8 +39,9 @@ jobs:
- 'pyproject.toml'

- if: ${{ (github.ref == 'refs/heads/master') && (steps.changes.outputs.root == 'true')}}
name: Build and publish
env:
PYPI_USER: ${{ secrets.PYPI_USER }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: poetry publish --username $PYPI_USER --password $PYPI_PASSWORD --build
name: Build
run: poetry build

- if: ${{ (github.ref == 'refs/heads/master') && (steps.changes.outputs.root == 'true')}}
name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
37 changes: 37 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Tests on PRs

on:
pull_request:

jobs:
test-flow:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
pull-requests: write
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.12

- name: Run Poetry image
uses: abatilo/[email protected]
with:
poetry-version: 1.7.1

- name: Install library
run: poetry install --no-interaction

- name: Run tests
run: poetry run pytest --cov-report xml:coverage.xml

- name: Get Cover
uses: orgoro/[email protected]
with:
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
38 changes: 16 additions & 22 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,41 @@
minimum_pre_commit_version: "2.10.0"
minimum_pre_commit_version: "3.0.4"
exclude: >
(?x)^(
.*\.svg
)$
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
rev: v0.3.5
hooks:
- id: ruff
args:
- --fix
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
args:
- --dont-order-by-type
- repo: https://github.com/psf/black
rev: "24.1.1"
hooks:
- id: black
name: Format code (black)
- repo: https://github.com/pre-commit/pre-commit-hooks
- id: ruff-format

- repo: "https://github.com/pre-commit/pre-commit-hooks"
rev: "v4.5.0"
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-json
- id: check-toml
- id: check-yaml
- id: "end-of-file-fixer"
- id: "trailing-whitespace"
- id: "check-json"
- id: "check-toml"
- id: "check-yaml"

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
rev: "v4.0.0-alpha.8"
hooks:
- id: prettier
types_or: [css, yaml, markdown, json]
- repo: "https://github.com/pre-commit/mirrors-mypy"
rev: "v1.8.0"
rev: "v1.9.0"
hooks:
- id: "mypy"
name: "Check type hints (mypy)"
verbose: true
additional_dependencies:
- types-python-slugify
- types-PyYAML
- pydantic==2.6.3
ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.10.0] - πŸ“¦ Migrate to pydantic v2 - 2024-04-07

Move to recent versions of `pydantic`, and also upgrade internal _linters_, moving to `ruff-format`

##### Changes

- πŸ“¦οΈ env: Bump version and upgrade deps, requiring `pydantic` v2
- ♻️ **Migrate pydantic v2 syntax** for validators, parsers, serializers, model load/dump methods, etc.
- 🎨 lint: pre-commit update, moving to `ruff-format`
- 🎨 lint: Apply format changes and lint fixes
- πŸ“ Update CHANGELOG
- πŸ‘· ci: Split actions for tests on PRs and publish package on main

## [0.9.3] - ✨ Add customizable annotations - 2023-09-30

From @tadashiorigami in #44, thanks!
Expand Down
Loading
Loading