snaptime
Transform timestamps with a simple DSL
What it is and what it does
Snaptime is a small utility for transforming timestamps using a domain-specific language (DSL) that chains snap and delta operations. It lets you truncate a datetime to a time boundary (e.g., start of day with @d) and add time offsets (e.g., +3h) in a single expression, inspired by Splunk's relative time syntax. The package includes a basic snap() function for naive datetimes and a snap_tz() variant for timezone-aware datetimes that handles daylight saving time transitions.
The DSL supports multiple notations for each time unit (seconds, minutes, hours, days, weeks, months, years) and allows arbitrary chaining—for example, snap(t, "+8h@d+1d+11h") adds 8 hours, snaps to midnight, then adds one day and 11 hours. It has no runtime dependencies, but the package has been abandoned since 2017-06-15 with no maintenance, no specified Python version support, and an unclear license.
Use it for:
- Compute delivery times or scheduled events by snapping to time boundaries and adding offsets in a single expression.
- Truncate timestamps to specific time units (day, hour, week, month) for aggregation or reporting queries.
- Handle timezone-aware datetimes with DST transitions using snap_tz when naive snapping would produce incorrect results.
- Build time-based filters for log analysis or time-series data where relative time expressions are more readable than imperative datetime arithmetic.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Snaptime transforms timestamps using a simple DSL inspired by Splunk's relative time modifiers, allowing you to snap to time boundaries and apply time deltas in a single chained expression.
No. The package is abandoned (last commit 2017-06-15), has no specified Python version support, an unclear license, and high install friction. While the DSL concept is useful, the lack of maintenance means compatibility with modern Python is uncertain and security issues would go unaddressed. Use a maintained alternative or implement the snapping logic directly.
Install
snaptime on PyPI
pip
pip install snaptimeuv
uv add snaptimepoetry
poetry add snaptimeInstalling snaptime
Before you install
High install friction reported. The package is abandoned—last commit was 2017-06-15, with no maintenance activity or Python version specification. Installation may encounter compatibility issues with modern Python environments.
License in practice
License is marked UNKNOWN with unclear treatment. No SPDX identifier is available. You should verify the actual license terms in the repository before using this package in a production or commercial context.
Quickstart
from datetime import datetime
from snaptime import snap
result = snap(datetime(2018, 10, 28, 23), "+3h@d")
# datetime.datetime(2018, 10, 29, 0, 0)
No Python version requirement specified; compatibility with modern Python versions is uncertain given the package's abandonment since 2017-06-15.
Verify before relying
- Whether the package works with Python 3.x versions (development history suggests Python 2 focus)
- Current state of timezone-aware datetime handling and DST edge cases
- Whether snap_tz function is stable or has known issues with modern timezone libraries
Package facts
| License | UNKNOWN (unclear) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 3,347 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 102,958/month — #12,834 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: snaptime-0.2.4.tar.gz
Keywords: snap, datetime, date, truncate, transform
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
deltaParses human-readable duration strings like '1…
permissive · top 15,000 on PyPI
agoConverts datetime, timedelta, and timestamp…
permissive · top 15,000 on PyPI
timeagoFormats datetime objects and timedeltas into…
permissive · top 5,000 on PyPI
pytimeparseParses human-readable time expressions (like…
permissive · top 1,000 on PyPI
pyawscronParses and iterates over AWS CloudWatch cron…
permissive · top 15,000 on PyPI
pyRFC3339Parses and generates RFC 3339-compliant…
permissive · top 5,000 on PyPI
strict-rfc3339Converts Unix timestamps to and from RFC3339…
copyleft · top 5,000 on PyPI
timesTimes converts between universal (UTC) time and…
permissive · top 15,000 on PyPI
pytimeparse2Parses human-readable time expressions (like…
permissive · top 5,000 on PyPI
pytzpytz brings the Olson timezone database into…
permissive · top 100 on PyPI