cronspell


Namecronspell JSON
Version 0.4.1 PyPI version JSON
download
home_pageNone
SummaryDate-expression domain specific language parsing. A neat way to express things like "First Saturday of any year", or "3rd thursdays each month" and such
upload_time2025-01-03 02:58:00
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT
keywords configuration cron crontab date datetime dsl
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Cronspell Python Package / CLI Tool
***Chronometry Spelled Out***


[![Github Pages][Github Pages]][Github Pages Link]


|          |                                                                                                                                                                                                                                   |
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Details  | [![Tests][Tests-image]][Tests-link] [![License - MIT][MIT-image]][MIT-link]                                                                                                                                                       |
| Features | [![linting - Ruff][ruff-image]][ruff-link] [![types - mypy][mypy-image]][mypy-link] [![test - pytest][pytest-image]][pytest-link]  [![Pre-Commit][precommit-image]][precommit-link] [![docs - mkdocs][mkdocs-image]][mkdocs-link] |

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


## Status

CronSpell is currently in Beta. While it is considered well tested and stable for most use cases, there may still be some edge cases and bugs that need to be addressed. The maintainer encourages users to try it out and [provide feedback to help improving the library.](https://github.com/iilei/cronspell/issues)

Your contributions and bug reports are highly appreciated.

## Features

Cronspell is heavily inspired by Grafana's relative Date picker user interface. It was designed for the cases when configuration is needed to reflect irregular date-distances.

Use it within your Python project or via command line interface.

### Python

Installation: `pip install cronspell`

### Cli

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

Installation with cli-specific dependencies: `pip install cronspell[cli]`


## Syntax

### Comments
```cpp
// a comment
```

```cpp
/*
    multi-line
    comment ...
*/
```


### Datetime Designators
```cpp
/m -1d /sat
```

The same, more verbose:

```cpp
/month -1day /sat
```

### Datetime Designator Sets

By enclosing a set in curly braces (`{}`), a comma seperated list of datetime designators is evaluated.

```cpp
// here comes a set of datetime designators
{
    // first saturday of the month:
    /m -1d /sat + 7d,

    // sunday of every second calendar week:
    @cw 2 + 6d
}
```

Timezone Designation

```cpp
// `now` is the default anchor for subsequent designators.
// passing a timezone name to get the results with the same timezone:

now[Europe/Berlin] {
    // first saturday of the month:
    /m -1d /sat + 7d,

    // sunday of every second calendar week:
    @cw 2 + 6d
}
```

## pre-commit hook

This package comes with a [pre-commit](https://pre-commit.com/) hook that allows for automated
preflight checks on `yaml` files serving as sources for cronspell expressions.

Put this in your `.pre-commit-config.yaml` and adjust according to your needs:

```yaml
repos:
  - repo: https://github.com/iilei/cronspell
    rev: 8b455b10109b62d050bec9509649565ae8057ae8   # v0.4.0
    hooks:
      - id: cronspell
        files: .*\/cfg\.ya?ml$
        args: ["--yamlpath", "/*/*date*" ]

```


## Credits

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

[TextX]: https://textx.github.io/textX/
[The Hatchlor]: https://github.com/florianwilhelm/the-hatchlor



[Tests-image]: https://github.com/iilei/cronspell/actions/workflows/tests.yml/badge.svg?branch=master
[Tests-link]: https://github.com/iilei/cronspell/actions/workflows/tests.yml
[hatch-image]: https://img.shields.io/badge/%F0%9F%A5%9A-hatch-4051b5.svg
[hatch-link]: https://github.com/pypa/hatch
[ruff-image]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
[ruff-link]: https://github.com/charliermarsh/ruff
[mypy-image]: https://img.shields.io/badge/Types-mypy-blue.svg
[mypy-link]: https://mypy-lang.org/
[pytest-image]: https://img.shields.io/static/v1?label=‎&message=Pytest&logo=Pytest&color=0A9EDC&logoColor=white
[pytest-link]:  https://docs.pytest.org/
[mkdocs-image]: https://img.shields.io/static/v1?label=‎&message=mkdocs&logo=Material+for+MkDocs&color=526CFE&logoColor=white
[mkdocs-link]: https://www.mkdocs.org/
[precommit-image]: https://img.shields.io/static/v1?label=‎&message=pre-commit&logo=pre-commit&color=76877c
[precommit-link]: https://pre-commit.com/
[MIT-image]: https://img.shields.io/badge/License-MIT-9400d3.svg
[MIT-link]: https://raw.githubusercontent.com/iilei/cronspell/refs/heads/master/LICENSE.txt
[Github Pages]: https://img.shields.io/badge/github%20pages-121013?style=for-the-badge&logo=github&logoColor=teal
[Github Pages Link]: https://iilei.github.io/cronspell/

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cronspell",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "configuration, cron, crontab, date, datetime, dsl",
    "author": null,
    "author_email": "Jochen Preusche <922226+iilei@users.noreply.github.com>",
    "download_url": "https://files.pythonhosted.org/packages/ee/ba/b7d77b9936333640bd0a78ea82ee2842eaa93508427cc1f93add2f79fe5f/cronspell-0.4.1.tar.gz",
    "platform": null,
    "description": "\n# Cronspell Python Package / CLI Tool\n***Chronometry Spelled Out***\n\n\n[![Github Pages][Github Pages]][Github Pages Link]\n\n\n|          |                                                                                                                                                                                                                                   |\n| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Details  | [![Tests][Tests-image]][Tests-link] [![License - MIT][MIT-image]][MIT-link]                                                                                                                                                       |\n| Features | [![linting - Ruff][ruff-image]][ruff-link] [![types - mypy][mypy-image]][mypy-link] [![test - pytest][pytest-image]][pytest-link]  [![Pre-Commit][precommit-image]][precommit-link] [![docs - mkdocs][mkdocs-image]][mkdocs-link] |\n\nDate-expression domain specific language (DSL) parsing. A neat way to express things like \"First Saturday of any year\", or \"3rd thursdays each month\" and such.\n\n\n## Status\n\nCronSpell is currently in Beta. While it is considered well tested and stable for most use cases, there may still be some edge cases and bugs that need to be addressed. The maintainer encourages users to try it out and [provide feedback to help improving the library.](https://github.com/iilei/cronspell/issues)\n\nYour contributions and bug reports are highly appreciated.\n\n## Features\n\nCronspell is heavily inspired by Grafana's relative Date picker user interface. It was designed for the cases when configuration is needed to reflect irregular date-distances.\n\nUse it within your Python project or via command line interface.\n\n### Python\n\nInstallation: `pip install cronspell`\n\n### Cli\n\nThe same interface, exposed to the command line. Formatted via `isodate` by default -- which is\nopen for coniguration using the `--format` option.\n\nInstallation with cli-specific dependencies: `pip install cronspell[cli]`\n\n\n## Syntax\n\n### Comments\n```cpp\n// a comment\n```\n\n```cpp\n/*\n    multi-line\n    comment ...\n*/\n```\n\n\n### Datetime Designators\n```cpp\n/m -1d /sat\n```\n\nThe same, more verbose:\n\n```cpp\n/month -1day /sat\n```\n\n### Datetime Designator Sets\n\nBy enclosing a set in curly braces (`{}`), a comma seperated list of datetime designators is evaluated.\n\n```cpp\n// here comes a set of datetime designators\n{\n    // first saturday of the month:\n    /m -1d /sat + 7d,\n\n    // sunday of every second calendar week:\n    @cw 2 + 6d\n}\n```\n\nTimezone Designation\n\n```cpp\n// `now` is the default anchor for subsequent designators.\n// passing a timezone name to get the results with the same timezone:\n\nnow[Europe/Berlin] {\n    // first saturday of the month:\n    /m -1d /sat + 7d,\n\n    // sunday of every second calendar week:\n    @cw 2 + 6d\n}\n```\n\n## pre-commit hook\n\nThis package comes with a [pre-commit](https://pre-commit.com/) hook that allows for automated\npreflight checks on `yaml` files serving as sources for cronspell expressions.\n\nPut this in your `.pre-commit-config.yaml` and adjust according to your needs:\n\n```yaml\nrepos:\n  - repo: https://github.com/iilei/cronspell\n    rev: 8b455b10109b62d050bec9509649565ae8057ae8   # v0.4.0\n    hooks:\n      - id: cronspell\n        files: .*\\/cfg\\.ya?ml$\n        args: [\"--yamlpath\", \"/*/*date*\" ]\n\n```\n\n\n## Credits\n\n* Domain-Specific-Language Parser: [TextX]\n* This package was created with [The Hatchlor] project template.\n\n[TextX]: https://textx.github.io/textX/\n[The Hatchlor]: https://github.com/florianwilhelm/the-hatchlor\n\n\n\n[Tests-image]: https://github.com/iilei/cronspell/actions/workflows/tests.yml/badge.svg?branch=master\n[Tests-link]: https://github.com/iilei/cronspell/actions/workflows/tests.yml\n[hatch-image]: https://img.shields.io/badge/%F0%9F%A5%9A-hatch-4051b5.svg\n[hatch-link]: https://github.com/pypa/hatch\n[ruff-image]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json\n[ruff-link]: https://github.com/charliermarsh/ruff\n[mypy-image]: https://img.shields.io/badge/Types-mypy-blue.svg\n[mypy-link]: https://mypy-lang.org/\n[pytest-image]: https://img.shields.io/static/v1?label=\u200e&message=Pytest&logo=Pytest&color=0A9EDC&logoColor=white\n[pytest-link]:  https://docs.pytest.org/\n[mkdocs-image]: https://img.shields.io/static/v1?label=\u200e&message=mkdocs&logo=Material+for+MkDocs&color=526CFE&logoColor=white\n[mkdocs-link]: https://www.mkdocs.org/\n[precommit-image]: https://img.shields.io/static/v1?label=\u200e&message=pre-commit&logo=pre-commit&color=76877c\n[precommit-link]: https://pre-commit.com/\n[MIT-image]: https://img.shields.io/badge/License-MIT-9400d3.svg\n[MIT-link]: https://raw.githubusercontent.com/iilei/cronspell/refs/heads/master/LICENSE.txt\n[Github Pages]: https://img.shields.io/badge/github%20pages-121013?style=for-the-badge&logo=github&logoColor=teal\n[Github Pages Link]: https://iilei.github.io/cronspell/\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "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",
    "version": "0.4.1",
    "project_urls": {
        "Documentation": "https://github.com/iilei/cronspell",
        "Source": "https://github.com/iilei/cronspell"
    },
    "split_keywords": [
        "configuration",
        " cron",
        " crontab",
        " date",
        " datetime",
        " dsl"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f63922f0413a5c9a4f243382f3dd64f33049139b8c709a8a7c3a357f8144f5ec",
                "md5": "a2b58c4ddd90ffe1ad71a5c9e5aaf310",
                "sha256": "68a7fb39c1786bdf8bed0250c957a67b63939ffb7c0ecdaad51f4b7feafb3392"
            },
            "downloads": -1,
            "filename": "cronspell-0.4.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a2b58c4ddd90ffe1ad71a5c9e5aaf310",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 14336,
            "upload_time": "2025-01-03T02:57:57",
            "upload_time_iso_8601": "2025-01-03T02:57:57.948264Z",
            "url": "https://files.pythonhosted.org/packages/f6/39/22f0413a5c9a4f243382f3dd64f33049139b8c709a8a7c3a357f8144f5ec/cronspell-0.4.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eebab7d77b9936333640bd0a78ea82ee2842eaa93508427cc1f93add2f79fe5f",
                "md5": "aa1eda84a5501b01748cc3bc10ec6d92",
                "sha256": "6cd2755936f8d851691203c2f4feeea5496ca7f1e56a6500afdb47461d5dc428"
            },
            "downloads": -1,
            "filename": "cronspell-0.4.1.tar.gz",
            "has_sig": false,
            "md5_digest": "aa1eda84a5501b01748cc3bc10ec6d92",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 13254,
            "upload_time": "2025-01-03T02:58:00",
            "upload_time_iso_8601": "2025-01-03T02:58:00.113197Z",
            "url": "https://files.pythonhosted.org/packages/ee/ba/b7d77b9936333640bd0a78ea82ee2842eaa93508427cc1f93add2f79fe5f/cronspell-0.4.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-03 02:58:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "iilei",
    "github_project": "cronspell",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "cronspell"
}
        
Elapsed time: 0.40058s