Skip to main content

Thin DSL for creating time scheduling specifications

Project description

A DSL to assist with writing specifications describing intervals and durations of time with filters.

https://travis-ci.org/delfick/timepiece.png?branch=master

Why the name?

Because time_spec was uninspiring and a good friend suggested timepiece.

Naming things is difficult!

But why?

Because I wanted to represent when scheduled actions should take place and I was starting to have too many columns in my database representing everything I wanted to be able to do.

Installation

Use pip!:

pip install timepiece

Or if you’re developing it:

pip install -e .
pip install -e ".[tests]"

Usage

Just create the timepiece and give it a specification!

from timepiece.spec import make_timepiece

from datetime import datetime

timepiece = make_timepiece()

obj = timepiece.time_spec_to_object("between(start: now()) & interval(every: amount(num:1 size: hour))")

print("Next time is: ", obj.following(datetime.utcnow()))

See The docs at https://timepiece.readthedocs.io for more information!

Tests

To run the tests in this project, just use the helpful script:

./test.sh

Or run tox:

tox

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

timepiece-0.2.6.tar.gz (9.9 kB view details)

Uploaded Source

File details

Details for the file timepiece-0.2.6.tar.gz.

File metadata

  • Download URL: timepiece-0.2.6.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for timepiece-0.2.6.tar.gz
Algorithm Hash digest
SHA256 d189157d7af916945278564a3f5c51c5081ab20877c0faffda58af003d52dd08
MD5 5c74433086648b29094cb5655005b971
BLAKE2b-256 6b177a16c9268bba13faaaf946cc375b9f6d5776bff661632e9450969f737527

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page