Skip to main content

Designed to make time series forecasting workflows faster, safer, and more standardized.

Project description

TSTools

TSTools is a Python package designed to make time series forecasting workflows faster, safer, and more standardized.

Its goal is to provide a clean, analyst-friendly toolkit for preparing, validating, exploring, and eventually forecasting time series data at scale. The package is built for users who work with forecasting datasets regularly and need a reliable way to check whether their data is actually fit for modeling before moving into EDA, feature engineering, and forecasting.

Version 1 is focused on the first major pillar of that vision: sanity validation for forecast-readiness.

Product Vision

At its core, TSTools is meant to reduce avoidable forecasting errors caused by bad input data, inconsistent time structure, missing dates, duplicate keys, invalid target values, and weak series quality. Instead of discovering these issues deep into the modeling workflow, users should be able to catch them immediately through a simple, reusable API.

The intended experience is lightweight and intuitive. A user should be able to import a module from TSTools, pass in a base dataframe with a few key parameters such as the date column, target column, and group identifiers, and instantly receive a detailed sanity report explaining whether the dataset is in the correct shape for time series forecasting.

TSTools is designed to be:

  • simple to use for analysts working in notebooks
  • modular internally so it can scale into a fuller package
  • structured enough for pipelines by returning usable report objects, not just printed text
  • practical for real forecasting data, especially grouped or panel datasets such as DFU-level demand series

Over time, the package is intended to grow into a broader toolkit with dedicated submodules for:

  • sanity checks for forecast-readiness validation
  • EDA for fast time series exploration and diagnostics
  • forecasting for baseline models, evaluation, and reusable forecasting utilities

Installation

pip install tstools-forecast

For editable local development:

pip install -e .

For development tools:

pip install -e .[dev]

Quickstart

from tstools import load_sample_data, sanity_checks

df = load_sample_data("panel_with_issues")

report = sanity_checks(
    df,
    date_col="date",
    target_col="sales",
    group_cols=["dfu"],
    expected_freq="D",
    min_history=10,
)

print(report.overall_status)
print(report.summary)

You can also test against a lightweight real forecasting dataset:

df = load_sample_data("tourism_monthly")

report = sanity_checks(
    df,
    date_col="date",
    target_col="target",
    group_cols=["series_id"],
    expected_freq="MS",
    min_history=24,
)

Intended Experience

The main v1 workflow is to run sanity checks before deeper exploration or modeling:

from tstools import sanity_checks

sanity_checks(
    base_df,
    date_col="date",
    target_col="sales",
    group_cols=["dfu"],
    expected_freq="D",
)

The report is designed to help users quickly understand whether:

  • required columns are present
  • dates are parseable
  • targets are numeric
  • duplicate time keys exist
  • dates are missing between the minimum and maximum range for each series
  • frequency is consistent with expectations
  • target values are missing
  • some series are too short for reliable modeling
  • some series are constant or all zero

Sanity Checks in v1

TSTools v1 currently focuses on forecast-readiness validation through a single entry point: sanity_checks.

It checks:

  • schema integrity
  • date parsing quality
  • duplicate keys
  • missing timestamps by series
  • frequency consistency
  • missing target values
  • short history by group
  • constant and all-zero series
from tstools import load_sample_data, sanity_checks

df = load_sample_data("panel_with_issues")
report = sanity_checks(
    df,
    date_col="date",
    target_col="sales",
    group_cols=["dfu"],
    expected_freq="D",
    min_history=10,
)

Sample printed output:

==================================================
TSTools Sanity Check Report
==================================================

Dataset shape     : 66 rows x 3 columns
Date column       : date
Target column(s)  : sales
Group column(s)   : ['dfu']
Expected frequency: D
Min history       : 10

Overall status    : NOT_READY

The function prints a readable console report and also returns a structured report object that can be used in notebooks, scripts, or pipelines.

Built-in Sample Data

TSTools includes sample datasets so users can quickly test the APIs, understand expected input formats, and see how the reports behave on both clean and problematic forecasting data.

  • daily_series_clean
  • panel_clean
  • panel_with_issues
  • tourism_monthly

tourism_monthly is a lightweight real forecasting dataset loaded from the Monash Tourism Monthly data hosted on Zenodo over HTTPS and cached locally on first use. It is normalized into long format with columns series_id, date, and target.

Source:

Example:

from tstools import load_sample_data

df = load_sample_data("panel_with_issues")
df.head()

Report Statuses

  • READY: no failures or warnings
  • READY_WITH_WARNINGS: no failures, but at least one warning
  • NOT_READY: at least one failed check

Check statuses:

  • PASS
  • WARN
  • FAIL
  • INFO

Development

Run the test suite:

.\.venv\Scripts\python.exe -m pytest

Run optional quality tools:

.\.venv\Scripts\python.exe -m ruff check .
.\.venv\Scripts\python.exe -m black --check .
.\.venv\Scripts\python.exe -m mypy src
.\.venv\Scripts\python.exe -m bandit -q -r src

Automated Release

The prod branch is configured for automated publication to PyPI with GitHub Actions.

  • pushes to prod run verification, Bandit application-security scanning, dependency vulnerability checks, and then trigger a package publish workflow
  • main is intended to remain the development branch
  • the PyPI distribution name is tstools-forecast
  • GitHub CodeQL is configured for main and prod pushes, pull requests, and scheduled code scanning
  • PyPI releases are immutable, so each new production publish must use a new package version

To make trusted publishing work on GitHub, configure the PyPI project to trust this repository and the publish-prod.yml workflow for the prod branch.

Project Docs

Detailed code-grounded documentation is available in docs/README.md.

Roadmap

TSTools starts with sanity checks, but the larger vision is to become a dependable toolkit for end-to-end time series forecasting preparation and analysis. The long-term direction includes:

  • stronger forecast-readiness validation workflows
  • faster EDA for grouped time series datasets
  • reusable forecasting utilities and baseline modeling helpers

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

tstools_forecast-0.1.1.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

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

tstools_forecast-0.1.1-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file tstools_forecast-0.1.1.tar.gz.

File metadata

  • Download URL: tstools_forecast-0.1.1.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tstools_forecast-0.1.1.tar.gz
Algorithm Hash digest
SHA256 26a229051d6e7ee6c7b240e18a7a5e0f4c53005ecb0d660b575a5f2340c0a2b0
MD5 87aba914060c5a17e5731d0b486b71bc
BLAKE2b-256 334291995f0b69c0f4cddd7704a636575858516a3eb01e982a75c5e7844d5552

See more details on using hashes here.

Provenance

The following attestation bundles were made for tstools_forecast-0.1.1.tar.gz:

Publisher: publish-prod.yml on rudreshmishra16/TSTools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tstools_forecast-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for tstools_forecast-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a96fd4713c3f123ddaa9ea48d99edec46ca3605fb8f33442cbd5d4362cf1d970
MD5 8721f93300e51b51d8dda9b6126cb409
BLAKE2b-256 23a920eefb1dd644c50c9303f227c80e09cb36cf298c91035fc02c31261cf51a

See more details on using hashes here.

Provenance

The following attestation bundles were made for tstools_forecast-0.1.1-py3-none-any.whl:

Publisher: publish-prod.yml on rudreshmishra16/TSTools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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