Skip to content

Commit b29c41f

Browse files
authored
Merge pull request #173 from python-odin/development
Release 2.11rc1
2 parents f57c27c + 1b78e99 commit b29c41f

43 files changed

Lines changed: 1511 additions & 1416 deletions

Some content is hidden

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

.github/workflows/manual-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818
- uses: actions/checkout@v2
1919

2020
- uses: actions/setup-python@master
21-
name: Setup Python 3.8
21+
name: Setup Python 3.12
2222
with:
23-
python-version: 3.8
23+
python-version: 3.12
2424

2525
- name: Install dependencies
2626
run: python -m pip install -U poetry

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
- uses: actions/checkout@v2
1616

1717
- uses: actions/setup-python@master
18-
name: Setup Python 3.8
18+
name: Setup Python 3.12
1919
with:
20-
python-version: 3.8
20+
python-version: 3.12
2121

2222
- name: Install dependencies
2323
run: python -m pip install -U poetry

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
strategy:
1212
fail-fast: true
1313
matrix:
14-
python-version: [3.8, 3.9, "3.10", "3.11"]
14+
python-version: ["3.10", "3.11", "3.12", "3.13"]
1515
experimental: [false]
1616
include:
17-
- python-version: "3.12-dev"
17+
- python-version: "3.14-dev"
1818
experimental: true
1919

2020
steps:
@@ -42,7 +42,7 @@ jobs:
4242
tests
4343
4444
- name: Analyze with SonarCloud
45-
uses: sonarsource/sonarcloud-github-action@master
45+
uses: sonarsource/sonarqube-scan-action@master
4646
env:
4747
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4848
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ default_language_version:
55
repos:
66
- repo: https://github.com/astral-sh/ruff-pre-commit
77
# Ruff version.
8-
rev: v0.2.1
8+
rev: v0.11.13
99
hooks:
1010
# Run the linter.
1111
- id: ruff

HISTORY

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
2.11rc1
2+
=======
3+
4+
Changes
5+
-------
6+
7+
- Redesign of the type to field resolution used in Annotated Resources. Updated to work with more modern typing
8+
9+
- Support the use of `int | None` or (`None | int`) instead of `Optional[int]`
10+
11+
- Support the use of `list[]`, `dict[]` subtypes
12+
13+
- Support the use of `my_field: Annotated[int, Options{}] = 42` style
14+
15+
- ResourceDefError now includes the field name that failed to be resolved.
16+
17+
- Removed the deprecated `utils.lazy_property` (replace with `functools.cached_property`)
18+
19+
- Update testing to cover Python 3.10, 3.11, 3.12 and 3.13
20+
21+
Bugfix
22+
------
23+
24+
- functools.partial can used when registering types for type resolution
25+
26+
- Options.validators now defaults to an empty list (caused an issue adding validators)
27+
28+
129
2.10
230
====
331

@@ -21,11 +49,10 @@ Changes
2149
ResourceObjects now includes a shadow_fields listing all fields shadowed by this
2250
resource.
2351

24-
2552
Bugfix
2653
------
2754

28-
- ResourceOptions.abstract flag was not being set for abstract AnnotatedResrouces.
55+
- ResourceOptions.abstract flag was not being set for abstract AnnotatedResources.
2956

3057

3158
2.9

docs/intro/annotated-resources.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ The annotated resource syntax offers many rich ways of representing your resourc
2121
class Book(odin.AnnotatedResource):
2222
title: str
2323
author: Author
24-
genre: Optional[str] = odin.Options(max_length=255)
25-
num_pages: int = odin.Options(min_value=1)
24+
genre: Annotated[str | None, odin.Options(max_length=255)]
25+
num_pages: Annotated[int, odin.Options(min_value=1)]
2626
2727
2828

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from nox.sessions import Session
33

44

5-
@nox.session(python=("3.8", "3.9", "3.10", "3.11"))
5+
@nox.session(python=("3.10", "3.11", "3.12", "3.13"))
66
def tests(session: Session):
77
# fmt: off
88
session.run(

poetry.lock

Lines changed: 657 additions & 563 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "odin"
7-
version = "2.10"
7+
version = "2.11rc1"
88
description = "Data-structure definition/validation/traversal, mapping and serialisation toolkit for Python"
99
authors = ["Tim Savage <tim@savage.company>"]
1010
license = "BSD-3-Clause"
@@ -21,9 +21,10 @@ classifiers = [
2121
"Topic :: Software Development :: Libraries :: Python Modules",
2222
"Programming Language :: Python",
2323
"Programming Language :: Python :: 3",
24-
"Programming Language :: Python :: 3.8",
25-
"Programming Language :: Python :: 3.9",
2624
"Programming Language :: Python :: 3.10",
25+
"Programming Language :: Python :: 3.11",
26+
"Programming Language :: Python :: 3.12",
27+
"Programming Language :: Python :: 3.13",
2728
"Programming Language :: Python :: Implementation :: CPython",
2829
"Programming Language :: Python :: Implementation :: PyPy",
2930
]
@@ -34,15 +35,15 @@ packages = [
3435
include = ["src/odin/py.typed"]
3536

3637
[tool.poetry.dependencies]
37-
python = "^3.8"
38+
python = "^3.10"
3839
pyyaml = {version = "*", optional = true }
3940
toml = {version = "*", optional = true }
4041
pint = {version = "*", optional = true }
4142
arrow = {version = "*", optional = true }
4243
msgpack = {version = "*", optional = true }
4344
rich = {version = "*", optional = true }
4445

45-
[tool.poetry.dev-dependencies]
46+
[tool.poetry.group.dev.dependencies]
4647
pytest = "^7.0"
4748
pytest-cov = "*"
4849
sphinx = "*"
@@ -60,8 +61,8 @@ rich = ["rich"]
6061
line-length = 88
6162
indent-width = 4
6263

63-
# Assume Python 3.8
64-
target-version = "py38"
64+
# Assume Python 3.10
65+
target-version = "py310"
6566

6667
[tool.ruff.lint]
6768
select = ["N", "F", "I", "UP", "PL", "A", "G", "S", "E", "SIM", "B"]
@@ -78,6 +79,9 @@ ignore = [
7879
"PLR2004", # Magic value used in comparison, ...
7980
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
8081
]
82+
"tests/annotated_resources/**.py" = [
83+
"UP", # Allow the use of older types
84+
]
8185

8286
[tool.ruff.lint.pycodestyle]
8387
max-line-length = 117

samples/sample.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: "Sample Pipeline"
2+
config: ""
3+
approach:
4+
$: org.odin.sample.DynamicApproach
5+
max: 10
6+
min: 1
7+
8+
processes:
9+
-
10+
$: org.odin.sample.Pipeline

0 commit comments

Comments
 (0)