Skip to content

v0.7.1: Any shape 🪨

Latest

Choose a tag to compare

@github-actions github-actions released this 17 Oct 18:22
· 40 commits to main since this release
Immutable release. Only release title and notes can be modified.
39ed19f

🪨 Any shape

The first example in our docs loads a mapping and reads a key. Run a type checker over it, and it failed. Not great for a first impression.

loads, load, async_loads, and async_load promised a closed union: a dict, a list, a string, a number, a document, or None. A type checker cannot know which one your file holds, so it refused loads(text)["key"] until you added a cast() or an isinstance check. The union was not even complete: it left out the dates from OPT_TIMESTAMPS and anything your own tag handlers return.

v0.7.1 types them as returning Any, the same as json.loads, orjson, and PyYAML's stubs. Your code type-checks again, and nothing changes at runtime. Thanks to @claudioc-sisal for the clear report!

pip install yamlrocks

📚 Docs: https://yaml.rocks

Same rock. Any shape. 🪨

../Frenck

                       

Blogging my personal ramblings at frenck.dev

What's changed

🐛 Bug fixes

  • Type the load functions as returning Any @frenck (#517)

⬆️ Dependency updates

23 changes