Skip to main content

Date-expression domain specific language parsing. A neat way to express things like "First Saturday of any year", or "3rd thursdays each month" and such

Project description

Cronspell Python Package / CLI Tool

Chronometry Spelled Out

Details Tests License - MIT Github Pages
Features linting - Ruff types - mypy test - pytest Pre-Commit docs - mkdocs

Date-expression domain specific language parsing. A neat way to express things like "First Saturday of any year", or "3rd thursdays each month" and such.

Features

Python

Cronspell is heavily inspired by Grafana's relative Date picker user interface. It shines when configuration is needed to reflect irregular date-distances such as in the example below.

cronspell lets you express relative dates such as "last saturday of last month" and converts it to a date object for use in your python project.

Cli

The same interface, exposed to the command line. Formatted via isodate by default -- which is open for configuration using the --format option.

Example

To get the last saturday of last month:

"now /m -1d /sat"

The same, more verbose:

"now /month -1day /sat"

Pre-Commit Hook: Validation

Cronspell comes with a pre-commit hook that validates configured date-expressions based on yamlpath.

Given you have simple config files in yaml format containing arrays of objects having a key cronspell, here is an example pre-commit hook config:

  - repo: https://github.com/iilei/cronspell
    rev: <release tag>
    hooks:
      - id: cronspell

Credits

  • Domain-Specific-Language Parser: TextX
  • This package was created with The Hatchlor project template.

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

cronspell-0.0.0rc9.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

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

cronspell-0.0.0rc9-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file cronspell-0.0.0rc9.tar.gz.

File metadata

  • Download URL: cronspell-0.0.0rc9.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.1

File hashes

Hashes for cronspell-0.0.0rc9.tar.gz
Algorithm Hash digest
SHA256 638fdc052ac28256e9a54a020f50cc7f02e7f209307e120801dd6d66c503db57
MD5 40d19127c973afd28e109918c139bfb7
BLAKE2b-256 479e40b32ef58bb08881ef972342f455b6a3736a7a16ddd998b01f0929884ca8

See more details on using hashes here.

File details

Details for the file cronspell-0.0.0rc9-py3-none-any.whl.

File metadata

  • Download URL: cronspell-0.0.0rc9-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.1

File hashes

Hashes for cronspell-0.0.0rc9-py3-none-any.whl
Algorithm Hash digest
SHA256 8b5d26b8b7230416138122c238e33da8c11f784c25686c151ab5bb0f286ad989
MD5 0592855f1edafb4917e91428c05d7da1
BLAKE2b-256 2c6fe43bbc63797e6f1e804fd09fbcf4ba8f1e269b27c046c9107b1c141cac06

See more details on using hashes here.

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