Factory Boss
Fake entire data schemas. Easily.
Original repository: https://github.com/mariushelf/factory_boss
Use case
Factory Boss can help you whenever you need to mock data schemas, for example when you cannot work or develop with the original data for privacy, GDPR related issues and security concerns.
Features
Factory Boss can mock entire data schemas, including relationships and dependencies between features and objects.
Schema specifications are read from a simple yaml format. The generated output is a list of dictionaries for each mocked entity, which can easily be written to a database, converted to pandas DataFrames etc.
Installation
This package is available on PyPI and can be installed with pip install factory_boss.
Usage
Mocking a data schema consists of two steps:
- Specify the schema.
- Generate data.
Specify a schema
Schemas are specified in yaml, including relationships between entities and mock rules.
See simple_schema.yaml for an example.
Generate mock data
from pprint import pprint
import yaml
from factory_boss.generator import Generator
from factory_boss.spec_parser.parser import SpecParser
with open("examples/simple_schema.yaml", "r") as f:
schema = yaml.safe_load(f)
parser = SpecParser()
parsed_spec = parser.parse(schema)
generator = Generator(parsed_spec)
instances = generator.generate()
print("INSTANCES")
print("=========")
pprint(instances)
See factory_boss/scripts/generate.py for the full script.
Roadmap
Many much, above all documentation.
Here are biggest "milestones":
- documentation
- finalize the schema specification
- support dynamic fields (generate fields via a Python function with other fields as input)
In the issues section there are some more tickets.
Contributing
I'm more than happy to accept help in the form of bug reports, feature requests, or pull requests, even though there is no formal "contribution guideline" yet.
If you want to help just reach out to me :)
Acknowledgements
This work wouldn't be possible without the amazing faker package.
Factory Boss is also heavily inspired by factory_boy, but has a different focus. While factory_boy excels at generating single objects and test fixtures, Factory Boss aims at faking entire data schemas. In that sense it offers both a subset and a superset of factory_boy's features.
License
MIT -- see LICENSE
Author: Marius Helf (helfsmarius@gmail.com)
Metadata
Release files for factory-boss 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| factory_boss-0.1.0.tar.gz | 13.5 kB | Without provenance | Details for factory_boss-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| factory_boss-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for factory_boss-0.1.0-py3-none-any.whl |
Total release size: 29.0 kB
Release files / factory_boss-0.1.0.tar.gz
| Download URL | factory_boss-0.1.0.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fea9318cbfc848781a1c529e3a299f48b76b277da638b30548eb827c20b52931
|
|
BLAKE2b-256 checksum How to use checksums |
c7c2d95e4ae1e581982a24e04b72ceacb2f62666c9aec1c6f9280571df738f65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.2
|
Release files / factory_boss-0.1.0-py3-none-any.whl
| Download URL | factory_boss-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c12668e4053d79b5e9bd05acc7f8c13db7d67bdb05d727b2825ba2c02a03c3d
|
|
BLAKE2b-256 checksum How to use checksums |
82d9955a6836826dadbb163a3cd9c3dabe0760676d0f715e466ecca394c7e35c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.2
|
Security for factory-boss 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.