Skip to content

Commit 1352676

Browse files
authored
Doc improvements (#442)
* Doc improvements * Add history link
1 parent 53a5c9d commit 1352676

File tree

6 files changed

+69
-9
lines changed

6 files changed

+69
-9
lines changed

HISTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
([#416](https://github.com/python-attrs/cattrs/pull/416))
5555
- Fix handling classes inheriting from non-generic protocols.
5656
([#374](https://github.com/python-attrs/cattrs/issues/374) [#436](https://github.com/python-attrs/cattrs/pull/436))
57+
- The documentation Makefile now supports the `htmlview` and `htmllive` targets. ([#442](https://github.com/python-attrs/cattrs/pull/442))
5758
- _cattrs_ is now published using PyPI Trusted Publishers, and `main` branch commits are automatically deployed to Test PyPI.
5859

5960
## 23.1.2 (2023-06-02)

docs/Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,14 @@ pseudoxml:
173173

174174
apidoc:
175175
pdm run sphinx-apidoc -o . ../src/cattrs/ -f
176+
177+
## htmlview to open the index page built by the html target in your browser
178+
.PHONY: htmlview
179+
htmlview: html
180+
pdm run python -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('$(BUILDDIR)/html/index.html'))"
181+
182+
## htmllive to rebuild and reload HTML files in your browser
183+
.PHONY: htmllive
184+
htmllive: SPHINXBUILD = pdm run sphinx-autobuild
185+
htmllive: SPHINXERRORHANDLING = --re-ignore="/\.idea/|/venv/|/pep-0000.rst|/topic/"
186+
htmllive: html

docs/converters.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ Larger applications are strongly encouraged to create and customize a different,
2121
## Converter Objects
2222

2323
To create a private converter, simply instantiate a {class}`cattrs.Converter`.
24+
25+
The core functionality of a converter is [structuring](structuring.md) and [unstructuring](unstructuring.md) data by composing provided and [custom handling functions](customizing.md), called _hooks_.
26+
2427
Currently, a converter contains the following state:
2528

2629
- a registry of unstructure hooks, backed by a [singledispatch](https://docs.python.org/3/library/functools.html#functools.singledispatch) and a `function_dispatch`.

docs/usage.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ This section covers common use examples of _cattrs_ features.
44

55
## Using Pendulum for Dates and Time
66

7-
To use the excellent [Pendulum](https://pendulum.eustace.io/) library for datetimes, we need to register
8-
structuring and unstructuring hooks for it.
7+
To use the [Pendulum](https://pendulum.eustace.io/) library for datetimes, we need to register structuring and unstructuring hooks for it.
98

10-
First, we need to decide on the unstructured representation of a datetime
11-
instance. Since all our datetimes will use the UTC time zone, we decide to
12-
use the UNIX epoch timestamp as our unstructured representation.
9+
First, we need to decide on the unstructured representation of a datetime instance.
10+
Since all our datetimes will use the UTC time zone, we decide to use the UNIX epoch timestamp as our unstructured representation.
1311

1412
Define a class using Pendulum's `DateTime`:
1513

pdm.lock

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

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ docs = [
2929
"sphinx-copybutton>=0.5.2",
3030
"myst-parser>=1.0.0",
3131
"pendulum>=2.1.2",
32+
"sphinx-autobuild",
3233
]
3334
bench = [
3435
"pyperf>=2.6.1",

0 commit comments

Comments
 (0)