{"id":19335035,"url":"https://github.com/kodemore/chili","last_synced_at":"2025-04-30T21:09:49.056Z","repository":{"id":38193235,"uuid":"382524181","full_name":"kodemore/chili","owner":"kodemore","description":"Object serialization/deserialization tools for python.","archived":false,"fork":false,"pushed_at":"2024-05-28T05:13:49.000Z","size":260,"stargazers_count":72,"open_issues_count":2,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-30T21:09:36.058Z","etag":null,"topics":["dataclasses","deserialization","hydration","json","mapping","python","serialization"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kodemore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-03T04:26:09.000Z","updated_at":"2025-02-20T10:46:28.000Z","dependencies_parsed_at":"2024-06-19T17:10:04.246Z","dependency_job_id":null,"html_url":"https://github.com/kodemore/chili","commit_stats":{"total_commits":36,"total_committers":4,"mean_commits":9.0,"dds":"0.13888888888888884","last_synced_commit":"c22567b7031d79820ac0fb551025c51b1b6b92b9"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodemore%2Fchili","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodemore%2Fchili/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodemore%2Fchili/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodemore%2Fchili/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kodemore","download_url":"https://codeload.github.com/kodemore/chili/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251782775,"owners_count":21642987,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dataclasses","deserialization","hydration","json","mapping","python","serialization"],"created_at":"2024-11-10T03:04:33.234Z","updated_at":"2025-04-30T21:09:49.017Z","avatar_url":"https://github.com/kodemore.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🌶️ Chili \n[![PyPI version](https://badge.fury.io/py/chili.svg)](https://pypi.org/project/chili) [![codecov](https://codecov.io/gh/kodemore/chili/branch/main/graph/badge.svg?token=TCG7SRQFD5)](https://codecov.io/gh/kodemore/chili) [![CI](https://github.com/kodemore/chili/actions/workflows/main.yaml/badge.svg?branch=main)](https://github.com/kodemore/chili/actions/workflows/main.yaml) [![Release](https://github.com/kodemore/chili/actions/workflows/release.yml/badge.svg)](https://github.com/kodemore/chili/actions/workflows/release.yml) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nChili is an extensible library which provides a simple and efficient way to encode and decode complex Python objects to and from their dictionary representation.\n\nIt offers complete coverage for the `typing` package; including generics, and supports custom types, allowing you to extend the library to handle your specific needs. \n\nWith support for nested data structures, default values, forward references, and data mapping and transformation, Chili is designed to be both easy to use and powerful enough to handle complex data structures.\n\n\u003e Note: Chili is not a validation library, although it ensures the type integrity. \n\n# Installation\n\nTo install the library, simply use pip:\n\n```shell\npip install chili\n```\n\nor poetry:\n\n```shell\npoetry add chili\n```\n\n# Usage\n\nThe library provides three main classes for encoding and decoding objects, `chili.Encoder` and `chili.Decoder`, and `chili.Serializer`, which combines both functionalities.\nFunctional interface is also provided through `chili.encode` and `chili.decode` functions.\n\nAdditionally, library by default supports json serialization and deserialization, so you can use `chili.JsonDecoder`, and `chili.JsonDecoder`, and `chili.JsonSerializer` or its functional replacement `chili.json_encode` and `chili.json_decode` to serialize and deserialize objects to and from json.\n\n## Defining encodable/decodable properties\nTo define the properties of a class that should be encoded and decoded, you need to define them with type annotations. \nThe `@encodable`, `@decodable`, or `@serializable` decorator should also be used to mark the class as encodable/decodable or serializable.\n\n\u003e Note: Dataclasses are supported automatically, so you don't need to use the decorator.\n\n```python\nfrom chili import encodable\n\n@encodable\nclass Pet:\n    name: str\n    age: int\n    breed: str\n\n    def __init__(self, name: str, age: int, breed: str):\n        self.name = name\n        self.age = age\n        self.breed = breed\n```\n\n\n## Encoding\nTo encode an object, you need to create an instance of the `chili.Encoder` class, and then call the `encode()` method, passing the object to be encoded as an argument.\n\n\u003e Note: The `chili.Encoder` class is a generic class, and you need to pass the type of the object to be encoded as a type argument.\n\n```python\nfrom chili import Encoder\n\nencoder = Encoder[Pet]()\n\nmy_pet = Pet(\"Max\", 3, \"Golden Retriever\")\nencoded = encoder.encode(my_pet)\n\nassert encoded == {\"name\": \"Max\", \"age\": 3, \"breed\": \"Golden Retriever\"}\n```\n\nAlternatevely you can use `chili.encode` function:\n\n```python\nfrom chili import encode\n\nmy_pet = Pet(\"Max\", 3, \"Golden Retriever\")\nencoded = encode(my_pet, Pet)\n\nassert encoded == {\"name\": \"Max\", \"age\": 3, \"breed\": \"Golden Retriever\"}\n```\n\n\u003e `chili.encode` function by default only encodes `@encodable` objects, this behavior might be amended with the `force` flag.\n\n## Decoding\nTo decode an object, you need to create an instance of the `chili.Decoder` class, and then call the `decode()` method, passing the dictionary to be decoded as an argument.\n\n\n\u003e Note: The `chili.Decoder` class is a generic class, and you need to pass the type of the object to be decoded as a type argument.\n\n```python\nfrom chili import Decoder\n\ndecoder = Decoder[Pet]()\n\ndata = {\"name\": \"Max\", \"age\": 3, \"breed\": \"Golden Retriever\"}\ndecoded = decoder.decode(data)\n\nassert isinstance(decoded, Pet)\n```\n\nAlternatevely you can use `chili.decode` function:\n\n```python\nfrom chili import decode\n\ndata = {\"name\": \"Max\", \"age\": 3, \"breed\": \"Golden Retriever\"}\ndecoded = decode(data, Pet)\n\nassert isinstance(decoded, Pet)\n```\n\n\u003e `chili.decode` function by default only decodes `@decodable` objects, this behavior might be amended with the `force` flag.\n\n## Missing Properties\nIf a property is not present in the dictionary when decoding, the `chili.Decoder` class will not fill in the property value, unless there is a default value defined in the type annotation. Similarly, if a property is not defined on the class, the `chili.Encoder` class will hide the property in the resulting dictionary.\n\n## Using Default Values\nTo provide default values for class properties that are not present in the encoded dictionary, you can define the properties with an equal sign and the default value. For example:\n\n```python\nfrom typing import List\nfrom chili import Decoder, decodable\n\n@decodable\nclass Book:\n    name: str\n    author: str\n    isbn: str = \"1234567890\"\n    tags: List[str] = []\n\nbook_data = {\"name\": \"The Hobbit\", \"author\": \"J.R.R. Tolkien\"}\ndecoder = Decoder[Book]()\n\nbook = decoder.decode(book_data)\n\nassert book.tags == []\nassert book.isbn == \"1234567890\"\n```\n\n\u003e Note: When using default values with mutable objects, such as lists or dictionaries, be aware that the default value is shared among all instances of the class that do not have that property defined in the encoded dictionary. However, if the default value is empty (e.g. `[]` for a list, `{}` for a dictionary), it is not shared among instances.\n\n## Custom Type Encoders\nYou can also specify custom type encoders by defining a class that implements the `chili.TypeEncoder` protocol and passing it as a dictionary to the `encoders` argument of the Encoder constructor.\n\n```python\nfrom chili import Encoder, TypeEncoder\n\nclass MyCustomEncoder(TypeEncoder):\n    def encode(self, value: MyCustomType) -\u003e str:\n        return value.encode()\n\n    \ntype_encoders = {MyCustomType: MyCustomEncoder()}\nencoder = Encoder[Pet](encoders=type_encoders)\n```\n\n## Custom Type Decoders\nYou can also specify custom type decoders by defining a class that implements the `chili.TypeDecoder` protocol and passing it as a dictionary to the `decoders` argument of the Decoder constructor.\n\n```python\nfrom chili import Decoder, TypeDecoder\n\nclass MyCustomDecoder(TypeDecoder):\n    def decode(self, value: str) -\u003e MyCustomType:\n        return MyCustomType.decode(value)\n\ntype_decoders = {MyCustomType: MyCustomDecoder()}\ndecoder = Decoder[Pet](decoders=type_decoders)\n```\n\n## Convenient Functions\nThe library also provides convenient functions for encoding and decoding objects. \n\nThe `chili.encode` function takes an object and an optional type hint and returns a dictionary. \n\nThe `chili.decode` function takes a dictionary, a type hint, and returns an object.\n\n```python\nfrom chili import encode, decode\n\nmy_pet = Pet(\"Max\", 3, \"Golden Retriever\")\n\nencoded = encode(my_pet)\ndecoded = decode(encoded, Pet)\n```\n\n\u003e To specify custom type encoders and decoders, you can pass them as keyword arguments to the `chili.encode` and `chili.decode` functions.\n\n## Serialization\nIf your object is both encodable and decodable, you can use the `@serializable` decorator to mark it as such. You can then use the `chili.Serializer` class to encode and decode objects.\n\n```python\nfrom chili import Serializer, serializable\n\n@serializable\nclass Pet:\n    name: str\n    age: int\n    breed: str\n\n    def __init__(self, name: str, age: int, breed: str):\n        self.name = name\n        self.age = age\n        self.breed = breed\n\nmy_pet = Pet(\"Max\", 3, \"Golden Retriever\")\nserializer = Serializer[Pet]()\n\nencoded = serializer.encode(my_pet)\ndecoded = serializer.decode(encoded)\n```\n\n\u003e Note: that you should only use the `@serializable` decorator for objects that are both @encodable and @decodable.\n\n\n## JSON Serialization\nThe library also provides classes for encoding and decoding objects to and from JSON formats. The `chili.JsonEncoder` and `chili.JsonDecoder` classes provide JSON serialization.\n\n```python\nfrom chili import JsonEncoder, JsonDecoder, JsonSerializer\n\n# JSON Serialization\nencoder = JsonEncoder[Pet]()\ndecoder = JsonDecoder[Pet]()\nserializer = JsonSerializer[Pet]()\n\nmy_pet = Pet(\"Max\", 3, \"Golden Retriever\")\nencoded = encoder.encode(my_pet)\ndecoded = decoder.decode(encoded)\n```\n\nThe `encoded` value will be a json string:\n\n```json\n{\"name\": \"Max\", \"age\": 3, \"breed\": \"Golden Retriever\"}\n```\n\nThe `decoded` value will be an instance of a Pet object.\n\n\u003e Functional interface is also available through the `chili.json_encode`, `chili.json_decode` functions.\n\n## Private properties\nChili recognizes private attributes within a class, enabling it to serialize these attributes when a class specifies a getter for an attribute and an associated private storage (must be denoted with a `_` prefix).\n\nHere is an example:\n\n```python\nfrom chili import encodable, encode\n\n@encodable\nclass Pet:\n    name: str\n\n    def __init__(self, name: str) -\u003e None:\n        self._name = name\n\n    @property\n    def name(self) -\u003e str:\n        return self._name\n\npet = Pet(\"Bobik\")\ndata = encode(pet)\nassert data == {\n    \"name\": \"Bobik\",\n}\n```\n\n## Mapping\n\nMapping allows you to remap keys, apply functions to the values, and even change the structure of the input dictionary. This is particularly useful when you need to convert data from one format to another, such as when interacting with different APIs or data sources that use different naming conventions.\n\n### Simple mapping\nHere's an example of how to use the `chili.Mapper` class from the library with a Pet class:\n\n```python\nfrom chili import Mapper\n\n# Create a Mapper instance with the specified scheme\nmapper = Mapper({\n    \"pet_name\": \"name\",\n    \"pet_age\": \"age\",\n    \"pet_tags\": {\n        \"tag_name\": \"tag\",\n        \"tag_type\": \"type\",\n    },\n})\n\ndata = {\n    \"pet_name\": \"Max\",\n    \"pet_age\": 3,\n    \"pet_tags\": [\n        {\"tag_name\": \"cute\", \"tag_type\": \"description\"},\n        {\"tag_name\": \"furry\", \"tag_type\": \"description\"},\n    ],\n}\n\n# Apply the mapping to your input data\nmapped_data = mapper.map(data)\n\nprint(mapped_data)\n```\n\nThe `mapped_data` output would be:\n\n```python\n{\n    \"name\": \"Max\",\n    \"age\": 3,\n    \"pet_tags\": [\n        {\"tag\": \"cute\", \"type\": \"description\"},\n        {\"tag\": \"furry\", \"type\": \"description\"},\n    ],\n}\n```\n\n### Using KeyScheme\n\n`KeyScheme` can be used to define mapping rules for nested structures more explicitly. \nIt allows you to specify both the old key and the nested mapping scheme in a single, concise object. This can be particularly useful when you want to map a nested structure but need to maintain clarity in your mapping scheme.\n\nHere's an example of how to use `chili.KeyScheme` with the `chili.Mapper` class:\n\n```python\nfrom chili import Mapper, KeyScheme\n\n# Create a Mapper instance with the specified scheme\nmapper = Mapper({\n    \"pet_name\": \"name\",\n    \"pet_age\": \"age\",\n    \"pet_tags\": KeyScheme(\"tags\", {\n        \"tag_name\": \"tag\",\n        \"tag_type\": \"type\",\n    }),\n})\n\npet_dict = {\n    \"pet_name\": \"Max\",\n    \"pet_age\": 3,\n    \"pet_tags\": [\n        {\"tag_name\": \"cute\", \"tag_type\": \"description\"},\n        {\"tag_name\": \"furry\", \"tag_type\": \"description\"},\n    ],\n}\n\n# Apply the mapping to your input data\nmapped_data = mapper.map(pet_dict)\n\nprint(mapped_data)\n```\n\nThe `mapped_data` output would be:\n\n```python\n{\n    \"name\": \"Max\",\n    \"age\": 3,\n    \"tags\": [\n        {\"tag\": \"cute\", \"type\": \"description\"},\n        {\"tag\": \"furry\", \"type\": \"description\"},\n    ],\n}\n```\n\n### Using wildcards in mapping\n\nThe `chili.Mapper` supports using `...` (Ellipsis) as a wildcard for keys that you want to include in the mapping but do not want to explicitly define. This can be useful when you want to map all keys in the input data, or when you want to map specific keys and leave the remaining keys unchanged.\n\nYou can use a lambda function with the `...` wildcard to apply a transformation to the keys or values that match the wildcard.\n\nHere's an example of how to use the `...` wildcard with the `chili.Mapper` class:\n\n```python\nfrom chili import Mapper\n\n# Create a Mapper instance with the specified scheme containing a wildcard ...\nmapper = Mapper({\n    \"pet_name\": \"name\",\n    \"pet_age\": \"age\",\n    ...: lambda k, v: (f\"extra_{k}\", v.upper() if isinstance(v, str) else v),\n})\n\npet_dict = {\n    \"pet_name\": \"Max\",\n    \"pet_age\": 3,\n    \"pet_color\": \"white\",\n    \"pet_breed\": \"Golden Retriever\",\n    \"pet_tags\": [\n        {\"tag\": \"cute\", \"type\": \"description\"},\n        {\"tag\": \"furry\", \"type\": \"description\"},\n    ],\n}\n\n# Apply the mapping to your input data\nmapped_data = mapper.map(pet_dict)\n\nprint(mapped_data)\n```\n\nThe `mapped_data` output would be:\n\n```python\n{\n    \"pet_name\": \"Fluffy\",\n    \"pet_age\": 3,\n    \"extra_color\": \"WHITE\",\n    \"extra_breed\": \"POODLE\",\n    \"extra_tags\": [\n        {\n            \"tag\": \"cute\",\n            \"type\": \"description\",\n        },\n        {\n            \"tag\": \"furry\",\n            \"type\": \"description\",\n        },\n    ],\n}\n```\n\n### Using mapping in decodable/encodable objects\n\nYou can also use mapping by setting `mapper` parameter in `@chili.encodable` and `@chili.decodable` decorators.\n\n```python\nfrom typing import List\n\nfrom chili import encodable, Mapper, encode\n\nmapper = Mapper({\n    \"pet_name\": \"name\",\n    \"pet_age\": \"age\",\n    \"pet_tags\": {\n        \"tag_name\": \"tag\",\n        \"tag_type\": \"type\",\n    },\n})\n\n\n@encodable(mapper=mapper)\nclass Pet:\n    name: str\n    age: int\n    tags: List[str]\n\n    def __init__(self, name: str, age: int, tags: List[str]):\n        self.name = name\n        self.age = age\n        self.tags = tags\n\n\npet = Pet(\"Max\", 3, [\"cute\", \"furry\"])\nencoded = encode(pet)\n\nassert encoded == {\n    \"pet_name\": \"Max\",\n    \"pet_age\": 3,\n    \"pet_tags\": [\n        {\"tag_name\": \"cute\", \"tag_type\": \"description\"},\n        {\"tag_name\": \"furry\", \"tag_type\": \"description\"},\n    ],\n}\n```\n\nAlternatively you can set mapper in `Encoder` and `Decoder` classes:\n\n```python\nencoder = Encoder[Pet](mapper=mapper)\n\npet = Pet(\"Max\", 3, [\"cute\", \"furry\"])\nencoded = encoder.encode(pet)\n```\n\n## Error handling\nThe library raises errors if an invalid type is passed to the Encoder or Decoder, or if an invalid dictionary is passed to the Decoder.\n\n```python\nfrom chili import Encoder, Decoder\nfrom chili.error import EncoderError, DecoderError\n\n# Invalid Type\nencoder = Encoder[MyInvalidType]()  # Raises EncoderError.invalid_type\n\ndecoder = Decoder[MyInvalidType]()  # Raises DecoderError.invalid_type\n\n# Invalid Dictionary\ndecoder = Decoder[Pet]()\ninvalid_data = {\"name\": \"Max\", \"age\": \"three\", \"breed\": \"Golden Retriever\"}\ndecoded = decoder.decode(invalid_data)  # Raises DecoderError.invalid_input\n```\n\n## Performance\n\nThe table below shows the results of the benchmarks for encoding and decoding objects with the library, [Pydantic](https://pydantic-docs.helpmanual.io/), and [attrs](https://www.attrs.org/en/stable/).\n\n| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |\n|:---|---:|---:|---:|---:|\n| `poetry run python benchmarks/chili_decode.py` | 249.4 ± 4.1 | 245.5 | 258.8 | 1.01 ± 0.02 |\n| `poetry run python benchmarks/pydantic_decode.py` | 295.5 ± 12.5 | 287.6 | 327.1 | 1.19 ± 0.05 |\n| `poetry run python benchmarks/attrs_decode.py` | 260.9 ± 8.6 | 253.2 | 283.5 | 1.05 ± 0.04 |\n| `poetry run python benchmarks/chili_encode.py` | 247.8 ± 2.3 | 245.4 | 253.0 | 1.00 |\n| `poetry run python benchmarks/pydantic_encode.py` | 292.4 ± 4.7 | 287.1 | 302.5 | 1.18 ± 0.02 |\n| `poetry run python benchmarks/attrs_encode.py` | 258.2 ± 2.1 | 254.4 | 261.4 | 1.04 ± 0.01 |\n\n\n## Supported types\n\nThe following section lists all the data types supported by the library and explains how they are decoded and encoded. The supported data types include built-in Python types like `bool`, `dict`, `float`, `int`, `list`, `set`, `str`, and `tuple`, as well as more complex types like `collections.namedtuple`, `collections.deque`, `collections.OrderedDict`, `datetime.date`, `datetime.datetime`, `datetime.time`, `datetime.timedelta`, `decimal.Decimal`, `enum.Enum`, `enum.IntEnum`, `pathlib.Path`, and various types defined in the typing module.\n\n### Simple types\n\nSimple type are handled by a ProxyEncoder and ProxyDecoder. These types are decoded and encoded by casting the value to the specified type.\n\n\n\u003e For more details please refer to [chili.encoder.ProxyEncoder](chili/encoder.py#L50) and [chili.decoder.ProxyDecoder](chili/decoder.py#L65).\n\n#### `bool`\n\nPassed value is automatically cast to a boolean with python's built-in `bool` type during decoding and encoding process.\n\n#### `int`\n\nPassed value is automatically cast to an int with python's built-in `int` type during decoding and encoding process.\n\n#### `float`\n\nPassed value is automatically cast to float with python's built-in `float` type during decoding and encoding process.\n\n\n#### `str`\n\nPassed value is automatically cast to string with python's built-in `str` during encoding and decoding process.\n\n\n#### `set`\n\nPassed value is automatically cast to either `set` during decoding process or `list` during encoding process.\n\n\n#### `frozenset`\n\nPassed value is automatically cast to either `frozenset` during decoding process or `list` during encoding process.\n\n#### `list`\n\nPassed value is automatically cast to list with python's built-in `list` during encoding and decoding process.\n\n#### `tuple`\n\nPassed value is automatically cast either to `tuple` during decoding process or to `list` during encoding process.\n\n\n#### `dict`\n\nPassed value is automatically cast to dict with python's built-in `dict` during encoding and decoding process.\n\n### Complex types\n\nComplex types are handled by corresponding Encoder and Decoder classes. \n\n#### `collections.namedtuple`\n\nPassed value is automatically cast to either `collections.namedtuple` during decoding process or `list` during encoding process.\n\n\n#### `collections.deque`\n\nPassed value is automatically cast to either `collections.deque` during decoding process or `list` during encoding process.\n\n\n#### `collections.OrderedDict`\n\nPassed value is automatically cast to either `collections.OrderedDict` during decoding process or `list` where each item is a `list` of two elements corresponding to `key` and `value`, during encoding process.\n\n\n#### `datetime.date`\n\nPassed value is automatically cast to either `datetime.date` during decoding process or `str` (valid ISO-8601 date string) during encoding process.\n\n#### `datetime.datetime`\n\n\n\nPassed value must be valid ISO-8601 date time string, then it is automatically hydrated to an instance of `datetime.datetime` \nclass and extracted to ISO-8601 format compatible string.\n\n#### `datetime.time`\n\nPassed value must be valid ISO-8601 time string, then it is automatically hydrated to an instance of `datetime.time` \nclass and extracted to ISO-8601 format compatible string.\n\n#### `datetime.timedelta`\n\nPassed value must be valid ISO-8601 duration string, then it is automatically hydrated to an instance of `datetime.timedelta`\nclass and extracted to ISO-8601 format compatible string.\n\n#### `decimal.Decimal`\n\nPassed value must be a string containing valid decimal number representation, for more please read python's manual\nabout [`decimal.Decimal`](https://docs.python.org/3/library/decimal.html#decimal.Decimal), on extraction value is\nextracted back to string.\n\n#### `enum.Enum`\n\nSupports hydration of all instances of `enum.Enum` subclasses as long as value can be assigned\nto one of the members defined in the specified `enum.Enum` subclass. During extraction the value is\nextracted to value of the enum member.\n\n#### `enum.IntEnum`\n\nSame as `enum.Enum`.\n\n\n#### `pathlib.Path`\nSupported hydration for all instances of `pathlib.Path` class, during extraction value is extracted to string.\n\n### Typing module support\n\n#### `typing.Any`\n\nPassed value is unchanged during hydration and extraction process.\n\n#### `typing.AnyStr`\n\nSame as `str`\n\n#### `typing.Deque`\n\nSame as `collection.dequeue` with one exception, if subtype is defined, eg `typing.Deque[int]` each item inside queue\nis hydrated accordingly to subtype.\n\n#### `typing.Dict`\n\nSame as `dict` with exception that keys and values are respectively hydrated and extracted to match\nannotated type.\n\n#### `typing.FrozenSet`\n\nSame as `frozenset` with exception that values of a frozen set are respectively hydrated and extracted to\nmatch annotated type.\n\n#### `typing.List`\n\nSame as `list` with exception that values of a list are respectively hydrated and extracted to match annotated type.\n\n#### `typing.NamedTuple`\n\nSame as `namedtuple`.\n\n#### `typing.Set`\n\nSame as `set` with exception that values of a set are respectively hydrated and extracted to match annotated type.\n\n#### `typing.Tuple`\n\nSame as `tuple` with exception that values of a set are respectively hydrated and extracted to match annotated types.\nEllipsis operator (`...`) is also supported.\n\n#### `typing.TypedDict`\n\nSame as `dict` but values of a dict are respectively hydrated and extracted to match annotated types. \n\n\n#### `typing.Generic`\n\nOnly parametrised generic classes are supported, dataclasses that extends other Generic classes without parametrisation will fail.\n\n\n#### `typing.Optional`\n\nOptional types can carry additional `None` value which chili's hydration process will respect, so for example \nif your type is `typing.Optional[int]` `None` value is not hydrated to `int`.\n\n\n#### `typing.Union`\n\nLimited support for Unions.\n\n#### `typing.Pattern`\n\nPassed value must be a valid regex pattern, if contains flags regex should start with `/` and flags should be passed after `/` only `ismx` flags are supported.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkodemore%2Fchili","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkodemore%2Fchili","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkodemore%2Fchili/lists"}