---
title: "cron-descriptor | pypx"
description: "A Python library that converts cron expressions into human readable strings."
canonical_url: "https://pypx.app/packages/cron-descriptor"
meta:
  "og:description": "A Python library that converts cron expressions into human readable strings."
  "og:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_cron-descriptor%2Cversion_2.3.5%2Csummary_A%2BPython%2Blibrary%2Bthat%2Bconverts%2Bcron%2Bexpressions%2Binto%2Bhuman%2Breadable%2Bstrings.%2Clicense_MIT%2Cp_Ii9wYWNrYWdlcy9jcm9uLWRlc2NyaXB0b3Ii%2Cs_XP_hOUra5NrwcAAB.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "cron-descriptor 2.3.5"
  "twitter:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_cron-descriptor%2Cversion_2.3.5%2Csummary_A%2BPython%2Blibrary%2Bthat%2Bconverts%2Bcron%2Bexpressions%2Binto%2Bhuman%2Breadable%2Bstrings.%2Clicense_MIT%2Cp_Ii9wYWNrYWdlcy9jcm9uLWRlc2NyaXB0b3Ii%2Cs_XP_hOUra5NrwcAAB.png"
---

> Index of every page on this site: [llms.txt](https://pypx.app/llms.txt)

# **cron-descriptor**

v2.3.5

A Python library that converts cron expressions into human readable strings.

78 KB Python 3.10+ py3-none-anyMIT2 deps

[** Diff **](https://pypx.app/packages/cron-descriptor/diff)

`$ uv add cron-descriptor`

# Cron Descriptor

[![Python tests](https://github.com/Salamek/cron-descriptor/actions/workflows/python-test.yml/badge.svg)](https://github.com/Salamek/cron-descriptor/actions/workflows/python-test.yml) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/salamek)

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](http://opensource.org/licenses/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.10 - 3.13

## Installation

Using PIP

```
pip install cron-descriptor
```

Babel is installed automatically. The selected `locale_code` controls sentence translations and weekday/month names without changing the process locale. Missing message catalogs fall back to English. Custom catalogs with a locale identifier unknown to Babel retain their messages and use English calendar names.

## 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))
```

### Expressions with six fields

Set `six_field_expression_has_seconds` to select the format:

- `None` (default): Use the existing automatic format detection.
- `True`: Read the fields as seconds, minutes, hours, day of month, month, and day of week.
- `False`: Read the fields as minutes, hours, day of month, month, day of week, and year.

This option applies only to expressions with six fields.

```
from cron_descriptor import ExpressionDescriptor, Options, get_description

options = Options(locale_code="en_US", six_field_expression_has_seconds=False)
print(get_description("* * * * * *", options))  # Every minute

# Set the option with an ExpressionDescriptor keyword argument.
descriptor = ExpressionDescriptor(
    "* * * * * *",
    locale_code="en_US",
    six_field_expression_has_seconds=False,
)
print(descriptor.get_description())  # Every minute
```

### Handling malformed expressions

Catch `FormatError` when parsing or describing an expression fails. Input conversion errors retain the original exception in `__cause__`, including when requesting a partial description through `get_description(DescriptionTypeEnum.DAYOFWEEK)`. Empty expressions raise `MissingFieldError`.

```
from cron_descriptor import FormatError, MissingFieldError, get_description

try:
    description = get_description("* $ * * *")
except (FormatError, MissingFieldError) as error:
    print(f"Cannot describe expression: {error}")
```

Descriptions do not guarantee that an expression is valid for your scheduler. Use the separate `ExpressionValidator` class when validation is needed.

## Languages Available

| Language | Locale Code | Contributor |
| --- | --- | --- |
| English | en | [Brady Holt](https://github.com/bradyholt) |
| Chinese Simplified | zh\_CN | [Star Peng](https://github.com/starpeng) |
| Chinese Traditional | zh\_TW | [Ricky Chiang](https://github.com/metavige) |
| Czech | cs\_CZ | [Adam Schubert](https://github.com/salamek) |
| Danish | da\_DK | [Rasmus Melchior Jacobsen](https://github.com/rmja) |
| Dutch | nl\_NL | [TotalMace](https://github.com/TotalMace) |
| Finnish | fi\_FI | [Mikael Rosenberg](https://github.com/MR77FI) |
| French | fr\_FR | [Arnaud TAMAILLON](https://github.com/Greybird) |
| German | de\_DE | [Michael Schuler](https://github.com/mschuler) |
| Hebrew | he\_IL | [Ariel Deil](https://github.com/arieldeil) |
| Hungarian | hu\_HU | [Varga Miklós](https://github.com/Micky2149) |
| Italian | it\_IT | [rinaldihno](https://github.com/rinaldihno) |
| Japanese | ja\_JP | [Tho Nguyen](https://github.com/tho-asterist) |
| Korean | ko\_KR | [KyuJoo Han](https://github.com/hanqyu) |
| Norwegian | nb\_NO | [Siarhei Khalipski](https://github.com/KhalipskiSiarhei) |
| Persian | fa\_IR | [A. Bahrami](https://github.com/alirezakoo) |
| Polish | pl\_PL | [foka](https://github.com/foka) |
| Portuguese | pt\_PT | [Renato Lima](https://github.com/natenho) |
| Portuguese (Brazil) | pt\_BR | [Renato Lima](https://github.com/natenho) |
| Romanian | ro\_RO | [Illegitimis](https://github.com/illegitimis) |
| Russian | ru\_RU | [LbISS](https://github.com/LbISS) |
| Slovenian | sl\_SI | [Jani Bevk](https://github.com/jenzy) |
| Spanish | es\_ES | [Ivan Santos](https://github.com/ivansg) |
| Spanish (Mexico) | es\_MX | [Ion Mincu](https://github.com/ionmincu) |
| Swedish | sv\_SE | [Åke Engelbrektson](https://github.com/eson57) |
| Vietnamese | vi\_VN | [Nguyen Duc Son](https://github.com/ali33) |
| Tamil | ta\_IN | [Sankar Hari](https://github.com/sankarhari) |
| Thai | th\_TH | [Michael Lyons](https://github.com/michaelblyons) |
| Turkish | tr\_TR | [Mustafa SADEDİL](https://github.com/sadedil) |
| Ukrainian | uk\_UA | [Taras](https://github.com/tbudurovych) |
| Greek | el\_GR | [hardra1n](https://github.com/Hardra1n) |
| Kazakh | kk\_KZ | [hardra1n](https://github.com/Hardra1n) |

## Original Source

- .NET - https://github.com/bradyholt/cron-expression-descriptor

## Ports

- Java - https://github.com/RedHogs/cron-parser
- Ruby - https://github.com/alpinweis/cronex
- Golang - https://github.com/jsuar/go-cron-descriptor

## Running Unit Tests

```
python setup.py test
```

## Translating

cron-descriptor is using [Gettext](https://www.gnu.org/software/gettext/) for translations.

> To create new translation or edit existing one, i suggest using [Poedit](https://poedit.net/).

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]
```

## **Details **

<dl>

<dt>Version</dt>
<dd>2.3.5</dd>

<dt>License</dt>
<dd>MIT</dd>

<dt>Python</dt>
<dd>&gt;=3.10</dd>

<dt>Maintainer</dt>
<dd>Adam Schubert &lt;adam.schubert@sg1-game.net&gt;</dd></dl>

## **Links**

- [Homepage](https://github.com/Salamek/cron-descriptor)
- [View on PyPI](https://pypi.org/project/cron-descriptor/)

## **Release Cadence **

**10**

releases in the past year

avg 94 days between releases

## **Maintainers **

- Adam Schubert · [adam.schubert@sg1-game.net](mailto:adam.schubert@sg1-game.net)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://pypx.app/#website","@type":"WebSite","description":"The Python Package Index, reimagined. Fast search, dependency insights, download trends, and changelogs — all in one place.","name":"pypx","url":"https://pypx.app/"},{"@id":"https://pypx.app/packages/cron-descriptor#webpage","@type":"WebPage","description":"A Python library that converts cron expressions into human readable strings.","name":"cron-descriptor","url":"https://pypx.app/packages/cron-descriptor","isPartOf":{"@id":"https://pypx.app/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://pypx.app/packages/cron-descriptor"]}]},{"@id":"https://pypx.app/packages/cron-descriptor#/schema/software-application/1","@type":"SoftwareApplication","applicationCategory":"DeveloperApplication","description":"A Python library that converts cron expressions into human readable strings.","license":"MIT","name":"cron-descriptor","softwareVersion":"2.3.5"}]}
```

## Sitemap

See the full [sitemap](https://pypx.app/sitemap.md) for all pages.
