Commit Graph

26 Commits

Author SHA1 Message Date
Hynek Schlawack 80c61b79cf
Remove frogotten path fragment 2022-08-11 10:01:54 +02:00
Hynek Schlawack 714bf67a2f
Extend we-are-not-a-serialization-framework 2022-08-11 10:00:00 +02:00
Marcelo Trylesinski 7091b1f89a
Update init.rst (#979) 2022-07-07 15:04:05 +02:00
Hynek Schlawack cbe9c9775e Clarify validator arguments are passed as pos args
Fixes #958
2022-05-10 07:25:58 +02:00
piglei ae29da66b7
Update docs/examples.rst: add missing import statement for @frozen (#943)
* Update docs/examples.rst: add missing import statement for @frozen

* Update docs/examples.rst: change attr to attrs for frozen import statement

* Fix an indention error in init.rst
2022-03-29 12:44:09 +02:00
wouter bolsterlee a22e98c6cb
No longer explicitly subclass ‘object’ (#940)
This is no longer relevant in Python 3+. Follow-up to !936.

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2022-03-21 10:35:44 +01:00
Laurent Kadian 9727008fd1
fix type annotation in init.rst example (#905) 2022-01-11 05:58:47 +01:00
Aaron Stephens f3dfe96b48
docs: fix typos and some grammar (#900)
Co-authored-by: Hynek Schlawack <hs@ox.cx>
2022-01-04 13:46:36 +01:00
Kian Meng, Ang 7cfa3b68c5
Fix typos (#899) 2021-12-31 08:38:37 +00:00
Hynek Schlawack e7345584ff
Add attrs namespace (#887) 2021-12-25 15:15:10 +01:00
Hynek Schlawack 34c55613d2
Document the common question of derived attributes (#874) 2021-11-29 09:23:45 +01:00
Tin Tvrtković d7d9c5dde7
Switch to NG APIs in docs (#863)
* Switch to NG APIs in docs

* Review feedback

* Convert examples.rst

* Tweak doctest

* Doctest fixes

* Tweak some more

* Fix

* Update docs/init.rst

Co-authored-by: Hynek Schlawack <hs@ox.cx>

* Fix doctest

* Fix README

* Update docs/examples.rst

Co-authored-by: Hynek Schlawack <hs@ox.cx>

* Review feedback

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix link

Co-authored-by: Hynek Schlawack <hs@ox.cx>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-11-22 07:35:36 +01:00
Stefan Scherfke c6143d518b
Add "no_run_validators()" context manager (#859)
* Add "no_run_validators()" context manager

* Move functions to validators module

* Update changelog entry

* Add a few docstring improvements and fixes

* Update tests/test_validators.py

* Minor polish

Signed-off-by: Hynek Schlawack <hs@ox.cx>

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2021-11-17 07:05:01 +01:00
Hynek Schlawack 066d1ca7df Add narrative docs for #731
Signed-off-by: Hynek Schlawack <hs@ox.cx>
2021-04-06 07:27:11 +02:00
Kyle Barron 1b27630d8a
Fix typo (#765) 2021-02-25 07:25:18 +01:00
Nicholas Coltharp e09b1d6423
Infer type annotations from converters (#710)
* Infer annotations from converters

* Use semantic newlines

* Add 787.change.rst

* Don't let type annotations override converters

* Make pipe() infer type annotations

* Use PY2 instead of sys.versioninfo >= (3, 3)

* Avert crashing with a nullary converter

* Small doc change

* Add type inference for optional()

* Make pipe() annotations actually work

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2020-12-13 16:30:06 +01:00
Alex Chan cd2f886d63
Use 'i' and 'k' to better distinguish variables in an example (#713) 2020-11-04 11:52:42 +01:00
Hynek Schlawack ffe49c8241
Switch to furo
Now everything is @pradyunsg's fault! 🎉

Signed-off-by: Hynek Schlawack <hs@ox.cx>
2020-10-05 06:35:40 +01:00
Kyle Altendorf 42a3eb29d1
Doc type: into -> in (#679) 2020-08-31 09:51:43 +02:00
Julian Berman 8824dc26c2 Add default_role for Sphinx. (#571)
* Add default_role for Sphinx.

Fix a bunch of broken refs along the way, which become
errors now via -W if you have default_role set.

In theory you can catch those via sphinx-build -n (i.e.
nitpick mode), which IMHO is a decent idea anyhow, but it's
a longer diff to enable that because it'd involve fixing a
bunch of the places that try to reference types that don't
exist (e.g. :type foo: Any value). But obviously can be done.

Also didn't actually use this anywhere yet (the any role),
but will do so in a follow-up if this is acceptable.

* Remove the roles from builtin objects to demo any.

* Style.

* Add z.i to intersphinx.

Enables the link to z.i.Interface.

* Enable nitpick mode.

Fix the remaining broken links or whitelist them via nitpick_ignore.

* Kill all :func:s.

* Kill all :class:es.

* Kill all :doc:s.

* Kill all :ref:s.

Except one, that probably meant :func:, and which
is a duplicate ref.

* Kill :exc: and :data:.

* Kill :mod:s.

* Kill new explicit refs from the merge.
2019-09-09 15:02:16 +02:00
Oliver Bestwalter 669e69daa0 fix typo in docs (#534) 2019-05-26 13:03:03 +03:00
Hynek Schlawack bb9b83ceac
Clarify that annotation-only doesn't work w/ decorators (#486)
Fixes #466
2019-02-09 13:55:48 +01:00
Hynek Schlawack 2e2748aee3
Clarify execution order in init (#488)
* Clarify execution order in init

Fixes #461

* Clarify attributes are processed in the order of declaration

* Simple past is good enough
2019-02-09 13:34:48 +01:00
Ryan Gabbard 3e0ecbd891 Cache hash codes (#426)
* First stab at implementing hashcode caching (#423)

Currently all existing tests pass but no cache_hash tests have yet
been added.

* Existing hash tests now pass on cache_hash classes

* Add towncrier change log

* Add documentation for cache_hash

* Fixes bug with check that init=True if cache_hash=True

* Fix long lines

* Fix documentation issues

* Add test for cache_hash requiring init

* Improve test coverage

* Remove now unnecessary 'pass'

* Add periods to the end of exception strings

* Add test docstrings for cache_hash tests

* Clarify documentation of cache_hash

* Recommend that hashable classes be frozen

* Fix test references for exception messages
2018-08-20 06:46:52 +02:00
Pavel Karateev 7a80d57d1c Fix typo: double "be" (#373) 2018-04-26 19:14:15 +02:00
Hynek Schlawack 879f43d355 Add narrative chapter about initialization (#370)
* Add narrative chapter on initialization

* Be more explicit about defining validators both ways

* Stress that the name of default/validator != attr name

* Mention nested schemas

* Explain handling of private attributes

* Add another consequence of _ stripping

* Stress that nothing should overwrite attributes on class body

* Better wording

* typo

* Dedup examples

* Address review feedback

* Add newsfragments
2018-04-25 00:07:03 +02:00