Skip to main content

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_factory and sdf.
  • 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.10 in 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 .env from 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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sample_data_factory-0.8.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sample_data_factory-0.8.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file sample_data_factory-0.8.0.tar.gz.

File metadata

  • Download URL: sample_data_factory-0.8.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.13.12 Linux/6.14.0-1017-azure

File hashes

Hashes for sample_data_factory-0.8.0.tar.gz
Algorithm Hash digest
SHA256 915d7c9395287a9b90de15a264a7539201ffab2227d762e6882714b092dfcc76
MD5 4aa880398ae3b936a46be6e1f0623327
BLAKE2b-256 3c77f719ac13de1330e45371a0a10111f1d3de1b64960acabf169bb0f7954101

See more details on using hashes here.

File details

Details for the file sample_data_factory-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: sample_data_factory-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.13.12 Linux/6.14.0-1017-azure

File hashes

Hashes for sample_data_factory-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 576b4c3462d91641e8f12a5e7d63fd11c1871849e01ca7464a54e6731a276e82
MD5 661302419a1a6bb03b792ff5111e3711
BLAKE2b-256 3b2d5647cc4374a736a4757b471eaedb84db8d1b7d686f4a801b1dcf5a48dc45

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 files

0.7.0

2 files

0.2.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page