Skip to content

Commit b44e09f

Browse files
authored
Merge pull request #142 from python-odin/development
Release 2.4
2 parents 004b425 + 62cb408 commit b44e09f

30 files changed

Lines changed: 629 additions & 307 deletions

.readthedocs.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the version of Python and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3"

HISTORY

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
2.4
2+
===
3+
4+
- Add contrib.rich to provide pre-built rich integration for rendering ``ValidationErrors`` as a tree
5+
- Improve ValidationError
6+
- Add ``for_field`` class method to simplify creating an exception related to a specific field.
7+
- Improve type annotations
8+
- Improve error handling of Validator rendering in sphinx contrib.
9+
- Improve description of validators for documentation.
10+
- Improve type annotations in validators.
11+
- Updates to documentation
12+
- Add decorators to docs
13+
- Additional docs for validators
14+
- Additional docs for Sphinx extension
15+
16+
117
2.3.1
218
=====
319

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
# General information about the project.
5656
project = u"Odin"
57-
copyright = u"2021, Tim Savage"
57+
copyright = u"2023, Tim Savage"
5858
author = "Tim Savage <tim@savage.company>"
5959

6060
# The version info for the project you're documenting, acts as replacement for

docs/ref/contrib/arrow/index.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#####
2+
Arrow
3+
#####
4+
5+
Better dates & times for Python
6+
7+
.. note::
8+
9+
This contrib module depends on the `Arrow <https://arrow.readthedocs.io/en/latest/>`_ library::
10+
11+
pip install arrow
12+
13+
Fields
14+
******
15+
16+
.. _field-arrow_field:
17+
18+
ArrowField
19+
===========
20+
21+
``class ArrowField([assume_local: bool = False, **options])``
22+
23+
An amount.
24+
25+
ArrowField has one extra argument:
26+
27+
:py:attr:`ArrowField.assume_local`
28+
Customise how naive (datetime values with no timezone) are handled and also how dates are decoded. If
29+
``assume_local`` is True naive dates are assumed to represent the current system timezone.

docs/ref/contrib/doc_gen/index.rst

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

docs/ref/contrib/index.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ This code lives in ``odin/contrib`` in the Odin distribution.
1111
.. toctree::
1212
:maxdepth: 1
1313

14-
doc_gen/index
14+
sphinx/index
15+
rich/index
16+
arrow/index
1517
geo/index
1618
money/index
1719
pint/index
18-
sphinx/index

docs/ref/contrib/pint/index.rst

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,29 @@
22
Physical Quantities with Pint
33
#############################
44

5-
Additional resources fields that include a unit.
5+
Additional resources fields that include units.
66

77
.. note::
88

99
This contrib module depends on the `Pint units library <http://pint.readthedocs.org/>`_ this can be installed with::
1010

1111
pip install pint
1212

13+
1314
Fields
1415
******
1516

16-
FloatField
17-
==========
17+
.. _field-pint_field:
18+
19+
ArrowField
20+
===========
21+
22+
``class ArrowField([assume_local: bool = False, **options])``
1823

19-
``class FloatField([max_length=None, **options])``
24+
An amount.
2025

21-
A float.
26+
ArrowField has one extra argument:
2227

23-
FloatField has one extra argument:
28+
:py:attr:`ArrowField.assume_local`
29+
Customise how naive (datetime values with no timezone) are handled and also how dates are decoded. If
30+
``assume_local`` is True naive dates are assumed to represent the current system timezone.

docs/ref/contrib/rich/index.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
####
2+
Rich
3+
####
4+
5+
Better CLI's with Rich!
6+
7+
.. note::
8+
9+
This contrib module depends on the `Rich <https://rich.readthedocs.io/en/latest/introduction.html>`_ library::
10+
11+
pip install rich
12+
13+
14+
15+
Render Validation Errors
16+
========================
17+
18+
Generate a tree or extend an existing one from a ``ValidationError`` exception.
19+
20+
.. code-block:: python
21+
22+
from rich import print
23+
from odin.contrib.rich.validation_tree import validation_error_tree
24+
25+
try:
26+
...
27+
except ValidationError as ex:
28+
tree = validation_error_tree(ex)
29+
print(tree)
30+
31+
.. note::
32+
A tree instance can be provided as the second argument to allow for customisations
33+
to the tree root label and styles.

docs/ref/decorators.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
##################
2+
Helpful Decorators
3+
##################
4+
5+
6+
.. automodule:: odin.decorators
7+
8+
.. autofunction:: returns_resource

docs/ref/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ API Reference
1313
adapters
1414
validators
1515
traversal
16+
decorators
1617
utils

0 commit comments

Comments
 (0)