-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 704bfeb335ca27223b9e9a372c230072 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
:orphan: | ||
|
||
.. include:: ../CONTRIBUTING.rst |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
=============== | ||
Getting Started | ||
=============== | ||
|
||
Polyfactory is a simple and powerful mock data generation library, based around type | ||
hints and supporting :doc:`dataclasses <python:library/dataclasses>`, :class:`TypedDicts <typing.TypedDict>`, | ||
Pydantic models, :class:`msgspec Struct's <msgspec.Struct>` and more. | ||
|
||
Installation | ||
------------ | ||
|
||
.. code-block:: bash | ||
pip install polyfactory | ||
Example | ||
------- | ||
|
||
.. literalinclude:: /examples/declaring_factories/test_example_1.py | ||
:caption: Minimal example using a dataclass | ||
:language: python | ||
|
||
That is it - with almost no work, we are able to create a mock data object fitting the ``Person`` class model definition. | ||
|
||
This is possible because of the typing information available on the dataclass, which are used as a | ||
source of truth for data generation. | ||
|
||
The factory parses the information stored in the dataclass and generates a dictionary of kwargs that are passed to | ||
the ``Person`` class constructor. | ||
|
||
Relation to ``pydantic-factories`` | ||
---------------------------------- | ||
|
||
Prior to version 2, this library was known as `pydantic-factories <https://pypi.org/project/pydantic-factories/>`_, a | ||
name under which it gained quite a bit of popularity. | ||
|
||
A main motivator for the 2.0 release was that we wanted to support more than just Pydantic models, something which also | ||
required a change to its core architecture. As this library would no longer be directly tied to Pydantic, ``polyfactory`` | ||
was chosen as its new name to reflect its capabilities; It can generate mock data for | ||
:doc:`dataclasses <python:library/dataclasses>`, :class:`TypedDicts <typing.TypedDict>`, | ||
`Pydantic <https://docs.pydantic.dev/latest/>`_, `Odmantic <https://art049.github.io/odmantic/>`_, | ||
and `Beanie ODM <https://beanie-odm.dev/>`_ models, as well as custom factories. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
:layout: landing | ||
:description: Polyfactory is a simple and powerful mock data generation library. | ||
|
||
.. container:: | ||
:name: home-head | ||
|
||
.. image:: https://raw.githubusercontent.com/litestar-org/branding/main/assets/Branding%20-%20SVG%20-%20Transparent/Badge%20-%20Blue%20and%20Yellow.svg | ||
:alt: Litestar Framework | ||
:width: 400 | ||
:height: 400 | ||
|
||
.. container:: | ||
|
||
.. raw:: html | ||
|
||
<h1>Polyfactory</h1> | ||
|
||
.. container:: badges | ||
:name: badges | ||
|
||
.. image:: https://img.shields.io/github/actions/workflow/status/litestar-org/polyfactory/publish.yml?labelColor=202235&logo=github&logoColor=edb641 | ||
:alt: GitHub Actions Latest Release Workflow Status | ||
|
||
.. image:: https://img.shields.io/github/actions/workflow/status/litestar-org/polyfactory/ci.yml?labelColor=202235&logo=github&logoColor=edb641 | ||
:alt: GitHub Actions CI Workflow Status | ||
|
||
.. image:: https://img.shields.io/github/actions/workflow/status/litestar-org/polyfactory/docs.yml?labelColor=202235&logo=github&logoColor=edb641 | ||
:alt: GitHub Actions Docs Build Workflow Status | ||
|
||
.. image:: https://img.shields.io/codecov/c/github/litestar-org/polyfactory?labelColor=202235&logo=codecov&logoColor=edb641 | ||
:alt: Coverage | ||
|
||
.. image:: https://img.shields.io/pypi/v/polyfactory?labelColor=202235&color=edb641&logo=python&logoColor=edb641 | ||
:alt: PyPI Version | ||
|
||
.. image:: https://img.shields.io/github/all-contributors/litestar-org/polyfactory?labelColor=202235&color=edb641&logoColor=edb641 | ||
:alt: Contributor Count | ||
|
||
.. image:: https://img.shields.io/pypi/dm/polyfactory?logo=python&label=polyfactory%20downloads&labelColor=202235&color=edb641&logoColor=edb641 | ||
:alt: PyPI Downloads | ||
|
||
.. image:: https://img.shields.io/pypi/pyversions/polyfactory?labelColor=202235&color=edb641&logo=python&logoColor=edb641 | ||
:alt: Supported Python Versions | ||
|
||
.. rst-class:: lead | ||
|
||
Polyfactory is a simple and powerful mock data generation library, based around type | ||
hints and supporting :doc:`dataclasses <python:library/dataclasses>`, :class:`TypedDicts <typing.TypedDict>`, | ||
Pydantic models, :class:`msgspec Struct's <msgspec.Struct>` and more. | ||
|
||
.. container:: buttons | ||
|
||
:doc:`Get Started <getting-started>` | ||
`Usage Docs <usage>`_ | ||
`API Docs <reference>`_ | ||
`Blog <https://blog.litestar.dev>`_ | ||
|
||
.. grid:: 1 1 2 2 | ||
:padding: 0 | ||
:gutter: 2 | ||
|
||
.. grid-item-card:: :octicon:`versions` Changelog | ||
:link: changelog | ||
:link-type: doc | ||
|
||
The latest updates and enhancements to Polyfactory | ||
|
||
.. grid-item-card:: :octicon:`comment-discussion` Discussions | ||
:link: https://github.com/litestar-org/polyfactory/discussions | ||
|
||
Join discussions, pose questions, or share insights. | ||
|
||
.. grid-item-card:: :octicon:`issue-opened` Issues | ||
:link: https://github.com/litestar-org/polyfactory/issues | ||
|
||
Report issues or suggest new features. | ||
|
||
.. grid-item-card:: :octicon:`beaker` Contributing | ||
:link: contribution-guide | ||
:link-type: doc | ||
|
||
Contribute to Litestar's growth with code, docs, and more. | ||
|
||
Sponsors | ||
-------- | ||
|
||
.. rst-class:: lead | ||
|
||
Litestar is a community-driven, open-source initiative that thrives on the generous contributions of our sponsors, | ||
enabling us to pursue innovative developments and continue our mission to provide exceptional tools and resources | ||
to our users. | ||
|
||
|
||
A huge thank you to our current sponsors: | ||
|
||
.. container:: | ||
:name: sponsors-section | ||
|
||
.. grid:: 3 | ||
:class-row: surface | ||
:padding: 0 | ||
:gutter: 2 | ||
|
||
.. grid-item-card:: | ||
:link: https://github.com/scalar/scalar | ||
|
||
.. image:: https://raw.githubusercontent.com/litestar-org/branding/main/assets/sponsors/scalar.svg | ||
:alt: Scalar.com | ||
:class: sponsor | ||
|
||
`Scalar.com <https://github.com/scalar/scalar>`_ | ||
|
||
.. grid-item-card:: | ||
:link: https://telemetrysports.com/ | ||
|
||
.. image:: https://raw.githubusercontent.com/litestar-org/branding/main/assets/sponsors/telemetry-sports/unofficial-telemetry-whitebg.svg | ||
:alt: Telemetry Sports | ||
:class: sponsor | ||
|
||
`Telemetry Sports <https://telemetrysports.com/>`_ | ||
|
||
.. grid-item-card:: | ||
:link: https://www.stok.kr/ | ||
|
||
.. image:: https://avatars.githubusercontent.com/u/144093421 | ||
:alt: Stok | ||
:class: sponsor | ||
|
||
`Stok <https://www.stok.kr/>`_ | ||
|
||
We invite organizations and individuals to join our sponsorship program. | ||
By becoming a sponsor on platforms like `Polar <sponsor-polar_>`_, `GitHub <sponsor-github_>`_ | ||
and `Open Collective <sponsor-oc_>`_, you can play a pivotal role in our project's growth. | ||
|
||
On top of regular sponsorship, we engage in pledge-based sponsorship opportunities through `Polar <sponsor-polar_>`_, | ||
where you can pledge an amount towards an issue or feature you would like to see implemented. | ||
|
||
|
||
.. _sponsor-github: https://github.com/sponsors/litestar-org | ||
.. _sponsor-oc: https://opencollective.com/litestar | ||
.. _sponsor-polar: https://polar.sh/litestar-org | ||
|
||
.. toctree:: | ||
:titlesonly: | ||
:caption: Documentation | ||
:hidden: | ||
|
||
getting-started | ||
usage/index | ||
reference/index | ||
|
||
.. toctree:: | ||
:titlesonly: | ||
:caption: Contributing | ||
:hidden: | ||
|
||
changelog | ||
contribution-guide | ||
Available Issues <https://github.com/search?q=user%3Alitestar-org+state%3Aopen+label%3A%22good+first+issue%22+++no%3Aassignee+repo%3A%22polyfactory%22&type=issues> | ||
Code of Conduct <https://github.com/litestar-org/.github?tab=coc-ov-file#readme> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
constants | ||
========= | ||
|
||
|
||
.. note:: Mapping of type annotations into concrete types. | ||
This is used to normalize Python <= 3.9 annotations. | ||
|
||
.. automodule:: polyfactory.constants | ||
:members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
decorators | ||
========== | ||
|
||
.. automodule:: polyfactory.decorators | ||
:members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
exceptions | ||
========== | ||
|
||
.. automodule:: polyfactory.exceptions | ||
:members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
attrs_factory | ||
================ | ||
|
||
.. automodule:: polyfactory.factories.attrs_factory | ||
:members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
base_factory | ||
============ | ||
|
||
.. automodule:: polyfactory.factories.base |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
beanie_odm_factory | ||
================== | ||
|
||
.. automodule:: polyfactory.factories.beanie_odm_factory | ||
:members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
dataclass_factory | ||
================== | ||
|
||
.. automodule:: polyfactory.factories.dataclass_factory |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
factories | ||
========= | ||
|
||
|
||
|
||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
base | ||
dataclass_factory | ||
typed_dict_factory | ||
pydantic_factory | ||
msgspec_factory | ||
odmantic_odm_factory | ||
beanie_odm_factory | ||
attrs_factory | ||
sqlalchemy_factory |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
msgspec_factory | ||
================ | ||
|
||
.. automodule:: polyfactory.factories.msgspec_factory | ||
:members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
odmantic_odm_factory | ||
==================== | ||
|
||
.. automodule:: polyfactory.factories.odmantic_odm_factory | ||
:members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pydantic_factory | ||
================ | ||
|
||
.. automodule:: polyfactory.factories.pydantic_factory | ||
:members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sqlalchemy_factory | ||
================== | ||
|
||
.. automodule:: polyfactory.factories.sqlalchemy_factory |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
typed_dict_factory | ||
================== | ||
|
||
.. automodule:: polyfactory.factories.typed_dict_factory |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
field_meta | ||
========== | ||
|
||
.. automodule:: polyfactory.field_meta | ||
:members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fields | ||
====== | ||
|
||
.. automodule:: polyfactory.fields | ||
:members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
API Reference | ||
============= | ||
|
||
This section contains sections for API reference documentation for the ``polyfactory`` package. | ||
|
||
.. toctree:: | ||
:titlesonly: | ||
:maxdepth: 1 | ||
:caption: Articles | ||
|
||
constants | ||
exceptions | ||
factories/index | ||
field_meta | ||
fields | ||
decorators | ||
persistence | ||
pytest_plugin | ||
value_generators/index |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
persistence | ||
=========== | ||
|
||
.. automodule:: polyfactory.persistence | ||
:members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pytest_plugin | ||
============= | ||
|
||
.. automodule:: polyfactory.pytest_plugin | ||
:members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
complex_types | ||
============= | ||
|
||
.. automodule:: polyfactory.value_generators.complex_types | ||
:members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
constrained_collections | ||
======================== | ||
|
||
.. automodule:: polyfactory.value_generators.constrained_collections | ||
:members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
constrained_dates | ||
================== | ||
|
||
.. automodule:: polyfactory.value_generators.constrained_dates | ||
:members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
constrained_numbers | ||
=================== | ||
|
||
.. automodule:: polyfactory.value_generators.constrained_numbers | ||
:members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
constrained_strings | ||
=================== | ||
|
||
.. automodule:: polyfactory.value_generators.constrained_strings | ||
:members: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
value_generators | ||
================ | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
complex_types | ||
constrained_collections | ||
constrained_dates | ||
constrained_numbers | ||
constrained_strings | ||
primitives |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
primitives | ||
========== | ||
|
||
.. automodule:: polyfactory.value_generators.primitives | ||
:members: |