{ "info": { "author": "Usman Ehtesham Gul", "author_email": "uehtesham90@gmail.com@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Testing", "Topic :: Utilities" ], "description": "faker-schema\n============\n\nGenerate fake data using `joke2k's\nfaker `__ and your own schema.\n\nInstallation\n------------\n\n.. code:: bash\n\n pip install faker-schema\n\nUsage\n-----\n\nGetting started\n^^^^^^^^^^^^^^^\n\n.. code:: python\n\n\n from faker_schema.faker_schema import FakerSchema\n\n schema = {'employee_id': 'uuid4', 'employee_name': 'name', 'employee address': 'address',\n 'email_address': 'email'}\n faker = FakerSchema()\n data = faker.generate_fake(schema)\n print(data)\n # {'employee_id': '956f0cf3-a954-5bff-0aaf-ee0e1b7e1e1b', 'employee_name': 'Adam Wells',\n # 'employee address': '189 Kyle Springs Suite 110\\nNorth Robin, OR 73512',\n # 'email_address': 'jmcgee@gmail.com'}\n\nAvailable Schema Types\n^^^^^^^^^^^^^^^^^^^^^^\n\nThis library is dependent on `faker `__\nfor availabble schema types. Faker provides a wide variety of data types\nvia providers. For a list of available providers, checkout\n`Providers `__ and\n`Community\nProviders `__\n\nOnce you know what types you want to generate your fake data, you can\nstart defining your own schema\n\nDefining your schema\n^^^^^^^^^^^^^^^^^^^^\n\nThe expected schema is a dictionary, where the keys are field names and\nthe values are the types of the fields. The schema dictionay can have\nnested dictionaries and lists too.\n\nLoading schemas\n^^^^^^^^^^^^^^^\n\nfaker-schema currently provides two ways of loading your schema:\n\n- JSON file\n- JSON string\n\n.. code:: python\n\n import json\n\n from faker_schema.faker_schema import FakerSchema\n from faker_schema.schema_loader import load_json_from_file, load_json_from_string\n\n schema = load_json_from_file('path_to_json_file')\n faker = FakerSchema()\n data = faker.generate_fake(schema)\n\n # OR\n\n json_string = '{\"employee_id\"\": \"uuid4\", \"employee_name\": \"name\"\", \"employee address\":\n \"address\", \"email_address\": \"email\"}'\n\n schema = load_json_from_string(json_string)\n faker = FakerSchema()\n data = faker.generate_fake(schema)\n\nYou can define your own way of loading a schema, convert it to a Python\ndictionary and pass it to the FakerSchema instance. The aim was to\nde-couple schema loading/generation from fake data generation. If you\nwant to contribute more schema loading techniques, please open a GitHub\nissue or send a pull request.\n\nUsing different locales\n^^^^^^^^^^^^^^^^^^^^^^^\n\nThe `Faker `__ library provides a list\nof different `locales `__.\nYou can choose your required locale from that list and provid it to the\nFakerSchema instance\n\n.. code:: python\n\n from faker_schema.faker_schema import FakerSchema\n\n schema = {'employee_id': 'uuid4', 'employee_name': 'name', 'employee address': 'address',\n 'email_address': 'email'}\n faker = FakerSchema(locale='it_IT')\n data = faker.generate_fake(schema)\n print(data)\n # {'employee_id': '47f8bb04-fc05-25c9-73cc-e8a22f29ee4e', 'employee_name': 'Caio Negri',\n # 'employee address': 'Stretto Davis 34\\nDamico lido, 54802 Vibo Valentia (TR)',\n # 'email_address': 'nunzia19@libero.it'}\n\nMore Schema Examples\n^^^^^^^^^^^^^^^^^^^^\n\nNested Dictionary\n^^^^^^^^^^^^^^^^^\n\n.. code:: python\n\n from faker_schema.faker_schema import FakerSchema\n\n schema = {'EmployeeInfo': {'ID': 'uuid4', 'Name': 'name', 'Contact': {'Email': 'email',\n 'Phone Number': 'phone_number'}, 'Location': {'Country Code': 'country_code',\n 'City': 'city', 'Country': 'country', 'Postal Code': 'postalcode',\n 'Address': 'street_address'}}}\n faker = FakerSchema()\n data = faker.generate_fake(schema)\n # {'EmployeeInfo': {'ID': '0751f889-0d83-d05f-4eeb-16f575c6b4a3', 'Name': 'Stacey Williams',\n # 'Contact': {'Email':'jpatterson@yahoo.com', 'Phone Number': '1-077-859-6393'},\n # 'Location': {'Country Code': 'IE', 'City': 'Dyermouth', 'Country':\n # 'United States Minor Outlying Islands', 'Postal Code': '84239',\n # 'Address': '94806 Joseph Plaza Apt. 783'}}}\n\nNested List\n^^^^^^^^^^^\n\n.. code:: python\n\n from faker_schema.faker_schema import FakerSchema\n\n schema = {'Employer': 'name', 'EmployeList': [{'Name': 'name'}, {'Name': 'name'},\n {'Name': 'name'}]}\n faker = FakerSchema()\n data = faker.generate_fake(schema)\n # {'Employer': 'Faith Knapp', 'EmployeList': [{'Name': 'Douglas Bailey'},\n # {'Name': 'Karen Rivera'}, {'Name': 'Linda Vance MD'}]}\n\nGenerating a certain number of fake data from given schema\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. code:: python\n\n\n from faker_schema.faker_schema import FakerSchema\n\n schema = {'employee_id': 'uuid4', 'employee_name': 'name', 'employee address': 'address',\n 'email_address': 'email'}\n faker = FakerSchema()\n data = faker.generate_fake(schema, iterations=4)\n print(data)\n # [{'employee_id': 'e07a7964-9636-bca6-2a58-4a69ac126dc5', 'employee_name':\n # 'Charlene Blankenship', 'employee address': '0431 Edward Mountains Suite 697\\nPort Douglas,\n # TX 96239-7277', 'email_address': 'ashley86@yahoo.com'}, {'employee_id':\n # '42b02262-3e0c-cf40-8257-4a0af122dddb', 'employee_name': 'Cheryl Stevens',\n # 'employee address': '48066 Eric Lake\\nPhillipshire, MO 57224', 'email_address':\n # 'lisa05@nash.info'}, {'employee_id': '41efbcc4-bb32-9260-b2b3-8fac29782e01',\n # 'employee_name': 'Dennis Campbell', 'employee address':\n # '52418 Diana Mills Suite 590\\nEast Mackenzie, HI 16222', 'email_address':\n # 'jennifer39@gmail.com'}, {'employee_id': '80bf12ff-2f3a-6db6-f3a6-14cb50076a46',\n # 'employee_name': 'Jimmy Avery', 'employee address':\n # '6867 Eddie Forest Apt. 735\\nBranditon, IL 32717', 'email_address': 'ashley64@griffin.com'}]\n\nBYOP (Bring Your Own Provider)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nIf you are using a community provider or you created your own provider,\nyou can use those with faker-schema as well. I will use the provider,\n`faker\\_web `__ as an\nexample.\n\nAfter `installing `__\nfaker\\_web,\n\n.. code:: python\n\n from faker import Faker\n from faker_schema import FakerSchema\n from faker_web import WebProvider\n\n fake = Faker()\n fake.add_provider(WebProvider)\n\n faker = FakerSchema(faker=fake)\n headers_schema = {'Content-Type': 'content_type', 'Server': 'server_token'}\n fake_headers = faker.generate_fake(headers_schema)\n print(fake_headers)\n # {'Content-Type': 'application/json', 'Server': 'Apache/2.0.51 (Ubuntu)'} \n\nDevelopment\n-----------\n\nRunning tests\n~~~~~~~~~~~~~\n\n- Using make\n\n.. code:: bash\n\n make test\n\n- Using nose\n\n.. code:: bash\n\n nosetests \n\n- Using nose with coverage\n\n.. code:: bash\n\n nosetests --with-coverage --cover-package=faker_schema --cover-erase -v --cover-html\n\nRunning flake8\n~~~~~~~~~~~~~~\n\n- Using make\n\n.. code:: bash\n\n make flake8\n\n- Using flake8\n\n.. code:: bash\n\n flake8 --max-line-length 99 faker_schema/ tests/\n\nAuthor\n------\n\nUsman Ehtesham Gul (`ueg1990 `__) -\nuehtesham90@gmail.com\n\nContribute\n----------\n\nIf you want to add any new features, or improve existing one or if you\nfind bugs, please open a GitHub issue or feel free to send a pull\nrequest. If you have any questions or need help/mentoring with\ncontributions, feel free to contact me via email", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ueg1990/faker-schema", "keywords": "faker fixtures data test mock generator schema", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "faker-schema", "package_url": "https://pypi.org/project/faker-schema/", "platform": "any", "project_url": "https://pypi.org/project/faker-schema/", "project_urls": { "Homepage": "https://github.com/ueg1990/faker-schema" }, "release_url": "https://pypi.org/project/faker-schema/0.1.4/", "requires_dist": null, "requires_python": "", "summary": "Generate fake data using joke2k's faker and your own schema", "version": "0.1.4" }, "last_serial": 3027463, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "bf850b447f3e5e06fbf950e59f8df8c7", "sha256": "4e223d3241b7b036949ccc5a0ef45afabf8bc48675684804142636592b2d2c3c" }, "downloads": -1, "filename": "faker-schema-0.1.0.tar.gz", "has_sig": false, "md5_digest": "bf850b447f3e5e06fbf950e59f8df8c7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2065, "upload_time": "2017-07-16T23:51:55", "url": "https://files.pythonhosted.org/packages/4f/fa/ddcd429e93850dc81e2c20ec9cec5fc8cf81a5163b5912d8b653d86bee08/faker-schema-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "4cfcb62d4092ec27cf13c14e6e3a770a", "sha256": "bf7e817444bd52be039be41310796960e8c305234421a819bfe9ab2e2d0a293d" }, "downloads": -1, "filename": "faker-schema-0.1.1.tar.gz", "has_sig": false, "md5_digest": "4cfcb62d4092ec27cf13c14e6e3a770a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2834, "upload_time": "2017-07-16T23:56:02", "url": "https://files.pythonhosted.org/packages/ee/ec/412ca2576e8b88589dd9df68e514d7408d6203199b984a97e711e6b8c8b8/faker-schema-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "a0305069027e841818c979852c93ebef", "sha256": "79ca07f269f74936cbcb220d142f8858140d76608ad5efb71b58eea6735aabf9" }, "downloads": -1, "filename": "faker-schema-0.1.2.tar.gz", "has_sig": false, "md5_digest": "a0305069027e841818c979852c93ebef", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5344, "upload_time": "2017-07-17T00:02:43", "url": "https://files.pythonhosted.org/packages/50/1d/c6479c7b61932f4dac9f8fff53e78d93109f33e12be7a62a0c641ed2f1c0/faker-schema-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "c81461843f05bd03835632b0c4d474e4", "sha256": "12dc050dd5b04d99c1c4086f9c5b4adce112cec4f595a321b52b0346ff07cc23" }, "downloads": -1, "filename": "faker-schema-0.1.3.tar.gz", "has_sig": false, "md5_digest": "c81461843f05bd03835632b0c4d474e4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5912, "upload_time": "2017-07-17T00:06:35", "url": "https://files.pythonhosted.org/packages/66/f5/7627e75745408b9091d7155e78e6664be39a316fca82902c1e7a6022ad63/faker-schema-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "5ef1a7f49a84cfcb03a2f4a788eb68f6", "sha256": "8eb3b5c26b2535d2cc905a0bdd7c9d8423efa43e1d9685643a8f2749fa7e809d" }, "downloads": -1, "filename": "faker-schema-0.1.4.tar.gz", "has_sig": false, "md5_digest": "5ef1a7f49a84cfcb03a2f4a788eb68f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6032, "upload_time": "2017-07-17T00:47:05", "url": "https://files.pythonhosted.org/packages/09/21/d0af3cd3fa41bbf780dd75e19facedf584bbd7956d7936f10595a0b49292/faker-schema-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5ef1a7f49a84cfcb03a2f4a788eb68f6", "sha256": "8eb3b5c26b2535d2cc905a0bdd7c9d8423efa43e1d9685643a8f2749fa7e809d" }, "downloads": -1, "filename": "faker-schema-0.1.4.tar.gz", "has_sig": false, "md5_digest": "5ef1a7f49a84cfcb03a2f4a788eb68f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6032, "upload_time": "2017-07-17T00:47:05", "url": "https://files.pythonhosted.org/packages/09/21/d0af3cd3fa41bbf780dd75e19facedf584bbd7956d7936f10595a0b49292/faker-schema-0.1.4.tar.gz" } ] }