Skip to main content

PyPI License: MIT Language tests badge Docs

isoperiod

ISO 8601 period and duration arithmetic, including offsets from the natural boundary, for defining sampling resolution and periodicity in timeseries data

Features

  • ISO 8601 durations - build a period from "PT15M", "P1D" or "P1Y".
  • Offsets - shift every interval boundary off its natural position, for hydrological days ("P1D+T9H") and water years ("P1Y+9MT9H").
  • Origins - pin the grid to a chosen datetime with the "2024-01-01/P7D" form.
  • Ordinals - every interval on the timeline has an integer ordinal, so flooring, stepping and grouping are integer arithmetic, calendar months included.
  • Alignment - check that a timestamp sits on a period boundary, and whether one period nests cleanly inside another.
  • No runtime dependencies - pure Python on top of datetime, with helpers for handing periods to Polars.

Installation

pip install isoperiod

or with uv:

uv add isoperiod

See the documentation for a quick start, the concepts behind the API, and the full reference.

License

This project is licensed under the MIT license.

Contributing

Contributions are welcome. Please feel free to submit a Pull Request.

  1. Clone the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Please make sure your code passes all tests and follows the coding style before submitting a PR. See developer setup below for more information.

Developer Setup

This is for active development on the isoperiod package itself.

Requirements

Install uv

Official instructions

Clone the repository

git clone https://github.com/NERC-CEH/isoperiod.git
cd isoperiod

Setting up and activating a virtual environment

uv sync
source .venv/bin/activate

Linting

Linting uses ruff using the config in pyproject.toml

ruff check --fix

Formatting

Formating uses ruff using the config in pyproject.toml which follows the default black settings.

ruff format .

Testing

Testing is done using pytest and tests are in the /tests directory.

pytest

Pre commit hooks

Run below to setup the pre-commit hooks.

git config --local core.hooksPath .githooks/

This will set this repo up to use the git hooks in the .githooks/ directory. The hook runs ruff format --check and ruff check to prevent commits that are not formatted correctly or have errors. The hook intentionally does not alter the files, but informs the user which command to run.

Documentation

For full documentation, visit https://nerc-ceh.github.io/isoperiod/

To build the documentation locally:

# Install documentation dependencies (but they are included by default)
uv sync --group docs

# Build the documentation
cd docs
make html

# View documentation
open _build/html/index.html

Citation

If you use this software, please cite it using the metadata in CITATION.cff.

Built with Cookiecutter and the NERC-CEH/fdri-cookiecutter-templates template.

Metadata

Release files for isoperiod 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for isoperiod 1.2.1
File Size Uploaded Provenance Actions
isoperiod-1.2.1.tar.gz 688.8 kB With provenance Details for isoperiod-1.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for isoperiod 1.2.1
File Interpreter ABI Platform Actions
isoperiod-1.2.1-py3-none-any.whl Python 3 none any Details for isoperiod-1.2.1-py3-none-any.whl

Total release size: 720.6 kB

Release files / isoperiod-1.2.1.tar.gz

Download URL isoperiod-1.2.1.tar.gz
Size 688.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0220912693321f770523d122039dc34ce75aa6a1fc96259e8f4b8b71748349ed
BLAKE2b-256 checksum
How to use checksums
b4721de30066441f1a3b54a86f88bad08f13893ee42d1a9c20b74c8abddf51df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / isoperiod-1.2.1-py3-none-any.whl

Download URL isoperiod-1.2.1-py3-none-any.whl
Size 31.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cae199c4ffd7556a9cda0502e3f2b0b95cdab5dfb18cfd9cb711d98858b33df7
BLAKE2b-256 checksum
How to use checksums
62dad1fb152c1a8a5d17ae42a7a166a4947de94ebd715c6a4af661faf195ca5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Security for isoperiod 1.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for isoperiod-1.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page