Skip to main content

Cron Descriptor

Python tests Donate

A Python library that converts cron expressions into human readable strings. Ported to Python from https://github.com/bradyholt/cron-expression-descriptor.

Author: Adam Schubert (https://www.salamek.cz)
Original Author & Credit: Brady Holt (http://www.geekytidbits.com)
License: MIT

Features

  • Supports all cron expression special characters including * / , - ? L W, #
  • Supports 5, 6 (w/ seconds or year), or 7 (w/ seconds and year) part cron expressions
  • Provides casing options (Sentence, Title, Lower, etc.)
  • Localization with support for ~31 languages
  • Supports Python 3.9 - 3.13

Installation

Using PIP

pip install cron-descriptor

Usage example

Simple

from cron_descriptor import get_description, ExpressionDescriptor

print(get_description("* 2 3 * *"))

#OR

print(str(ExpressionDescriptor("* 2 3 * *")))

Advanced

# Consult Options.py/CasingTypeEnum.py/DescriptionTypeEnum.py for more info
from cron_descriptor import Options, CasingTypeEnum, DescriptionTypeEnum, ExpressionDescriptor

descriptor = ExpressionDescriptor(
    expression = "*/10 * * * *",
    casing_type = CasingTypeEnum.Sentence,
    use_24hour_time_format = True
)

# GetDescription uses DescriptionTypeEnum.FULL by default:
print(descriptor.get_description())
print(f"{descriptor = }")

# Or passing Options class as second argument:

options = Options()
options.casing_type = CasingTypeEnum.Sentence
options.use_24hour_time_format = True
descriptor = ExpressionDescriptor("*/10 * * * *", options)
print(descriptor.get_description(DescriptionTypeEnum.FULL))

Languages Available

Language Locale Code Contributor
English en Brady Holt
Chinese Simplified zh_CN Star Peng
Chinese Traditional zh_TW Ricky Chiang
Czech cs_CZ Adam Schubert
Danish da_DK Rasmus Melchior Jacobsen
Dutch nl_NL TotalMace
Finnish fi_FI Mikael Rosenberg
French fr_FR Arnaud TAMAILLON
German de_DE Michael Schuler
Hebrew he_IL Ariel Deil
Hungarian hu_HU Varga Miklós
Italian it_IT rinaldihno
Japanese ja_JP Tho Nguyen
Korean ko_KR KyuJoo Han
Norwegian nb_NO Siarhei Khalipski
Persian fa_IR A. Bahrami
Polish pl_PL foka
Portuguese pt_PT Renato Lima
Portuguese (Brazil) pt_BR Renato Lima
Romanian ro_RO Illegitimis
Russian ru_RU LbISS
Slovenian sl_SI Jani Bevk
Spanish es_ES Ivan Santos
Spanish (Mexico) es_MX Ion Mincu
Swedish sv_SE Åke Engelbrektson
Vietnamese vi_VN Nguyen Duc Son
Turkish tr_TR Mustafa SADEDİL
Tamil ta_IN Sankar Hari
Ukrainian uk_UA Taras
Greek el_GR hardra1n
Kazakh kk_KZ hardra1n

Original Source

Ports

Running Unit Tests

python setup.py test

Translating

cron-descriptor is using Gettext for translations.

To create new translation or edit existing one, i suggest using Poedit.

You can copy/rename and translate any file from locale directory:

cp ./cron_descriptor/locale/de_DE.po ./cron_descriptor/locale/YOUR_LOCALE_CODE.po
poedit ./cron_descriptor/locale/YOUR_LOCALE_CODE.po

or you can generate new untranslated *.po file from sources by running in cron_descriptor directory:

cd cron_descriptor
xgettext *.py -o locale/YOUR_LOCALE_CODE.po

Generating *.mo file from *.po file. In root directory run command:

msgfmt -o cron_descriptor/locale/YOUR_LOCALE_CODE.mo cron_descriptor/locale/YOUR_LOCALE_CODE.po

Developing

All suggestions and PR's are welcomed

Just clone this repository and register pre-commit hook by running:

ln -s ../../code-check.sh .git/hooks/pre-commit

Then install dev requirements:

pip install .[dev,test]

Metadata

Release files for cron-descriptor 2.0.6

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

Source distribution (sdist)

Source distribution for cron-descriptor 2.0.6
File Size Uploaded
cron_descriptor-2.0.6.tar.gz 49.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cron-descriptor 2.0.6
File Interpreter ABI Platform
cron_descriptor-2.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 123.9 kB

Release files / cron_descriptor-2.0.6.tar.gz

Download URL cron_descriptor-2.0.6.tar.gz
Size 49.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e39d2848e1d8913cfb6e3452e701b5eec662ee18bea8cc5aa53ee1a7bb217157
BLAKE2b-256 checksum
How to use checksums
7c310b21d1599656b2ffa6043e51ca01041cd1c0f6dacf5a3e2b620ed120e7d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / cron_descriptor-2.0.6-py3-none-any.whl

Download URL cron_descriptor-2.0.6-py3-none-any.whl
Size 74.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a1c0d837c0e5a32e415f821b36cf758eb92d510e6beff8fbfe4fa16573d93d6
BLAKE2b-256 checksum
How to use checksums
21cc361326a54ad92e2e12845ad15e335a4e14b8953665007fb514d3393dfb0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release history Release notifications | RSS feed

2.1.1

2 release files

2.1.0

2 release files

2.0.8

2 release files

This release

2.0.6 This release

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

1.4.5

2 release files

1.4.3

2 release files

1.4.0

1 release file

1.3.0

1 release file

1.2.35

1 release file

1.2.34

1 release file

1.2.32

1 release file

1.2.31

1 release file

1.2.30

1 release file

1.2.29

1 release file

1.2.28

1 release file

1.2.27

1 release file

1.2.24

1 release file

1.2.21

1 release file

1.2.20

2 release files

1.2.16

1 release file

1.2.10

1 release file

1.2.9

1 release file

1.2.8

1 release file

1.2.7

1 release file

1.2.6

1 release file

1.2.5

1 release file

1.2.4

1 release file

1.2.3

1 release file

1.2.2

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.0

1 release file

1.0.0

1 release file

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