Registry / testing / essential-generators

essential-generators

JSON →
library1.0pypypi✓ verified 86d ago

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.

pip install essential-generators
INSTALL
IMPORT
SIG · ESSENTIAL-GENERATO
E
essential-generators
testingpythonv1.0
Install
1.7s avg
Import
16ms
Disk
62MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.016s · 63.6MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.016s · 64MB
62MB installed
● package 62MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DocumentGenerator
from essential_generators import DocumentGenerator
import essential_generators DocumentGenerator()
The class is nested under the module; direct import is required.
MarkovTextGenerator
from essential_generators import MarkovTextGenerator
Second generator class for text-specific generation.
CyclicGenerator
from essential_generators import CyclicGenerator
Generates repeating patterns from a template list.

Quickstart example: create a DocumentGenerator, generate a single random document, a custom document from a template, and generate multiple documents.

from essential_generators import DocumentGenerator gen = DocumentGenerator() doc = gen.gen_document() print(doc) # Generate a custom document from a template template = { 'name': '{{name.first_name}} {{name.last_name}}', 'email': '{{email}}', 'address': '{{address.street}}, {{address.city}}' } custom = gen.gen_document(template) print(custom) # Generate multiple documents quickly docs = gen.gen_documents(5) for d in docs: print(d)
Debug
Known issues
gotchaTemplates 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.
fix
Stick to one style. Use {{name.first_name}} (full path) for consistency.
affects: <=1.0
gotchaThe 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.
fix
Avoid nesting templates inside arrays. Use the CyclicGenerator for repeating patterns instead.
affects: <=1.0
deprecatedThe 'gen_document' method with positional arguments (e.g., gen_document(template, count)) is deprecated. Use keyword arguments or call gen_documents() for multiple outputs.
fix
Use gen.gen_document(template=my_template) or gen.gen_documents(5).
affects: <1.0
Errors
Common errors & fixes
ImportError: No module named essential_generators
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.
fix
Import using underscore: 'from essential_generators import DocumentGenerator'
AttributeError: 'DocumentGenerator' object has no attribute 'gen_document'
The user created the generator with an invalid parameter (e.g., 'path' instead of 'template_dir') or the generator failed to initialize correctly.
fix
Initialize with no arguments: gen = DocumentGenerator(). If you need a custom template directory, use gen = DocumentGenerator(template_dir='path').
Upgrade
Version history
1.0latest on PyPI · released Dec 17, 2020
Audit
Dependencies
pyyamloptionalUsed for template parsing (optional for JSON only)
Agent activity
6 hits · last 30 days
node
6
Resources
essential-generators — pip install essential-generators · libregistry