{"id":23682,"library":"essential-generators","title":"Essential Generators","description":"Generate fake data for application testing based on simple but flexible templates. Version 1.0 is stable but rarely updated. Templates support inline expressions, custom functions, and nested structures. Suitable for tests, prototypes, and data fixtures.","status":"active","version":"1.0","language":"python","source_language":"en","source_url":"https://github.com/shane-mason/essential-document-generator","tags":["fake data","testing","generators","templates"],"install":[{"cmd":"pip install essential-generators","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Used for template parsing (optional for JSON only)","package":"pyyaml","optional":true}],"imports":[{"note":"The class is nested under the module; direct import is required.","wrong":"import essential_generators\nDocumentGenerator()","symbol":"DocumentGenerator","correct":"from essential_generators import DocumentGenerator"},{"note":"Second generator class for text-specific generation.","wrong":"","symbol":"MarkovTextGenerator","correct":"from essential_generators import MarkovTextGenerator"},{"note":"Generates repeating patterns from a template list.","wrong":"","symbol":"CyclicGenerator","correct":"from essential_generators import CyclicGenerator"}],"quickstart":{"code":"from essential_generators import DocumentGenerator\n\ngen = DocumentGenerator()\n\ndoc = gen.gen_document()\nprint(doc)\n\n# Generate a custom document from a template\ntemplate = {\n    'name': '{{name.first_name}} {{name.last_name}}',\n    'email': '{{email}}',\n    'address': '{{address.street}}, {{address.city}}'\n}\ncustom = gen.gen_document(template)\nprint(custom)\n\n# Generate multiple documents quickly\ndocs = gen.gen_documents(5)\nfor d in docs:\n    print(d)","lang":"python","description":"Quickstart example: create a DocumentGenerator, generate a single random document, a custom document from a template, and generate multiple documents."},"warnings":[{"fix":"Stick to one style. Use {{name.first_name}} (full path) for consistency.","message":"Templates use double-brace syntax like {{name.first_name}} but the library also supports shorthand placeholders like {{first_name}}. Mixing both can cause unexpected failures if the shorthand isn't defined.","severity":"gotcha","affected_versions":"<=1.0"},{"fix":"Avoid nesting templates inside arrays. Use the CyclicGenerator for repeating patterns instead.","message":"The library does not support nested template definitions inside lists; each element in a template list must be a primitive or a dict. Attempting to nest templates silently produces incorrect output.","severity":"gotcha","affected_versions":"<=1.0"},{"fix":"Use gen.gen_document(template=my_template) or gen.gen_documents(5).","message":"The 'gen_document' method with positional arguments (e.g., gen_document(template, count)) is deprecated. Use keyword arguments or call gen_documents() for multiple outputs.","severity":"deprecated","affected_versions":"<1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Import using underscore: 'from essential_generators import DocumentGenerator'","cause":"The package name uses a hyphen while the module uses an underscore. Some users install the package but then try to import with a hyphen.","error":"ImportError: No module named essential_generators"},{"fix":"Initialize with no arguments: gen = DocumentGenerator(). If you need a custom template directory, use gen = DocumentGenerator(template_dir='path').","cause":"The user created the generator with an invalid parameter (e.g., 'path' instead of 'template_dir') or the generator failed to initialize correctly.","error":"AttributeError: 'DocumentGenerator' object has no attribute 'gen_document'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}