Skip to main content

Python tools for data type handling and validation

Project description

splurge-tools

A Python package providing tools for data type handling, validation, and text processing.

Description

splurge-tools is a collection of Python utilities focused on:

  • Data type handling and validation
  • Text file processing and manipulation
  • String tokenization and parsing
  • Text case transformations
  • Delimited separated value parsing
  • Tabular data model class
  • Typed tabular data model class
  • Data validator class
  • Random data class
  • Data transformation class
  • Text normalizer class
  • Python 3.10+ compatibility

Installation

pip install splurge-tools

Features

  • type_helper.py: Comprehensive type validation and conversion utilities
  • text_file_helper.py: Text file processing and manipulation tools
  • string_tokenizer.py: String parsing and tokenization utilities
  • case_helper.py: Text case transformation utilities
  • dsv_helper.py: Delimited separated value utilities
  • tabular_data_model.py: Data model for tabular datasets
  • typed_tabular_data_model.py: Type data model based on tabular data model
  • data_validator.py: Data validator class
  • random_helper.py: Random data class and methods for generating data
  • data_transformer.py: Data transformation utility class
  • text_normalizer.py: Text normalization utility class

Development

Requirements

  • Python 3.10 or higher
  • setuptools
  • wheel

Setup

  1. Clone the repository:
git clone https://github.com/jim-schilling/splurge-tools.git
cd splurge-tools
  1. Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. Install development dependencies:
pip install -e ".[dev]"

Testing

Run tests using pytest:

python -m pytest tests/

Code Quality

The project uses several tools to maintain code quality:

  • Black: Code formatting
  • isort: Import sorting
  • flake8: Linting
  • mypy: Type checking
  • pytest: Testing with coverage

Run all quality checks:

black .
isort .
flake8 splurge_tools/ tests/ --max-line-length=120
mypy splurge_tools/
python -m pytest tests/ --cov=splurge_tools

Build

Build distribution:

python -m build

Changelog

[0.2.2] - 2025-07-04

Added

  • TextFileHelper.load_as_stream: Added new method for memory-efficient streaming of large text files with configurable chunk sizes. Supports header/footer row skipping and uses optimized deque-based sliding window for footer handling.
  • TextFileHelper.preview skip_header_rows parameter: Added skip_header_rows parameter to the preview() method, allowing users to skip header rows when previewing file contents.

Performance

  • TextFileHelper Footer Buffer Optimization: Replaced list-based footer buffer with collections.deque in load_as_stream() method, improving performance from O(n) to O(1) for footer row operations.

Fixed

  • TabularDataModel No-Header Scenarios: Fixed issue where column names were empty when header_rows=0. Column names are now properly generated as ["column_0", "column_1", "column_2"] when no headers are provided.
  • TabularDataModel Row Access: Fixed IndexError in the row() method when accessing uneven data rows. Added proper padding logic to ensure row data has enough columns before access.
  • TabularDataModel Data Normalization: Improved consistency between column count and column names by ensuring column names always match the actual column count, regardless of header configuration.

[0.2.1] - 2025-07-03

Added

  • DsvHelper.profile_columns: Added DsvHelper.profile_columns, a new method that generates a simple data profile from parsed DSV data, inferring column names and datatypes.
  • Test Coverage: Added comprehensive test cases for DsvHelper.profile_columns and improved validation of DSV parsing logic, including edge cases for all supported datatypes.

[0.2.0] - 2025-07-02

Breaking Changes

  • Method Signature Standardization: All method signatures across the codebase have been updated to require default parameters to be named (e.g., def myfunc(value: str, *, trim: bool = True)). This enforces keyword-only arguments for all default values, improving clarity and consistency. This is a breaking change and may require updates to any code that calls these methods positionally for defaulted parameters.
  • All method signatures now use explicit type annotations and follow PEP8 and project-specific conventions for parameter ordering and naming.
  • Some methods may have reordered parameters or stricter type requirements as part of this standardization.

Fixed

  • Resolved Regex Pattern Bug: Fixed regex pattern bug - ?? should have been ? in String class in type_helper.py.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Jim Schilling

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

splurge_tools-0.2.2.tar.gz (43.8 kB view details)

Uploaded Source

Built Distribution

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

splurge_tools-0.2.2-py3-none-any.whl (30.3 kB view details)

Uploaded Python 3

File details

Details for the file splurge_tools-0.2.2.tar.gz.

File metadata

  • Download URL: splurge_tools-0.2.2.tar.gz
  • Upload date:
  • Size: 43.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for splurge_tools-0.2.2.tar.gz
Algorithm Hash digest
SHA256 e1519bc7d0c8c37275357ac56613121f4db935c7242ab2988bffed64054213cb
MD5 eb0b3612e8843ed7fe26cc1021b9d47c
BLAKE2b-256 502cb44fa9b7807ef634d97cd4c3ce7131128fdd967b470df61faa1603f52117

See more details on using hashes here.

File details

Details for the file splurge_tools-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: splurge_tools-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 30.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for splurge_tools-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 79248167afbb91cf473a2e51848084e944a65e720de516bcf6014ece4c9d7623
MD5 170f05e2666a987a6777f78c870920ef
BLAKE2b-256 b1a7df09341dfff96e82b3d4dddfec3bfbe774d4ee60242fa6d681cca06cd9da

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