Skip to main content

Reusable test data factory for CSV and FIDE XML archives.

Project description

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.
  • RTE API URS player export generation now produces pipe-delimited player CSV archives from FIDE-style source rows.
  • Google Drive uploads support optional nested sub-folder creation for organized artifact output.
  • Python runtime support is aligned to >=3.10 in project configuration.

Versioning and Releases

  • Current package version: 0.2.0.
  • Versioning follows SemVer (MAJOR.MINOR.PATCH) for all package releases.
  • Release notes are generated from the active branch diff against master.

Module Overview

Key Features

  • Builds URS publication ZIP archives containing CSV payloads.
  • Builds FIDE players-list ZIP archives containing XML payloads.
  • Builds RTE API URS player ZIP archives containing pipe-delimited CSV 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.

Project details


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.2.0.tar.gz (5.8 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.2.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sample_data_factory-0.2.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.13.13 Linux/6.17.0-1018-azure

File hashes

Hashes for sample_data_factory-0.2.0.tar.gz
Algorithm Hash digest
SHA256 84301fb3ce1fe1485c812a1522beed5ae4a6b9fe4082753ad2ccd34dfb8d15bd
MD5 e9230bd7bfdb87c4d29b8acb7e120678
BLAKE2b-256 b04cb42197abb6c7fc9fe7339e4a828fc15be95cf78cd7da800b1e4a1909bff0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sample_data_factory-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.13.13 Linux/6.17.0-1018-azure

File hashes

Hashes for sample_data_factory-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 faebfff86321526f78a2fd2611e8db78c8a5d55a052e46bfb2d2d578f0cf5366
MD5 269fa5d1136b465f1970357b99714ce9
BLAKE2b-256 b727d6107612f9fd87ddc0bea9887b40847d690d016d2fc494ff105779c23026

See more details on using hashes here.

Supported by

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