Skip to content

Commit 6e115c7

Browse files
authored
Merge pull request #150 from python-odin/development
Release 2.8
2 parents 278c5da + 6037fda commit 6e115c7

File tree

88 files changed

+1174
-897
lines changed

Some content is hidden

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

88 files changed

+1174
-897
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
python-version: [3.8, 3.9, "3.10", "3.11"]
1515
experimental: [false]
1616
include:
17-
- python-version: "3.11-dev"
17+
- python-version: "3.12-dev"
1818
experimental: true
1919

2020
steps:

.pre-commit-config.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
default_language_version:
4+
python: python3.10
5+
repos:
6+
#- repo: https://github.com/pre-commit/pre-commit-hooks
7+
# rev: v4.4.0
8+
# hooks:
9+
# - id: check-added-large-files
10+
# - id: check-toml
11+
# - id: check-yaml
12+
# args:
13+
# - --unsafe
14+
# - id: end-of-file-fixer
15+
# - id: trailing-whitespace
16+
- repo: https://github.com/asottile/pyupgrade
17+
rev: v3.3.1
18+
hooks:
19+
- id: pyupgrade
20+
args:
21+
- --py38-plus
22+
- --keep-runtime-typing
23+
- repo: https://github.com/charliermarsh/ruff-pre-commit
24+
rev: v0.0.270
25+
hooks:
26+
- id: ruff
27+
args:
28+
- --fix
29+
- --exit-non-zero-on-fix
30+
- repo: https://github.com/pycqa/isort
31+
rev: 5.12.0
32+
hooks:
33+
- id: isort
34+
name: isort (python)
35+
- id: isort
36+
name: isort (cython)
37+
types: [cython]
38+
- id: isort
39+
name: isort (pyi)
40+
types: [pyi]
41+
- repo: https://github.com/psf/black
42+
rev: 23.1.0
43+
hooks:
44+
- id: black

HISTORY

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
2.8
2+
===
3+
4+
Changes
5+
-------
6+
7+
- Change behaviour of create_resource_from_dict to not raise Validation errors
8+
from ``field.to_python`` when ``full_clean`` is ``False``.
9+
10+
Allows for invalid documents to still be loaded with invalid data to allow
11+
for correction of data and to prevent data loss.
12+
13+
- Introduce Pre-commit, PyUpgrade, isort, ruff and black.
14+
15+
16+
2.7
17+
===
18+
19+
Bug fixes
20+
---------
21+
22+
- TypedDictField now includes a prepare method to ensure types are cast correctly for serailisation.
23+
24+
125
2.6
226
===
327

docs/conf.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
#
32
# Odin documentation build configuration file, created by
43
# sphinx-quickstart on Tue Aug 20 18:57:24 2013.
@@ -11,8 +10,8 @@
1110
# All configuration values have a default; values that are commented out
1211
# serve to show the default.
1312

14-
import sys
1513
import os
14+
import sys
1615

1716
HERE = os.path.dirname(__file__)
1817

@@ -53,8 +52,8 @@
5352
master_doc = "contents"
5453

5554
# General information about the project.
56-
project = u"Odin"
57-
copyright = u"2023, Tim Savage"
55+
project = "Odin"
56+
copyright = "2023, Tim Savage"
5857
author = "Tim Savage <tim@savage.company>"
5958

6059
# The version info for the project you're documenting, acts as replacement for
@@ -205,8 +204,8 @@
205204
(
206205
"index",
207206
"Odin.tex",
208-
u"Odin Documentation",
209-
u"Tim Savage \\textless{}tim@savage.company\\textgreater{}",
207+
"Odin Documentation",
208+
"Tim Savage \\textless{}tim@savage.company\\textgreater{}",
210209
"manual",
211210
),
212211
]
@@ -236,7 +235,7 @@
236235

237236
# One entry per manual page. List of tuples
238237
# (source start file, name, description, authors, manual section).
239-
man_pages = [("index", "odin", u"Odin Documentation", [author], 1)]
238+
man_pages = [("index", "odin", "Odin Documentation", [author], 1)]
240239

241240
# If true, show URL addresses after external links.
242241
# man_show_urls = False
@@ -251,7 +250,7 @@
251250
(
252251
"index",
253252
"Odin",
254-
u"Odin Documentation",
253+
"Odin Documentation",
255254
author,
256255
"Odin",
257256
"One line description of project.",

poetry.lock

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

pyproject.toml

Lines changed: 30 additions & 2 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.6"
7+
version = "2.8"
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"
@@ -53,4 +53,32 @@ msgpack = ["msgpack"]
5353
toml = ["toml"]
5454
pint = ["pint"]
5555
arrow = ["arrow"]
56-
rich = ["rich"]
56+
rich = ["rich"]
57+
58+
[tool.isort]
59+
profile = "black"
60+
61+
[tool.ruff]
62+
select = [
63+
"E", # pycodestyle errors
64+
"W", # pycodestyle warnings
65+
"F", # pyflakes
66+
# "I", # isort
67+
"C", # flake8-comprehensions
68+
"B", # flake8-bugbear
69+
]
70+
ignore = [
71+
"E501", # line too long, handled by black
72+
"B008", # do not perform function calls in argument defaults
73+
"C901", # too complex
74+
]
75+
76+
# Assume Python 3.8.
77+
target-version = "py38"
78+
79+
[tool.ruff.per-file-ignores]
80+
"tests/test_adapters.py" = ["F403", "F405"]
81+
"tests/test_codec*.py" = ["F403", "F405"]
82+
"tests/test_fields.py" = ["F403", "F405"]
83+
"tests/test_kitchensink.py" = ["F403", "F405"]
84+
"tests/test_mapping.py" = ["F403", "F405"]

src/odin/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
logging.getLogger("odin.registration").addHandler(logging.NullHandler())
55

66
from odin import exceptions # noqa
7+
from odin.adapters import ResourceAdapter # noqa
8+
from odin.annotated_resource import * # noqa
9+
from odin.annotated_resource import type_aliases as types # noqa
710
from odin.fields import * # noqa
811
from odin.fields.composite import * # noqa
912
from odin.fields.virtual import * # noqa
13+
from odin.helpers import * # noqa
1014
from odin.mapping import * # noqa
11-
from odin.resources import Resource # noqa
12-
from odin.adapters import ResourceAdapter # noqa
1315
from odin.proxy import ResourceProxy # noqa
14-
from odin.annotated_resource import * # noqa
15-
from odin.annotated_resource import type_aliases as types # noqa
16-
from odin.helpers import * # noqa
16+
from odin.resources import Resource # noqa
1717

1818
__authors__ = "Tim Savage <tim@savage.company>"
1919
__copyright__ = "Copyright (C) 2021 Tim Savage"

src/odin/adapters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from functools import cached_property
2+
23
from odin.utils import field_iter_items, getmeta
34

45
__all__ = ("ResourceAdapter",)

src/odin/annotated_resource/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,19 @@
1212
1313
"""
1414
import copy
15-
from typing import Any, Dict, Tuple, Type, Optional, TypeVar, Iterable
15+
from typing import Any, Dict, Iterable, Optional, Tuple, Type, TypeVar
1616

1717
from odin import registration
1818
from odin.fields import BaseField
1919
from odin.resources import (
20-
ResourceBase,
21-
ResourceOptions,
2220
DEFAULT_TYPE_FIELD,
2321
NotProvided,
22+
ResourceBase,
23+
ResourceOptions,
2424
)
25-
from .type_resolution import process_attribute, Options
25+
2626
from ..exceptions import ResourceDefError
27+
from .type_resolution import Options, process_attribute
2728

2829
__all__ = (
2930
"Options",

src/odin/annotated_resource/type_aliases.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Type aliases for string formatted types."""
2-
from typing import Callable, Union, Any, Sequence, Tuple
2+
from typing import Any, Callable, Sequence, Tuple, Union
33

44
__all__ = (
55
"Email",

0 commit comments

Comments
 (0)