Metadata-Version: 2.4
Name: bagof-factories
Version: 0.1
Summary: Hint-based runtime factories.
Author-email: Yael Balbastre <yael.balbastre@gmail.com>
Maintainer-email: Yael Balbastre <yael.balbastre@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/bagofseeds/bagof-factories
Project-URL: Documentation, https://github.com/bagofseeds/bagof-factories#readme
Project-URL: Issues, https://github.com/bagofseeds/bagof-factories/issues
Project-URL: Repository, https://github.com/bagofseeds/bagof-factories
Keywords: bagof,factories,python
Classifier: Development Status :: 1 - Planning
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Typing :: Typed
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typing_extensions>=4.13
Requires-Dist: bagof-hints~=0.1
Requires-Dist: bagof-core-magic~=0.1
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Dynamic: license-file

# bagof-factories

Hint-based factories that build default values at runtime.

## Example

```pycon
>>> from bagof.factories import get_factory
>>> get_factory(list[int])()
[]
>>> get_factory(dict[str, int])()
{}
>>> get_factory(set[int])()
set()
>>> get_factory(int)()
0
>>> get_factory(int | None)()  # optional -> None
>>> get_factory(str)()
''
```

Abstract collection ABCs (`Sequence`, `Mapping`, `Set`, `Iterable`, ...),
numeric ABCs (`numbers.Integral`, `numbers.Real`, ...), enumerations, and
builtin/stdlib types whose constructor needs arguments (`range`, `slice`,
`memoryview`, `datetime`, `date`, `uuid.UUID`) are all handled too.
