Professional spreadsheet wrangling utilities for parsing, splitting, and expanding schedule data
Project description
ScheduleTools
Professional spreadsheet wrangling utilities for parsing, splitting, and expanding schedule data.
Features
- Flexible Parsing: Parse schedule data from various formats with configurable date/time formats and block detection
- Smart Splitting: Split CSV data into multiple files based on grouping criteria with optional filtering
- Column Expansion: Transform data to match specific output formats with configurable mappings
- Dual Interface: Use as a Python library for programmatic access or as a CLI tool for file operations
- Professional Design: Clean API, comprehensive error handling, and type hints
Installation
pip install scheduletools
For development installation:
git clone https://github.com/yourusername/scheduletools.git
cd scheduletools
pip install -e ".[dev]"
Quick Start
As a Python Library
from scheduletools import ScheduleParser, CSVSplitter, ScheduleExpander
# Parse schedule data with default block marker
parser = ScheduleParser("schedule.txt")
parsed_data = parser.parse()
# Parse with custom block marker
parser = ScheduleParser("schedule.txt", block_start_marker="Day")
parsed_data = parser.parse()
# Split data by team
splitter = CSVSplitter(parsed_data, "Team")
team_schedules = splitter.split()
# Expand to required format
expander = ScheduleExpander(team_schedules["Team_A"], {
"Required": ["Date", "Time", "Team", "Location", "Notes"],
"defaults": {"Location": "Main Arena", "Notes": ""}
})
expanded_data = expander.expand()
As a CLI Tool
# Parse a schedule file with default block marker
schtool parse schedule.txt -o parsed_schedule.csv
# Parse with custom block marker
schtool parse schedule.txt --block-marker "Day" -o parsed_schedule.csv
# Split by team
schtool split parsed_schedule.csv -g Team -o team_schedules/
# Expand with template
schtool expand team_schedules/Team_A.csv template.json -o final_schedule.csv
# Complete workflow
schtool process schedule.txt -o output/ -t template.json
Documentation
ScheduleParser
Parse schedule data from various formats into structured DataFrames.
from scheduletools import ScheduleParser
# Basic usage with default block marker ("Date")
parser = ScheduleParser("schedule.txt")
df = parser.parse()
# With custom block marker
parser = ScheduleParser("schedule.txt", block_start_marker="Day")
df = parser.parse()
# With custom configuration
parser = ScheduleParser(
"schedule.txt",
config_path="config.json",
reference_date="2025-09-02",
block_start_marker="Day"
)
df = parser.parse()
Configuration Format:
{
"Format": {
"Date": "%m/%d/%Y",
"Time": "%I:%M %p",
"Duration": "H:MM"
},
"Block Detection": {
"start_marker": "Date",
"skip_meta_rows": true,
"meta_patterns": ["ice", "time", "header", "day", "week", "note", "info"]
},
"Missing Values": {
"Omit": true,
"Replacement": "missing"
},
"Split": {
"Skip": false,
"Separator": "/"
}
}
Block Detection: The parser uses a configurable block marker to identify where schedule blocks begin. By default, it looks for "Date" in the first column of each row. You can customize this behavior:
start_marker: Text that indicates the start of a block column (default: "Date")skip_meta_rows: Whether to skip rows containing meta-informationmeta_patterns: List of patterns to identify meta-information rows
CSVSplitter
Split CSV data into multiple DataFrames based on grouping criteria.
from scheduletools import CSVSplitter
# Split by single column
splitter = CSVSplitter("data.csv", "Team")
teams = splitter.split()
# Split by multiple columns with filtering
splitter = CSVSplitter(
"data.csv",
["Week", "Team"],
include_values=["Week_1", "Week_2"],
exclude_values=["Team_C"]
)
filtered_groups = splitter.split()
ScheduleExpander
Expand schedule data to include required columns with mappings and defaults.
from scheduletools import ScheduleExpander
# Expand with configuration
config = {
"Required": ["Date", "Time", "Team", "Location", "Notes"],
"defaults": {
"Location": "Main Arena",
"Notes": ""
},
"Mapping": {
"Start Time": "Time",
"Team Name": "Team"
}
}
expander = ScheduleExpander("input.csv", config)
expanded_df = expander.expand()
CLI Commands
schtool parse
Parse a schedule file into structured CSV format.
# Use default block marker ("Date")
schtool parse schedule.txt -o parsed.csv
# Use custom block marker
schtool parse schedule.txt --block-marker "Day" -o parsed.csv
# With custom configuration
schtool parse schedule.txt --config config.json --reference-date 2025-09-02
schtool split
Split CSV file into multiple files by group.
schtool split data.csv -g Team -o team_files/
schtool split data.csv -g "Week,Team" --filter "Week_1,Week_2" --exclude "Team_C"
schtool expand
Expand schedule CSV to required column format.
schtool expand input.csv template.json -o expanded.csv
schtool process
Complete workflow combining split and optional expand operations.
schtool process input.csv -o output/ -t template.json
Input Format
The ScheduleParser expects tab-delimited files with a specific structure:
Monday Tuesday
Date Time Date Time
6 pm - 7:15 pm 6:00 pm - 7:00 pm 7:00 pm - 8:00 pm 8:15 pm - 9:15 pm
7/21/2025 16U / 18U 7/22/2025 12U / 14U 18U 16U
7/28/2025 16U / 18U 7/29/2025 8U / 10U 18U 16U
8/4/2025 16U / 18U 8/5/2025 12U / 14U 18U 16U
Key Features:
- Block Detection: Uses configurable markers (default: "Date") to identify schedule blocks
- Team Splitting: Automatically splits combined teams (e.g., "16U / 18U" → separate entries)
- Meta Row Handling: Skips rows containing meta-information like "ice", "time", etc.
- Flexible Format: Supports different date/time formats via configuration
Error Handling
The package provides comprehensive error handling with custom exceptions:
from scheduletools import (
ScheduleToolsError,
ParsingError,
ValidationError,
ConfigurationError,
FileError
)
try:
parser = ScheduleParser("nonexistent.txt")
df = parser.parse()
except FileError as e:
print(f"File error: {e}")
except ParsingError as e:
print(f"Parsing error: {e}")
Development
Setup
git clone https://github.com/yourusername/scheduletools.git
cd scheduletools
pip install -e ".[dev]"
Testing
pytest
pytest --cov=scheduletools
Code Quality
black scheduletools/
flake8 scheduletools/
mypy scheduletools/
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
0.1.0
- Initial release
- Core parsing, splitting, and expansion functionality
- CLI interface with comprehensive commands
- Professional API design with type hints
- Comprehensive error handling
- Configurable block detection with custom markers
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scheduletools-0.1.0.tar.gz.
File metadata
- Download URL: scheduletools-0.1.0.tar.gz
- Upload date:
- Size: 19.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8c9b8a5ecab77aff7f771e9ac67d134beb901b0469a18f53d4c3597c23e7180
|
|
| MD5 |
436678906cd2d61b8cf18ffb6a678d39
|
|
| BLAKE2b-256 |
20a4d2f5ca9b7bd5f49345e7d95ee0a47eea8700b89162ef8b199a9723ae3384
|
Provenance
The following attestation bundles were made for scheduletools-0.1.0.tar.gz:
Publisher:
publish.yml on Khlick/scheduletools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scheduletools-0.1.0.tar.gz -
Subject digest:
c8c9b8a5ecab77aff7f771e9ac67d134beb901b0469a18f53d4c3597c23e7180 - Sigstore transparency entry: 269233233
- Sigstore integration time:
-
Permalink:
Khlick/scheduletools@55cdf5e8fe2c1bb0c1d8eebb3a9e74ffeff16b68 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Khlick
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@55cdf5e8fe2c1bb0c1d8eebb3a9e74ffeff16b68 -
Trigger Event:
push
-
Statement type:
File details
Details for the file scheduletools-0.1.0-py3-none-any.whl.
File metadata
- Download URL: scheduletools-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8dbcb53611df51d8d0c70a6e92424dab6c1fefd72ec7cd4dfb7aae16d9d7b1e
|
|
| MD5 |
4f35a30406b7f425a26dc041847feb68
|
|
| BLAKE2b-256 |
6a66653f64e945e9662b192496f4aaaa78921188928a4445fe7482e256fd996b
|
Provenance
The following attestation bundles were made for scheduletools-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Khlick/scheduletools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scheduletools-0.1.0-py3-none-any.whl -
Subject digest:
d8dbcb53611df51d8d0c70a6e92424dab6c1fefd72ec7cd4dfb7aae16d9d7b1e - Sigstore transparency entry: 269233247
- Sigstore integration time:
-
Permalink:
Khlick/scheduletools@55cdf5e8fe2c1bb0c1d8eebb3a9e74ffeff16b68 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Khlick
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@55cdf5e8fe2c1bb0c1d8eebb3a9e74ffeff16b68 -
Trigger Event:
push
-
Statement type: