# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['faketory', 'faketory.placeholders']

package_data = \
{'': ['*']}

install_requires = \
['faker>=15.1.1,<16.0.0']

setup_kwargs = {
    'name': 'faketory',
    'version': '0.1.0',
    'description': "A very simple Factory library. Generic, but compatible with Django. Let's build together!",
    'long_description': "# Faketory\n\nA simple implementation of the Factory pattern, build any number of elements with random values generated by [Faker].\n\n\n## Requirements\n\n- [Python] >= 3.7\n> IMPORTANT: This library depends on [Faker]. If by any chance you have any errors, make sure you have it installed. If you're using Python < 3.7, you can adapt this library by downgrading to a version of Faker that's compatible with it, you'll have to follow `installation for devs/contributors` and either build the library or just copying `faketory` folder into your Python project's root.\n\n\n## Installation\n\n```sh\npip install faketory\n```\n\n## Installation for devs/contributors\n\n1. Clone this repository.\n2. Run `./install.sh`.\n> Note: You can build the library for distribution by simply running `poetry build`.\n\n## Quick Start\n\n1. Create `my_file.py`, then copy and paste this code:\n\n```\nfrom faketory.factory import Faketory\nfrom faketory.fake import Fake\n\n\nclass MyModel:\n    def __init__(self, age, name, email):\n        self.age = age\n        self.name = name\n        self.email = email\n\n\nclass MyFactory(Faketory):\n    age = Fake('pyint', min_value=18, max_value=120)\n    email = Fake('email')\n    name = Fake('name')\n\n    class Meta:\n        model = MyModel\n\n# () -> Builds an instance with autogenerated values\nmy_model = MyFactory()\nprint(f'My name is {my_model.name}\\n')\n\n# (age=20) -> Custom value\nmy_model_custom = MyFactory(age=20)\nprint(f'My age is {my_model_custom.age}\\n')  # 20\n\n# (_qty=9) -> Builds a list of 9 objects\nmy_models_list = MyFactory(_qty=9)\nfor index, my_mod in enumerate(my_models_list):\n    print(f'{index + 1} {my_mod.email}')\n\n```\n\n2. Run the file using `python my_file.py`.\n\n\n## Tutorial\n\n1. Import Fake and Faketory:\n\n```\nfrom faketory.fake import Fake\nfrom faketory.factory import Faketory\n```\n\n2. Import your Model(s):\n\n```\nfrom my_poject.models import MyModel\n```\n\n3. Create your Factory by passing Fake generators to each field you want to pass values in your Model constructor. Also add your Model to the model attribute of the Meta class:\n\n```\nclass MyFactory(Faketory):\n    my_field = Fake('name')\n    my_other_field = Fake('text')\n\n    class Meta:\n        model = MyModel\n```\n> Note: You can pass any value to any field to your Model constructor instead of a Fake generator.\n\n4. Create your single Model instance:\n\n```\nmy_model_instance = MyFactory()\n```\n\nNow the attributes of `my_model_instance` will have randomly generated values by faker. For example, `my_field` could be 'Jon' and `my_other_field` could be 'Some text here'.\n\n\n## Faketory\n\nBuilds 1 or more fake model instances of a Model class.\n- `_qty`: Number of fake model instances to return. Minimum value is 1.\n- `_resolver`: Function to resolve once the model instance is created. (Check Django ORM example below)\n- `_type`: Define the type of the model instance you want to return. Default: 'list', but you can have 'generator' or 'set' instead.\n- `**custom_fields`: These fields will override the Fake generated values of the Factory.\n\n\n## Django ORM example\n\nYou can pass any Django Model to `Faketory.Meta.model`, but if you want to save it to your database, make sure you pass `_resolver='save'` to your Faketory instance.\n\n```\nclass SampleDjangoFactory(Faketory):\n    email = Fake('email')\n    name = Fake('name')\n\n    class Meta:\n        model = MyDjangoModel\n\nmy_django_instance = Factory(_resolver='save')\n\n```\n\n\n## Fake\n\nThis class simply calls the functions you get from Faker object, so you should check their docs. Here a quick example of how you can generate a fake name:\n\n#### Faker\n\n```\nfrom faker import Faker\n\n\nfake = Faker()\n\n# Generate a name\nfirst_name = fake.name()\n\n```\n\n#### Fake\n```\nfrom faketory import Fake\n\n\nfirst_name = Fake('name').generate()\n\n```\n\n#### Generate a random number\n\n```\n# Faker\nfake.pyint(min_value=18, max_value=21)\n\n# Fake\nFake('pyint', min_value=18, max_value=21).generate()\n```\n\n#### Generate unique random numbers\n\n```\n# Faker\nnumbers = set(\n    fake.unique.random_int(min=1, max=10) for i in range(10)\n)\n\n# Fake\nnumbers = set(\n    Fake('unique.random_int', min=1, max=10).generate() for i in range(10)\n)\n```\n\n\n## Creator\n\nWαя€vเℓ - <jg@warevil.dev>\n\n[Faker]: <https://pypi.org/project/Faker/>\n[Python]: <https://www.python.org/downloads/>",
    'author': 'warevil',
    'author_email': 'jg@warevil.dev',
    'maintainer': 'None',
    'maintainer_email': 'None',
    'url': 'None',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.7,<4.0',
}


setup(**setup_kwargs)
