pydantic-fixturegen 1.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pydantic_fixturegen-1.2.0/.gitignore +20 -0
- pydantic_fixturegen-1.2.0/.vscode/README.md +13 -0
- pydantic_fixturegen-1.2.0/LICENSE +21 -0
- pydantic_fixturegen-1.2.0/PKG-INFO +256 -0
- pydantic_fixturegen-1.2.0/README.md +119 -0
- pydantic_fixturegen-1.2.0/docs/alternatives.md +102 -0
- pydantic_fixturegen-1.2.0/docs/api.md +197 -0
- pydantic_fixturegen-1.2.0/docs/architecture.md +42 -0
- pydantic_fixturegen-1.2.0/docs/cli.md +394 -0
- pydantic_fixturegen-1.2.0/docs/commands/index.md +41 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-anonymize.md +93 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-check.md +63 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-diff.md +89 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-doctor.md +63 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-fastapi-serve.md +65 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-fastapi-smoke.md +67 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-gen-dataset.md +100 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-gen-examples.md +71 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-gen-explain.md +74 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-gen-fixtures.md +106 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-gen-json.md +140 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-gen-openapi.md +95 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-gen-polyfactory.md +62 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-gen-schema.md +78 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-gen-seed-beanie.md +75 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-gen-seed-sqlmodel.md +81 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-gen-strategies.md +71 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-init.md +68 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-list.md +62 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-lock.md +56 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-plugin.md +62 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-schema-config.md +45 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-snapshot-verify.md +74 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-snapshot-write.md +66 -0
- pydantic_fixturegen-1.2.0/docs/commands/pfg-verify.md +56 -0
- pydantic_fixturegen-1.2.0/docs/concepts.md +36 -0
- pydantic_fixturegen-1.2.0/docs/configuration.md +373 -0
- pydantic_fixturegen-1.2.0/docs/cookbook.md +212 -0
- pydantic_fixturegen-1.2.0/docs/discovery.md +43 -0
- pydantic_fixturegen-1.2.0/docs/doctor.md +52 -0
- pydantic_fixturegen-1.2.0/docs/emitters.md +61 -0
- pydantic_fixturegen-1.2.0/docs/explain.md +85 -0
- pydantic_fixturegen-1.2.0/docs/features.md +121 -0
- pydantic_fixturegen-1.2.0/docs/index.md +46 -0
- pydantic_fixturegen-1.2.0/docs/install.md +102 -0
- pydantic_fixturegen-1.2.0/docs/kitgrid.yaml +144 -0
- pydantic_fixturegen-1.2.0/docs/logging.md +49 -0
- pydantic_fixturegen-1.2.0/docs/output-paths.md +37 -0
- pydantic_fixturegen-1.2.0/docs/presets.md +32 -0
- pydantic_fixturegen-1.2.0/docs/providers.md +103 -0
- pydantic_fixturegen-1.2.0/docs/quickstart.md +192 -0
- pydantic_fixturegen-1.2.0/docs/security.md +33 -0
- pydantic_fixturegen-1.2.0/docs/seeds.md +44 -0
- pydantic_fixturegen-1.2.0/docs/strategies.md +48 -0
- pydantic_fixturegen-1.2.0/docs/testing.md +164 -0
- pydantic_fixturegen-1.2.0/docs/troubleshooting.md +33 -0
- pydantic_fixturegen-1.2.0/docs/vscode.md +49 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/__init__.py +12 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/_warnings.py +26 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/anonymize/__init__.py +23 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/anonymize/pipeline.py +521 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/api/__init__.py +217 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/api/_runtime.py +1557 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/api/anonymize.py +51 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/api/models.py +95 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/__init__.py +144 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/_typer_compat.py +58 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/anonymize.py +370 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/check.py +250 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/diff.py +1384 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/doctor.py +594 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/fastapi.py +111 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/gen/__init__.py +39 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/gen/_common.py +512 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/gen/dataset.py +463 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/gen/examples.py +161 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/gen/explain.py +1019 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/gen/fixtures.py +524 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/gen/json.py +555 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/gen/openapi.py +229 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/gen/polyfactory.py +268 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/gen/schema.py +261 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/gen/seed.py +516 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/gen/strategies.py +249 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/init.py +333 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/list.py +164 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/lock.py +101 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/plugin.py +493 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/schema.py +46 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/snapshot.py +342 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/verify.py +94 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/cli/watch.py +126 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/__init__.py +109 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/ast_discover.py +169 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/config.py +1140 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/config_schema.py +358 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/constraint_report.py +306 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/cycle_report.py +74 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/errors.py +178 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/extra_types.py +155 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/field_policies.py +100 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/generate.py +1440 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/heuristics.py +574 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/introspect.py +141 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/io_utils.py +85 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/openapi.py +270 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/overrides.py +405 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/path_template.py +204 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/presets.py +73 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/privacy_profiles.py +147 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/providers/__init__.py +42 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/providers/collections.py +74 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/providers/extra_types.py +318 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/providers/identifiers.py +311 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/providers/numbers.py +223 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/providers/numpy_arrays.py +116 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/providers/paths.py +189 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/providers/registry.py +98 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/providers/strings.py +143 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/providers/temporal.py +52 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/safe_import.py +537 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/schema.py +426 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/schema_ingest.py +586 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/seed.py +196 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/seed_freeze.py +183 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/strategies.py +332 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/core/version.py +55 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/coverage/manifest.py +254 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/emitters/__init__.py +15 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/emitters/dataset_out.py +342 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/emitters/json_out.py +428 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/emitters/pytest_codegen.py +477 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/emitters/schema_out.py +108 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/fastapi_support/__init__.py +13 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/fastapi_support/loader.py +127 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/fastapi_support/mock.py +86 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/fastapi_support/smoke.py +165 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/hypothesis/__init__.py +7 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/hypothesis/exporter.py +499 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/logging.py +114 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/orm/__init__.py +1 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/orm/beanie.py +125 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/orm/sqlalchemy.py +113 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/plugins/builtin.py +45 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/plugins/hookspecs.py +67 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/plugins/loader.py +72 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/polyfactory_support/__init__.py +12 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/polyfactory_support/discovery.py +203 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/polyfactory_support/runtime.py +99 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/schemas/config.schema.json +484 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/testing/__init__.py +25 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/testing/pytest_plugin.py +120 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/testing/seeders.py +40 -0
- pydantic_fixturegen-1.2.0/pydantic_fixturegen/testing/snapshot.py +384 -0
- pydantic_fixturegen-1.2.0/pyproject.toml +330 -0
- pydantic_fixturegen-1.2.0/tests/_cli.py +14 -0
- pydantic_fixturegen-1.2.0/tests/anonymize/test_api_helpers.py +40 -0
- pydantic_fixturegen-1.2.0/tests/anonymize/test_pipeline.py +295 -0
- pydantic_fixturegen-1.2.0/tests/anonymize/test_pipeline_rules.py +16 -0
- pydantic_fixturegen-1.2.0/tests/api/test_api_generate.py +251 -0
- pydantic_fixturegen-1.2.0/tests/api/test_dataset_api.py +40 -0
- pydantic_fixturegen-1.2.0/tests/api/test_models_dataclasses.py +84 -0
- pydantic_fixturegen-1.2.0/tests/api/test_public_api.py +35 -0
- pydantic_fixturegen-1.2.0/tests/api/test_runtime_generate.py +1991 -0
- pydantic_fixturegen-1.2.0/tests/api/test_runtime_helpers.py +270 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_anonymize_cli.py +186 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_anonymize_helpers.py +143 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_check.py +390 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_cli_entrypoint.py +30 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_cli_errors.py +83 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_cli_proxy.py +75 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_common_helpers.py +170 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_config_loader_errors.py +33 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_diff.py +570 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_diff_branches.py +739 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_diff_hints.py +61 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_doctor.py +711 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_explain.py +1000 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_gen_dataset.py +108 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_gen_dataset_cli.py +485 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_gen_examples.py +174 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_gen_fixtures.py +764 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_gen_group.py +11 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_gen_json.py +1177 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_gen_openapi.py +434 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_gen_polyfactory.py +310 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_gen_schema.py +573 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_gen_seed.py +159 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_gen_seed_helpers.py +352 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_gen_strategies.py +292 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_init.py +262 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_list.py +248 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_lock_verify.py +132 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_logging.py +114 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_plugin.py +167 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_schema_config.py +27 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_seed_freeze_cli.py +176 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_snapshot_cli.py +106 -0
- pydantic_fixturegen-1.2.0/tests/cli/test_watch_mode.py +221 -0
- pydantic_fixturegen-1.2.0/tests/conftest.py +8 -0
- pydantic_fixturegen-1.2.0/tests/core/test_ast_discover.py +113 -0
- pydantic_fixturegen-1.2.0/tests/core/test_config.py +1033 -0
- pydantic_fixturegen-1.2.0/tests/core/test_config_env.py +114 -0
- pydantic_fixturegen-1.2.0/tests/core/test_config_schema.py +21 -0
- pydantic_fixturegen-1.2.0/tests/core/test_constraint_reporter.py +271 -0
- pydantic_fixturegen-1.2.0/tests/core/test_core_public_api.py +20 -0
- pydantic_fixturegen-1.2.0/tests/core/test_cycle_report.py +38 -0
- pydantic_fixturegen-1.2.0/tests/core/test_errors.py +45 -0
- pydantic_fixturegen-1.2.0/tests/core/test_field_overrides.py +100 -0
- pydantic_fixturegen-1.2.0/tests/core/test_field_policies.py +61 -0
- pydantic_fixturegen-1.2.0/tests/core/test_generate.py +680 -0
- pydantic_fixturegen-1.2.0/tests/core/test_introspect.py +101 -0
- pydantic_fixturegen-1.2.0/tests/core/test_io_utils.py +58 -0
- pydantic_fixturegen-1.2.0/tests/core/test_path_template.py +115 -0
- pydantic_fixturegen-1.2.0/tests/core/test_presets_module.py +24 -0
- pydantic_fixturegen-1.2.0/tests/core/test_privacy_profiles.py +38 -0
- pydantic_fixturegen-1.2.0/tests/core/test_provider_identifiers.py +193 -0
- pydantic_fixturegen-1.2.0/tests/core/test_provider_numbers.py +110 -0
- pydantic_fixturegen-1.2.0/tests/core/test_provider_numpy_arrays.py +122 -0
- pydantic_fixturegen-1.2.0/tests/core/test_provider_paths.py +99 -0
- pydantic_fixturegen-1.2.0/tests/core/test_provider_strings.py +94 -0
- pydantic_fixturegen-1.2.0/tests/core/test_providers.py +646 -0
- pydantic_fixturegen-1.2.0/tests/core/test_providers_init.py +44 -0
- pydantic_fixturegen-1.2.0/tests/core/test_safe_import.py +153 -0
- pydantic_fixturegen-1.2.0/tests/core/test_schema_constraints.py +258 -0
- pydantic_fixturegen-1.2.0/tests/core/test_schema_extra_types.py +62 -0
- pydantic_fixturegen-1.2.0/tests/core/test_schema_ingest.py +398 -0
- pydantic_fixturegen-1.2.0/tests/core/test_seed.py +151 -0
- pydantic_fixturegen-1.2.0/tests/core/test_seed_freeze.py +52 -0
- pydantic_fixturegen-1.2.0/tests/core/test_strategies.py +109 -0
- pydantic_fixturegen-1.2.0/tests/core/test_version.py +55 -0
- pydantic_fixturegen-1.2.0/tests/coverage/test_manifest.py +175 -0
- pydantic_fixturegen-1.2.0/tests/e2e/test_cli_all_commands.py +193 -0
- pydantic_fixturegen-1.2.0/tests/e2e/test_cli_diff.py +62 -0
- pydantic_fixturegen-1.2.0/tests/e2e/test_cli_profiles.py +162 -0
- pydantic_fixturegen-1.2.0/tests/e2e/test_cli_workflows.py +340 -0
- pydantic_fixturegen-1.2.0/tests/e2e/test_determinism.py +123 -0
- pydantic_fixturegen-1.2.0/tests/emitters/test_dataset_helpers.py +104 -0
- pydantic_fixturegen-1.2.0/tests/emitters/test_dataset_out.py +93 -0
- pydantic_fixturegen-1.2.0/tests/emitters/test_json_out.py +103 -0
- pydantic_fixturegen-1.2.0/tests/emitters/test_json_out_additional.py +107 -0
- pydantic_fixturegen-1.2.0/tests/emitters/test_pytest_codegen.py +130 -0
- pydantic_fixturegen-1.2.0/tests/emitters/test_pytest_codegen_styles.py +63 -0
- pydantic_fixturegen-1.2.0/tests/emitters/test_schema_out.py +94 -0
- pydantic_fixturegen-1.2.0/tests/fastapi/test_fastapi_cli.py +178 -0
- pydantic_fixturegen-1.2.0/tests/fastapi/test_mock_server.py +135 -0
- pydantic_fixturegen-1.2.0/tests/hypothesis/test_exporter_helpers.py +422 -0
- pydantic_fixturegen-1.2.0/tests/hypothesis/test_strategy_exporter.py +34 -0
- pydantic_fixturegen-1.2.0/tests/orm/test_beanie_helpers.py +66 -0
- pydantic_fixturegen-1.2.0/tests/orm/test_sqlalchemy_helpers.py +65 -0
- pydantic_fixturegen-1.2.0/tests/perf/test_json_workers.py +47 -0
- pydantic_fixturegen-1.2.0/tests/plugins/test_hooks.py +102 -0
- pydantic_fixturegen-1.2.0/tests/polyfactory/test_discovery.py +133 -0
- pydantic_fixturegen-1.2.0/tests/polyfactory/test_runtime.py +94 -0
- pydantic_fixturegen-1.2.0/tests/providers/test_collections_additional.py +95 -0
- pydantic_fixturegen-1.2.0/tests/providers/test_extra_types.py +176 -0
- pydantic_fixturegen-1.2.0/tests/providers/test_numbers_additional.py +151 -0
- pydantic_fixturegen-1.2.0/tests/providers/test_paths_additional.py +127 -0
- pydantic_fixturegen-1.2.0/tests/providers/test_strings_additional.py +53 -0
- pydantic_fixturegen-1.2.0/tests/security/test_sandbox.py +91 -0
- pydantic_fixturegen-1.2.0/tests/test_app_logging.py +49 -0
- pydantic_fixturegen-1.2.0/tests/test_imports.py +17 -0
- pydantic_fixturegen-1.2.0/tests/testing/test_pytest_plugin_helpers.py +120 -0
- pydantic_fixturegen-1.2.0/tests/testing/test_pytest_snapshot_helpers.py +138 -0
- pydantic_fixturegen-1.2.0/tests/testing/test_seeders.py +70 -0
- pydantic_fixturegen-1.2.0/tests/testing/test_snapshot_helper.py +119 -0
- pydantic_fixturegen-1.2.0/tests/testing/test_snapshot_module_helpers.py +173 -0
- pydantic_fixturegen-1.2.0/tests/testing/test_snapshot_runner.py +226 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# VS Code workspace support
|
|
2
|
+
|
|
3
|
+
This folder contains reusable automation for `pfg` when working inside Visual Studio Code.
|
|
4
|
+
|
|
5
|
+
- `tasks.json` defines common commands (generate JSON/fixtures/schema, check, doctor) and prompts for module path, output destination, include filters, and seed. Each task appends `--json-errors` so diagnostics are structured.
|
|
6
|
+
- `problem-matchers.json` registers the `$pfg-json-errors` matcher that understands the CLI's JSON error payloads and maps them to VS Code Problems entries with file, line, and severity.
|
|
7
|
+
|
|
8
|
+
To use:
|
|
9
|
+
1. Open the repository in VS Code and allow the workspace tasks.
|
|
10
|
+
2. Run `Tasks: Run Task` from the Command Palette and choose a `PFG:` entry.
|
|
11
|
+
3. Inspect the Problems panel for any reported issues.
|
|
12
|
+
|
|
13
|
+
You can copy or customise these files for other projects that rely on `pfg`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 pydantic-fixturegen contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pydantic-fixturegen
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: Deterministic fixture generator for Pydantic models.
|
|
5
|
+
Project-URL: Homepage, https://github.com/casper-kristiansson/pydantic-fixturegen
|
|
6
|
+
Project-URL: Documentation, https://github.com/casper-kristiansson/pydantic-fixturegen
|
|
7
|
+
Project-URL: Repository, https://github.com/casper-kristiansson/pydantic-fixturegen
|
|
8
|
+
Author: Fixturegen Developers
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Requires-Dist: click>=8.1.7
|
|
22
|
+
Requires-Dist: faker>=3.0.0
|
|
23
|
+
Requires-Dist: pluggy>=1.5.0
|
|
24
|
+
Requires-Dist: pydantic>=2.12.4
|
|
25
|
+
Requires-Dist: tomli>=2.0.1; python_version < '3.11'
|
|
26
|
+
Requires-Dist: typer>=0.12.4
|
|
27
|
+
Provides-Extra: all
|
|
28
|
+
Requires-Dist: beanie>=2.0.0; extra == 'all'
|
|
29
|
+
Requires-Dist: datamodel-code-generator>=0.35.0; extra == 'all'
|
|
30
|
+
Requires-Dist: email-validator>=2.0.0; extra == 'all'
|
|
31
|
+
Requires-Dist: fastapi>=0.115.0; extra == 'all'
|
|
32
|
+
Requires-Dist: httpx>=0.28.1; extra == 'all'
|
|
33
|
+
Requires-Dist: hypothesis>=1.0.0; extra == 'all'
|
|
34
|
+
Requires-Dist: mongomock-motor>=0.0.36; extra == 'all'
|
|
35
|
+
Requires-Dist: motor>=3.7.1; extra == 'all'
|
|
36
|
+
Requires-Dist: numpy>=2.2.6; (python_version < '3.11') and extra == 'all'
|
|
37
|
+
Requires-Dist: numpy>=2.3.2; (python_version >= '3.11') and extra == 'all'
|
|
38
|
+
Requires-Dist: orjson>=3.11.1; extra == 'all'
|
|
39
|
+
Requires-Dist: polyfactory>=2.22.0; extra == 'all'
|
|
40
|
+
Requires-Dist: pyarrow>=17.0.0; extra == 'all'
|
|
41
|
+
Requires-Dist: pydantic-extra-types>=2.6.0; extra == 'all'
|
|
42
|
+
Requires-Dist: pytest-regressions>=2.8.3; extra == 'all'
|
|
43
|
+
Requires-Dist: python-ulid>=2.2.0; extra == 'all'
|
|
44
|
+
Requires-Dist: pyyaml>=6.0.1; extra == 'all'
|
|
45
|
+
Requires-Dist: rstr>=3.2.2; extra == 'all'
|
|
46
|
+
Requires-Dist: semver>=3.0.0; extra == 'all'
|
|
47
|
+
Requires-Dist: sqlalchemy>=2.0.44; extra == 'all'
|
|
48
|
+
Requires-Dist: sqlmodel>=0.0.27; extra == 'all'
|
|
49
|
+
Requires-Dist: uvicorn>=0.32.0; extra == 'all'
|
|
50
|
+
Requires-Dist: watchfiles>=0.20.0; extra == 'all'
|
|
51
|
+
Provides-Extra: all-dev
|
|
52
|
+
Requires-Dist: beanie>=2.0.0; extra == 'all-dev'
|
|
53
|
+
Requires-Dist: datamodel-code-generator>=0.35.0; extra == 'all-dev'
|
|
54
|
+
Requires-Dist: email-validator>=2.0.0; extra == 'all-dev'
|
|
55
|
+
Requires-Dist: fastapi>=0.115.0; extra == 'all-dev'
|
|
56
|
+
Requires-Dist: httpx>=0.28.1; extra == 'all-dev'
|
|
57
|
+
Requires-Dist: hypothesis>=1.0.0; extra == 'all-dev'
|
|
58
|
+
Requires-Dist: mongomock-motor>=0.0.36; extra == 'all-dev'
|
|
59
|
+
Requires-Dist: motor>=3.7.1; extra == 'all-dev'
|
|
60
|
+
Requires-Dist: mypy>=1.11; extra == 'all-dev'
|
|
61
|
+
Requires-Dist: numpy>=2.2.6; (python_version < '3.11') and extra == 'all-dev'
|
|
62
|
+
Requires-Dist: numpy>=2.3.2; (python_version >= '3.11') and extra == 'all-dev'
|
|
63
|
+
Requires-Dist: orjson>=3.11.1; extra == 'all-dev'
|
|
64
|
+
Requires-Dist: polyfactory>=2.22.0; extra == 'all-dev'
|
|
65
|
+
Requires-Dist: pyarrow>=17.0.0; extra == 'all-dev'
|
|
66
|
+
Requires-Dist: pydantic-extra-types>=2.6.0; extra == 'all-dev'
|
|
67
|
+
Requires-Dist: pytest-cov>=5.0; extra == 'all-dev'
|
|
68
|
+
Requires-Dist: pytest-regressions>=2.8.3; extra == 'all-dev'
|
|
69
|
+
Requires-Dist: pytest>=8.3; extra == 'all-dev'
|
|
70
|
+
Requires-Dist: python-ulid>=2.2.0; extra == 'all-dev'
|
|
71
|
+
Requires-Dist: pyyaml>=6.0.1; extra == 'all-dev'
|
|
72
|
+
Requires-Dist: rstr>=3.2.2; extra == 'all-dev'
|
|
73
|
+
Requires-Dist: ruff>=0.6.5; extra == 'all-dev'
|
|
74
|
+
Requires-Dist: semantic-version>=2.10.0; extra == 'all-dev'
|
|
75
|
+
Requires-Dist: semver>=3.0.0; extra == 'all-dev'
|
|
76
|
+
Requires-Dist: sqlalchemy>=2.0.44; extra == 'all-dev'
|
|
77
|
+
Requires-Dist: sqlmodel>=0.0.27; extra == 'all-dev'
|
|
78
|
+
Requires-Dist: uvicorn>=0.32.0; extra == 'all-dev'
|
|
79
|
+
Requires-Dist: watchfiles>=0.20.0; extra == 'all-dev'
|
|
80
|
+
Provides-Extra: beanie
|
|
81
|
+
Requires-Dist: beanie>=2.0.0; extra == 'beanie'
|
|
82
|
+
Requires-Dist: motor>=3.7.1; extra == 'beanie'
|
|
83
|
+
Provides-Extra: dataset
|
|
84
|
+
Requires-Dist: pyarrow>=17.0.0; extra == 'dataset'
|
|
85
|
+
Provides-Extra: dev
|
|
86
|
+
Requires-Dist: mypy>=1.11; extra == 'dev'
|
|
87
|
+
Provides-Extra: docs
|
|
88
|
+
Provides-Extra: email
|
|
89
|
+
Requires-Dist: email-validator>=2.0.0; extra == 'email'
|
|
90
|
+
Provides-Extra: fastapi
|
|
91
|
+
Requires-Dist: fastapi>=0.115.0; extra == 'fastapi'
|
|
92
|
+
Requires-Dist: httpx>=0.28.1; extra == 'fastapi'
|
|
93
|
+
Requires-Dist: uvicorn>=0.32.0; extra == 'fastapi'
|
|
94
|
+
Provides-Extra: hypothesis
|
|
95
|
+
Requires-Dist: hypothesis>=1.0.0; extra == 'hypothesis'
|
|
96
|
+
Provides-Extra: lint
|
|
97
|
+
Requires-Dist: ruff>=0.6.5; extra == 'lint'
|
|
98
|
+
Provides-Extra: numpy
|
|
99
|
+
Requires-Dist: numpy>=2.2.6; (python_version < '3.11') and extra == 'numpy'
|
|
100
|
+
Requires-Dist: numpy>=2.3.2; (python_version >= '3.11') and extra == 'numpy'
|
|
101
|
+
Provides-Extra: openapi
|
|
102
|
+
Requires-Dist: datamodel-code-generator>=0.35.0; extra == 'openapi'
|
|
103
|
+
Requires-Dist: pyyaml>=6.0.1; extra == 'openapi'
|
|
104
|
+
Provides-Extra: orjson
|
|
105
|
+
Requires-Dist: orjson>=3.11.1; extra == 'orjson'
|
|
106
|
+
Provides-Extra: payment
|
|
107
|
+
Requires-Dist: pydantic-extra-types>=2.6.0; extra == 'payment'
|
|
108
|
+
Requires-Dist: python-ulid>=2.2.0; extra == 'payment'
|
|
109
|
+
Requires-Dist: semantic-version>=2.10.0; extra == 'payment'
|
|
110
|
+
Requires-Dist: semver>=3.0.0; extra == 'payment'
|
|
111
|
+
Provides-Extra: polyfactory
|
|
112
|
+
Requires-Dist: polyfactory>=2.22.0; extra == 'polyfactory'
|
|
113
|
+
Provides-Extra: regex
|
|
114
|
+
Requires-Dist: rstr>=3.2.2; extra == 'regex'
|
|
115
|
+
Provides-Extra: seed
|
|
116
|
+
Requires-Dist: beanie>=2.0.0; extra == 'seed'
|
|
117
|
+
Requires-Dist: mongomock-motor>=0.0.36; extra == 'seed'
|
|
118
|
+
Requires-Dist: motor>=3.7.1; extra == 'seed'
|
|
119
|
+
Requires-Dist: sqlalchemy>=2.0.44; extra == 'seed'
|
|
120
|
+
Requires-Dist: sqlmodel>=0.0.27; extra == 'seed'
|
|
121
|
+
Provides-Extra: sqlmodel
|
|
122
|
+
Requires-Dist: sqlalchemy>=2.0.44; extra == 'sqlmodel'
|
|
123
|
+
Requires-Dist: sqlmodel>=0.0.27; extra == 'sqlmodel'
|
|
124
|
+
Provides-Extra: test
|
|
125
|
+
Requires-Dist: beanie>=2.0.0; extra == 'test'
|
|
126
|
+
Requires-Dist: mongomock-motor>=0.0.36; extra == 'test'
|
|
127
|
+
Requires-Dist: motor>=3.7.1; extra == 'test'
|
|
128
|
+
Requires-Dist: pyarrow>=17.0.0; extra == 'test'
|
|
129
|
+
Requires-Dist: pytest-cov>=5.0; extra == 'test'
|
|
130
|
+
Requires-Dist: pytest-regressions>=2.8.3; extra == 'test'
|
|
131
|
+
Requires-Dist: pytest>=8.3; extra == 'test'
|
|
132
|
+
Requires-Dist: sqlalchemy>=2.0.44; extra == 'test'
|
|
133
|
+
Requires-Dist: sqlmodel>=0.0.27; extra == 'test'
|
|
134
|
+
Provides-Extra: watch
|
|
135
|
+
Requires-Dist: watchfiles>=0.20.0; extra == 'watch'
|
|
136
|
+
Description-Content-Type: text/markdown
|
|
137
|
+
|
|
138
|
+
# pydantic-fixturegen: deterministic Pydantic fixtures, JSON generator, secure sandbox
|
|
139
|
+
|
|
140
|
+
> Pydantic v2 deterministic fixtures, pytest fixtures, JSON generator, secure sandboxed CLI with Pluggy providers.
|
|
141
|
+
|
|
142
|
+
[](https://pypi.org/project/pydantic-fixturegen/)
|
|
143
|
+

|
|
144
|
+

|
|
145
|
+
|
|
146
|
+
Generate deterministic Pydantic v2 data, pytest fixtures, and JSON quickly with a safe, task-focused CLI built for modern testing workflows.
|
|
147
|
+
|
|
148
|
+
📘 Read the full docs and examples at [pydantic-fixturegen.kitgrid.dev](https://pydantic-fixturegen.kitgrid.dev/).
|
|
149
|
+
|
|
150
|
+
## Why
|
|
151
|
+
|
|
152
|
+
<a id="why"></a>
|
|
153
|
+
<a id="features"></a>
|
|
154
|
+
|
|
155
|
+
- You keep tests reproducible with cascaded seeds across `random`, Faker, and optional NumPy.
|
|
156
|
+
- You run untrusted models inside a safe-import sandbox with network, filesystem, and memory guards.
|
|
157
|
+
- You drive JSON, pytest fixtures, schemas, and explanations from the CLI or Python helpers.
|
|
158
|
+
- You extend generation with Pluggy providers and preset bundles without forking core code.
|
|
159
|
+
|
|
160
|
+
You also stay observant while you work: every command can emit structured logs, diff artifacts against disk, and surface sandbox warnings so you catch regressions before they land.
|
|
161
|
+
|
|
162
|
+
## Install
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
pip install pydantic-fixturegen
|
|
166
|
+
# Extras: orjson, regex, hypothesis, watch
|
|
167
|
+
pip install 'pydantic-fixturegen[all]'
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Other flows → [docs/install.md](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/install.md)
|
|
171
|
+
|
|
172
|
+
## Quick start
|
|
173
|
+
|
|
174
|
+
<a id="quickstart"></a>
|
|
175
|
+
|
|
176
|
+
1. Create a small Pydantic v2 model file.
|
|
177
|
+
2. List models: `pfg list ./models.py`
|
|
178
|
+
3. Generate JSON: `pfg gen json ./models.py --include models.User --n 2 --indent 2 --out ./out/User`
|
|
179
|
+
4. Generate fixtures: `pfg gen fixtures ./models.py --out tests/fixtures/test_user.py --cases 3`
|
|
180
|
+
Full steps → [docs/quickstart.md](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/quickstart.md)
|
|
181
|
+
|
|
182
|
+
JSON, fixtures, and schema commands all share flags like `--include`, `--exclude`, `--seed`, `--preset`, and `--watch`, so once you learn one flow you can handle the rest without re-reading the help pages.
|
|
183
|
+
|
|
184
|
+
## Basics
|
|
185
|
+
|
|
186
|
+
### Core usage (top 5)
|
|
187
|
+
|
|
188
|
+
<a id="cli"></a>
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
pfg list <path>
|
|
192
|
+
pfg gen json <target> [--n --jsonl --indent --out]
|
|
193
|
+
pfg gen fixtures <target> [--style --scope --cases --out]
|
|
194
|
+
pfg gen schema <target> --out <file>
|
|
195
|
+
pfg doctor <target>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
- `pfg list` discovers models with AST or safe-import; add `--ast` when you must avoid imports.
|
|
199
|
+
- `pfg gen json` emits JSON or JSONL; scale with `--n`, `--jsonl`, `--shard-size`, and `--freeze-seeds`.
|
|
200
|
+
- `pfg gen fixtures` writes pytest modules; tune `--style`, `--scope`, `--cases`, and `--return-type`.
|
|
201
|
+
- `pfg gen schema` dumps JSON Schema atomically; point `--out` at a file or directory template.
|
|
202
|
+
- `pfg doctor` audits coverage and sandbox warnings; fail builds with `--fail-on-gaps`.
|
|
203
|
+
|
|
204
|
+
All commands → [docs/cli.md](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/cli.md)
|
|
205
|
+
|
|
206
|
+
### Basic configuration
|
|
207
|
+
|
|
208
|
+
<a id="configuration-precedence"></a>
|
|
209
|
+
|
|
210
|
+
| key | type | default | purpose |
|
|
211
|
+
| --------------------- | ---------------- | --------- | ------------- |
|
|
212
|
+
| seed | int \ str \ null | null | Global seed |
|
|
213
|
+
| locale | str | en_US | Faker locale |
|
|
214
|
+
| union_policy | enum | first | Union branch |
|
|
215
|
+
| enum_policy | enum | first | Enum choice |
|
|
216
|
+
| json.indent | int | 2 | Pretty JSON |
|
|
217
|
+
| json.orjson | bool | false | Fast JSON |
|
|
218
|
+
| emitters.pytest.style | enum | functions | Fixture style |
|
|
219
|
+
| emitters.pytest.scope | enum | function | Fixture scope |
|
|
220
|
+
|
|
221
|
+
```toml
|
|
222
|
+
[tool.pydantic_fixturegen]
|
|
223
|
+
seed = 42
|
|
224
|
+
[tool.pydantic_fixturegen.json]
|
|
225
|
+
indent = 2
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Full matrix and precedence → [docs/configuration.md](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/configuration.md)
|
|
229
|
+
|
|
230
|
+
### Common tasks
|
|
231
|
+
|
|
232
|
+
- Freeze seeds for CI determinism → [docs/seeds.md](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/seeds.md)
|
|
233
|
+
- Use watch mode → [docs/quickstart.md#watch-mode](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/quickstart.md#watch-mode)
|
|
234
|
+
- Templated output paths → [docs/output-paths.md](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/output-paths.md)
|
|
235
|
+
- Provider customization → [docs/providers.md](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/providers.md)
|
|
236
|
+
- Capture explain trees or JSON diagnostics for review → [docs/explain.md](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/explain.md)
|
|
237
|
+
|
|
238
|
+
## Documentation
|
|
239
|
+
|
|
240
|
+
<a id="next-steps"></a>
|
|
241
|
+
<a id="architecture"></a>
|
|
242
|
+
<a id="comparison"></a>
|
|
243
|
+
|
|
244
|
+
[Index](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/index.md) · [Quickstart](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/quickstart.md) · [Cookbook](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/cookbook.md) · [Configuration](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/configuration.md) · [CLI](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/cli.md) · [Concepts](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/concepts.md) · [Features](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/features.md) · [Security](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/security.md) · [Architecture](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/architecture.md) · [Troubleshooting](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/troubleshooting.md) · [Alternatives](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/alternatives.md)
|
|
245
|
+
|
|
246
|
+
## Community
|
|
247
|
+
|
|
248
|
+
<a id="community"></a>
|
|
249
|
+
|
|
250
|
+
Open issues for bugs or ideas, start Discussions for design questions, and follow the security policy when you disclose sandbox bypasses.
|
|
251
|
+
|
|
252
|
+
## License
|
|
253
|
+
|
|
254
|
+
<a id="license"></a>
|
|
255
|
+
|
|
256
|
+
MIT. See [`LICENSE`](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/LICENSE).
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# pydantic-fixturegen: deterministic Pydantic fixtures, JSON generator, secure sandbox
|
|
2
|
+
|
|
3
|
+
> Pydantic v2 deterministic fixtures, pytest fixtures, JSON generator, secure sandboxed CLI with Pluggy providers.
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/pydantic-fixturegen/)
|
|
6
|
+

|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
Generate deterministic Pydantic v2 data, pytest fixtures, and JSON quickly with a safe, task-focused CLI built for modern testing workflows.
|
|
10
|
+
|
|
11
|
+
📘 Read the full docs and examples at [pydantic-fixturegen.kitgrid.dev](https://pydantic-fixturegen.kitgrid.dev/).
|
|
12
|
+
|
|
13
|
+
## Why
|
|
14
|
+
|
|
15
|
+
<a id="why"></a>
|
|
16
|
+
<a id="features"></a>
|
|
17
|
+
|
|
18
|
+
- You keep tests reproducible with cascaded seeds across `random`, Faker, and optional NumPy.
|
|
19
|
+
- You run untrusted models inside a safe-import sandbox with network, filesystem, and memory guards.
|
|
20
|
+
- You drive JSON, pytest fixtures, schemas, and explanations from the CLI or Python helpers.
|
|
21
|
+
- You extend generation with Pluggy providers and preset bundles without forking core code.
|
|
22
|
+
|
|
23
|
+
You also stay observant while you work: every command can emit structured logs, diff artifacts against disk, and surface sandbox warnings so you catch regressions before they land.
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install pydantic-fixturegen
|
|
29
|
+
# Extras: orjson, regex, hypothesis, watch
|
|
30
|
+
pip install 'pydantic-fixturegen[all]'
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Other flows → [docs/install.md](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/install.md)
|
|
34
|
+
|
|
35
|
+
## Quick start
|
|
36
|
+
|
|
37
|
+
<a id="quickstart"></a>
|
|
38
|
+
|
|
39
|
+
1. Create a small Pydantic v2 model file.
|
|
40
|
+
2. List models: `pfg list ./models.py`
|
|
41
|
+
3. Generate JSON: `pfg gen json ./models.py --include models.User --n 2 --indent 2 --out ./out/User`
|
|
42
|
+
4. Generate fixtures: `pfg gen fixtures ./models.py --out tests/fixtures/test_user.py --cases 3`
|
|
43
|
+
Full steps → [docs/quickstart.md](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/quickstart.md)
|
|
44
|
+
|
|
45
|
+
JSON, fixtures, and schema commands all share flags like `--include`, `--exclude`, `--seed`, `--preset`, and `--watch`, so once you learn one flow you can handle the rest without re-reading the help pages.
|
|
46
|
+
|
|
47
|
+
## Basics
|
|
48
|
+
|
|
49
|
+
### Core usage (top 5)
|
|
50
|
+
|
|
51
|
+
<a id="cli"></a>
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pfg list <path>
|
|
55
|
+
pfg gen json <target> [--n --jsonl --indent --out]
|
|
56
|
+
pfg gen fixtures <target> [--style --scope --cases --out]
|
|
57
|
+
pfg gen schema <target> --out <file>
|
|
58
|
+
pfg doctor <target>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- `pfg list` discovers models with AST or safe-import; add `--ast` when you must avoid imports.
|
|
62
|
+
- `pfg gen json` emits JSON or JSONL; scale with `--n`, `--jsonl`, `--shard-size`, and `--freeze-seeds`.
|
|
63
|
+
- `pfg gen fixtures` writes pytest modules; tune `--style`, `--scope`, `--cases`, and `--return-type`.
|
|
64
|
+
- `pfg gen schema` dumps JSON Schema atomically; point `--out` at a file or directory template.
|
|
65
|
+
- `pfg doctor` audits coverage and sandbox warnings; fail builds with `--fail-on-gaps`.
|
|
66
|
+
|
|
67
|
+
All commands → [docs/cli.md](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/cli.md)
|
|
68
|
+
|
|
69
|
+
### Basic configuration
|
|
70
|
+
|
|
71
|
+
<a id="configuration-precedence"></a>
|
|
72
|
+
|
|
73
|
+
| key | type | default | purpose |
|
|
74
|
+
| --------------------- | ---------------- | --------- | ------------- |
|
|
75
|
+
| seed | int \ str \ null | null | Global seed |
|
|
76
|
+
| locale | str | en_US | Faker locale |
|
|
77
|
+
| union_policy | enum | first | Union branch |
|
|
78
|
+
| enum_policy | enum | first | Enum choice |
|
|
79
|
+
| json.indent | int | 2 | Pretty JSON |
|
|
80
|
+
| json.orjson | bool | false | Fast JSON |
|
|
81
|
+
| emitters.pytest.style | enum | functions | Fixture style |
|
|
82
|
+
| emitters.pytest.scope | enum | function | Fixture scope |
|
|
83
|
+
|
|
84
|
+
```toml
|
|
85
|
+
[tool.pydantic_fixturegen]
|
|
86
|
+
seed = 42
|
|
87
|
+
[tool.pydantic_fixturegen.json]
|
|
88
|
+
indent = 2
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Full matrix and precedence → [docs/configuration.md](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/configuration.md)
|
|
92
|
+
|
|
93
|
+
### Common tasks
|
|
94
|
+
|
|
95
|
+
- Freeze seeds for CI determinism → [docs/seeds.md](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/seeds.md)
|
|
96
|
+
- Use watch mode → [docs/quickstart.md#watch-mode](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/quickstart.md#watch-mode)
|
|
97
|
+
- Templated output paths → [docs/output-paths.md](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/output-paths.md)
|
|
98
|
+
- Provider customization → [docs/providers.md](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/providers.md)
|
|
99
|
+
- Capture explain trees or JSON diagnostics for review → [docs/explain.md](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/explain.md)
|
|
100
|
+
|
|
101
|
+
## Documentation
|
|
102
|
+
|
|
103
|
+
<a id="next-steps"></a>
|
|
104
|
+
<a id="architecture"></a>
|
|
105
|
+
<a id="comparison"></a>
|
|
106
|
+
|
|
107
|
+
[Index](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/index.md) · [Quickstart](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/quickstart.md) · [Cookbook](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/cookbook.md) · [Configuration](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/configuration.md) · [CLI](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/cli.md) · [Concepts](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/concepts.md) · [Features](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/features.md) · [Security](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/security.md) · [Architecture](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/architecture.md) · [Troubleshooting](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/troubleshooting.md) · [Alternatives](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/docs/alternatives.md)
|
|
108
|
+
|
|
109
|
+
## Community
|
|
110
|
+
|
|
111
|
+
<a id="community"></a>
|
|
112
|
+
|
|
113
|
+
Open issues for bugs or ideas, start Discussions for design questions, and follow the security policy when you disclose sandbox bypasses.
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
<a id="license"></a>
|
|
118
|
+
|
|
119
|
+
MIT. See [`LICENSE`](https://github.com/CasperKristiansson/pydantic-fixturegen/blob/main/LICENSE).
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Alternatives & migration guides
|
|
2
|
+
|
|
3
|
+
Compare popular fixture generators side-by-side, understand where pydantic-fixturegen shines, and borrow migration recipes when you are ready to switch.
|
|
4
|
+
|
|
5
|
+
## Detailed comparison
|
|
6
|
+
|
|
7
|
+
| Capability | **pydantic-fixturegen** | **Polyfactory** | **Pydantic-Factories** | **factory_boy** |
|
|
8
|
+
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | -------------------------------- | ------------------------------------- |
|
|
9
|
+
| Deterministic seeds | Cascaded seeds across `random`, Faker, NumPy, PyArrow, SplitMix64 portable RNG, optional freeze files | Faker-only seeds; Python RNG drift between interpreters | Faker-only seeds; no freeze file | Manual or per-factory seeding |
|
|
10
|
+
| Outputs | JSON/JSONL, tabular datasets (CSV/Parquet/Arrow), pytest fixtures, schema emitters, Hypothesis strategies, anonymized payloads | Python objects or dicts; JSON via `.dict()` | Python objects/dicts | ORM models/objects |
|
|
11
|
+
| CLI & automation | Full CLI suite (`list`, `gen`, `diff`, `check`, `doctor`, `explain`, `snapshot`, `lock`, `verify`) plus watch mode and JSON logging | Python API only | Python API only | Python API only |
|
|
12
|
+
| Sandboxing & CI | Safe-import jail w/ timeout + memory caps, network/file system guards, `pfg snapshot verify` for CI | No sandbox; factories run in-process | No sandbox | No sandbox |
|
|
13
|
+
| Plugin/extension story | Pluggy hooks (`pfg_register_providers`, `pfg_modify_strategy`, `pfg_emit_artifact`), custom heuristics/providers, CLI extras | Sub-class factories; limited extension beyond overriding Faker providers | Sub-class factories | Sub-class factories + Faker overrides |
|
|
14
|
+
| Schema/OpenAPI | Ingest JSON Schema/OpenAPI (via datamodel-code-generator), explain gaps, inject generated examples | N/A | N/A | N/A |
|
|
15
|
+
| FastAPI/seeders | Mock server, smoke tests, dataset emitters, SQLModel/Beanie seeders, Polyfactory delegation | Core factories only (excellent delegation target) | Core factories only | ORM factories only |
|
|
16
|
+
|
|
17
|
+
**TL;DR:** use Polyfactory or Pydantic-Factories when you want hand-authored class-based factories, and fixturegen when you need deterministic project-wide artefacts, CLIs, or schema integrations.
|
|
18
|
+
|
|
19
|
+
## Migration guides
|
|
20
|
+
|
|
21
|
+
### Polyfactory → pydantic-fixturegen
|
|
22
|
+
|
|
23
|
+
Goal: keep the existing factory surface but move the heavy lifting to fixturegen.
|
|
24
|
+
|
|
25
|
+
1. Enable factory delegation in configuration:
|
|
26
|
+
|
|
27
|
+
```toml
|
|
28
|
+
[tool.pydantic_fixturegen.polyfactory]
|
|
29
|
+
enabled = true
|
|
30
|
+
modules = ["app.factories"] # where your ModelFactory subclasses live
|
|
31
|
+
prefer_delegation = true # let fixturegen call into them when matching models
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
2. Run `pfg gen json ./models.py --out snapshots/users.json --include app.models.User --seed 42`. fixturegen will detect `UserFactory` and reuse its `.build()` logic while keeping deterministic seeds, relation links, and CLI ergonomics.
|
|
35
|
+
3. To migrate away from factories entirely, export equivalents once and remove the Polyfactory dependency:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pfg gen polyfactory ./models.py --out factories_pfg.py --seed 7 --prefer-fixturegen
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`factories_pfg.py` exposes the same `ModelFactory` API but proxies through fixturegen’s `GenerationConfig`. Delete the custom Polyfactory factories in stages while reusing freeze files for CI.
|
|
42
|
+
|
|
43
|
+
### Pydantic-Factories / Faker scripts → preset-based generation
|
|
44
|
+
|
|
45
|
+
1. Translate “faker-heavy” defaults into presets:
|
|
46
|
+
|
|
47
|
+
```toml
|
|
48
|
+
[tool.pydantic_fixturegen.presets."marketing-demo"]
|
|
49
|
+
seed = 123
|
|
50
|
+
profile = "pii-safe"
|
|
51
|
+
include = ["marketing.*"]
|
|
52
|
+
# override specific providers
|
|
53
|
+
[[tool.pydantic_fixturegen.presets."marketing-demo".field_policies]]
|
|
54
|
+
target = "marketing.models.Campaign.slug"
|
|
55
|
+
provider = "string.slug"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
2. Replace script invocations with CLI runs:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pfg gen fixtures marketing/models.py --preset marketing-demo --out tests/fixtures/test_marketing.py
|
|
62
|
+
pfg gen dataset marketing/models.py --preset marketing-demo --format parquet --count 500
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
3. If you need to keep Hypothesis strategies, swap direct `pydantic_factories.ModelFactory.build()` calls for `pydantic_fixturegen.hypothesis.strategy_for(Model)` or the CLI exporter `pfg gen strategies`.
|
|
66
|
+
|
|
67
|
+
### Faker-only factories → providers & heuristics
|
|
68
|
+
|
|
69
|
+
| Old approach | Fixturegen equivalent |
|
|
70
|
+
| ----------------------------------- | ---------------------------------------------------------------------------- |
|
|
71
|
+
| Faker seeding via `Faker.seed(123)` | `pfg gen ... --seed 123 --rng-mode portable` |
|
|
72
|
+
| Hard-coded email domains | Configure `[identifiers].email_domain = "example.org"` or add a field policy |
|
|
73
|
+
| Custom relationship wiring | Declare `--link models.Order.user_id=models.User.id` or set `[relations]` |
|
|
74
|
+
|
|
75
|
+
Once the deterministic config exists, you can reuse it everywhere: CLI, FastAPI mock server, anonymizer, or pytest plugin.
|
|
76
|
+
|
|
77
|
+
## Case studies & CI stories
|
|
78
|
+
|
|
79
|
+
### API teams shipping schema contracts
|
|
80
|
+
|
|
81
|
+
- **Problem:** Backends expose 60+ Pydantic models via OpenAPI. Frontend and QA teams needed nightly snapshots with concrete payloads and diff protection.
|
|
82
|
+
- **Solution:** `pfg gen json --schema openapi.yaml --out snapshots/{model}.json --freeze-seeds`. CI runs `pfg snapshot verify --json-out snapshots/{model}.json` and fails when contracts drift. Deterministic seeds let QA diff failing fields quickly.
|
|
83
|
+
- **Outcome:** Two hours less manual review per release, reproducible diffs in PRs.
|
|
84
|
+
|
|
85
|
+
### Data-science org migrating from Polyfactory
|
|
86
|
+
|
|
87
|
+
- **Problem:** Polyfactory factories produced great objects but lacked CLI surface and schema coverage. Engineers duplicated logic in scripts.
|
|
88
|
+
- **Solution:** Enabled Polyfactory delegation + freeze files to keep existing factories, then shortened them by delegating to fixturegen’s heuristics. Added `pfg gen dataset` to stream Parquet test data and `pfg lock` to guard provider coverage.
|
|
89
|
+
- **Outcome:** Same factories work, but teams now regenerate deterministic datasets and fixtures via CI without bespoke scripts.
|
|
90
|
+
|
|
91
|
+
### Privacy-heavy consumer app
|
|
92
|
+
|
|
93
|
+
- **Problem:** Needed anonymized JSON derived from production data plus deterministic regression tests.
|
|
94
|
+
- **Solution:** `pfg anonymize` rewrites raw payloads, `pfg snapshot verify` enforces drift budgets, and the anonymized outputs feed `pfg doctor` for coverage. Sandbox prevented production credentials from leaking during test discovery.
|
|
95
|
+
|
|
96
|
+
## Surface the comparison in docs
|
|
97
|
+
|
|
98
|
+
- Quick tour? Start with [features](features.md) or the [quickstart](quickstart.md).
|
|
99
|
+
- Evaluating alternatives? Bookmark this page and link it in design docs or RFCs.
|
|
100
|
+
- Ready to adopt? Follow the migration recipes above, run `pfg snapshot write` once, and wire the snapshots into CI.
|
|
101
|
+
|
|
102
|
+
When you need deterministic JSON/JSONL, pytest fixtures, schema artefacts, and CLI guardrails, fixturegen keeps everything in one toolchain. Use Polyfactory/Pydantic-Factories when you want hand-authored factory classes or interactive prototyping, and reach for fixturegen when those factories need to power reproducible pipelines.
|