sample_data_factory
Short description
sample_data_factory is a reusable Python helper for generating deterministic ZIP archives used in test flows, including URS CSV exports and FIDE players XML exports.
Release Highlights
- Package metadata and import paths have been aligned to
sample_data_factoryandsdf. - Archive generation now covers both URS CSV and FIDE players XML ZIP outputs through
SampleDataFactory. - Google Drive uploads support optional nested sub-folder creation for organized artifact output.
- Python runtime support is aligned to
>=3.10in project configuration.
Module Overview
Key Features
- Builds URS publication ZIP archives containing CSV payloads.
- Builds FIDE players-list ZIP archives containing XML payloads.
- Supports either local byte output or upload to Google Drive.
- Can create nested Google Drive sub-folders when uploading files.
- Includes unit tests for archive generation and constructor validation.
Project Structure
src/sdf/: Core package implementation (sample_data_factory.py).tests/unit/: Unit tests for archive builders and helper methods.scripts/: SQL/bootstrap assets (legacy resources have been removed).legacy/: Archived resources excluded from normal test runs.*.ps1: Environment and dependency setup scripts.
Getting Started
Prerequisites
- Python 3.10+
- Poetry
Setup
# 1) Generate .env values from environment variables
.\SetupDotEnv.ps1
# 2) Configure private Poetry sources when required
.\SetupPrivateRepoAccess.ps1
# 3) Optional: configure GitHub CLI access
.\SetupGitHubAccess.ps1
# 4) Install and sync project dependencies
.\InstallDevEnv.ps1
# 5) Run tests
poetry run pytest
Usage Example
from datetime import date
from sdf.sample_data_factory import SampleDataFactory
factory = SampleDataFactory(
data_structure={
"headers": ["PlayerID", "PlayerName"],
"rows": [["1", "Player One"], ["2", "Player Two"]],
},
drive=None,
file_prefix="Players",
out_file_date=date(2026, 1, 1),
target_folder_id=None,
sub_folder_name=None,
)
archive_bytes = factory.build_urs_rating_pub_zip()
Common Commands
poetry install
poetry run pytest
poetry run pytest --cov=src --cov=tests --cov-report=term-missing
poetry run black src tests
poetry run isort src tests
poetry run flake8 src tests
poetry run pre-commit run --all-files
Automation Scripts
InstallPy.ps1: Bootstraps Python/Poetry setup.InstallDevEnv.ps1: Installs development dependencies and pre-commit hooks.SetupDotEnv.ps1: Generates.envfrom required environment variables.SetupPrivateRepoAccess.ps1: Configures private package source credentials.SetupGitHubAccess.ps1: Configures GitHub authentication for local automation.
Active Workflows
.github/workflows/py-temp-pr-pub-no_docker-def.yaml: Pull request validation workflow..github/workflows/py-temp-publish-pub-build_release_notify_after_merge-def.yaml: Post-merge release and publish workflow.
Metadata
Release files for sample_data_factory 0.8.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 | |
|---|---|---|---|
| sample_data_factory-0.8.0.tar.gz | 5.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sample_data_factory-0.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.3 kB
Release files / sample_data_factory-0.8.0.tar.gz
| Download URL | sample_data_factory-0.8.0.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
915d7c9395287a9b90de15a264a7539201ffab2227d762e6882714b092dfcc76
|
|
BLAKE2b-256 checksum How to use checksums |
3c77f719ac13de1330e45371a0a10111f1d3de1b64960acabf169bb0f7954101
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.2 CPython/3.13.12 Linux/6.14.0-1017-azure
|
Release files / sample_data_factory-0.8.0-py3-none-any.whl
| Download URL | sample_data_factory-0.8.0-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
576b4c3462d91641e8f12a5e7d63fd11c1871849e01ca7464a54e6731a276e82
|
|
BLAKE2b-256 checksum How to use checksums |
3b2d5647cc4374a736a4757b471eaedb84db8d1b7d686f4a801b1dcf5a48dc45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.2 CPython/3.13.12 Linux/6.14.0-1017-azure
|