METADATA 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. Metadata-Version: 2.1
  2. Name: cron-descriptor
  3. Version: 1.4.5
  4. Summary: A Python library that converts cron expressions into human readable strings.
  5. Home-page: https://github.com/Salamek/cron-descriptor
  6. Author: Adam Schubert
  7. Author-email: adam.schubert@sg1-game.net
  8. Classifier: Development Status :: 5 - Production/Stable
  9. Classifier: Environment :: Web Environment
  10. Classifier: Environment :: Console
  11. Classifier: Intended Audience :: Developers
  12. Classifier: License :: OSI Approved :: MIT License
  13. Classifier: Operating System :: OS Independent
  14. Classifier: Programming Language :: Python
  15. Classifier: Programming Language :: Python :: 3.8
  16. Classifier: Programming Language :: Python :: 3.9
  17. Classifier: Programming Language :: Python :: 3.10
  18. Classifier: Programming Language :: Python :: 3.11
  19. Classifier: Programming Language :: Python :: 3.12
  20. Classifier: Topic :: Software Development
  21. Description-Content-Type: text/markdown
  22. License-File: LICENSE
  23. Provides-Extra: dev
  24. Requires-Dist: polib ; extra == 'dev'
  25. # Cron Descriptor
  26. [![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)
  27. [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/salamek)
  28. A Python library that converts cron expressions into human readable strings. Ported to Python from https://github.com/bradyholt/cron-expression-descriptor.
  29. **Author**: Adam Schubert (https://www.salamek.cz)
  30. **Original Author & Credit**: Brady Holt (http://www.geekytidbits.com)
  31. **License**: [MIT](http://opensource.org/licenses/MIT)
  32. ## Features
  33. * Supports all cron expression special characters including * / , - ? L W, #
  34. * Supports 5, 6 (w/ seconds or year), or 7 (w/ seconds and year) part cron expressions
  35. * Provides casing options (Sentence, Title, Lower, etc.)
  36. * Localization with support for 17 languages
  37. * Supports Python 3.8 - 3.12
  38. ## Installation
  39. Using PIP
  40. ```bash
  41. pip install cron-descriptor
  42. ```
  43. ## Usage example
  44. ### Simple
  45. ```python
  46. from cron_descriptor import get_description, ExpressionDescriptor
  47. print(get_description("* 2 3 * *"))
  48. #OR
  49. print(str(ExpressionDescriptor("* 2 3 * *")))
  50. ```
  51. ### Advanced
  52. ```python
  53. # Consult Options.py/CasingTypeEnum.py/DescriptionTypeEnum.py for more info
  54. from cron_descriptor import Options, CasingTypeEnum, DescriptionTypeEnum, ExpressionDescriptor
  55. descriptor = ExpressionDescriptor(
  56. expression = "*/10 * * * *",
  57. casing_type = CasingTypeEnum.Sentence,
  58. use_24hour_time_format = True
  59. )
  60. # GetDescription uses DescriptionTypeEnum.FULL by default:
  61. print(descriptor.get_description())
  62. print("{}".format(descriptor))
  63. # Or passing Options class as second argument:
  64. options = Options()
  65. options.casing_type = CasingTypeEnum.Sentence
  66. options.use_24hour_time_format = True
  67. descriptor = ExpressionDescriptor("*/10 * * * *", options)
  68. print(descriptor.get_description(DescriptionTypeEnum.FULL))
  69. ```
  70. ## Languages Available
  71. |Language| Locale Code | Contributor |
  72. |--------|-------------|-------------|
  73. |English |en|[Brady Holt](https://github.com/bradyholt)|
  74. |Brazilian |pt_PT|[Renato Lima](https://github.com/natenho)|
  75. |Chinese Simplified | zh_CN |[Star Peng](https://github.com/starpeng)|
  76. |Spanish |es_ES|[Ivan Santos](https://github.com/ivansg)|
  77. |Norwegian |nb_NO|[Siarhei Khalipski](https://github.com/KhalipskiSiarhei)|
  78. |Turkish |tr_TR|[Mustafa SADEDİL](https://github.com/sadedil)|
  79. |Dutch |nl_NL|[TotalMace](https://github.com/TotalMace)|
  80. |Russian |ru_RU|[LbISS](https://github.com/LbISS)|
  81. |French |fr_FR|[Arnaud TAMAILLON](https://github.com/Greybird)|
  82. |German |de_DE|[Michael Schuler](https://github.com/mschuler)|
  83. |Ukrainian |uk_UA|[Taras](https://github.com/tbudurovych)|
  84. |Italian |it_IT|[rinaldihno](https://github.com/rinaldihno)|
  85. |Czech |cs_CZ|[Adam Schubert](https://github.com/salamek)|
  86. |Swedish |sv_SE|[Åke Engelbrektson](https://github.com/eson57)|
  87. |Tamil |ta_IN|[Sankar Hari](https://github.com/sankarhari)|
  88. |Persian|fa_IR|[M. Yas. Davoodeh](https://github.com/Davoodeh)|
  89. |Korean|ko_KR|[KyuJoo Han](https://github.com/hanqyu)|
  90. |Japanese |ja_JP|[Tho Nguyen](https://github.com/tho-asterist)|
  91. <!-- SOON
  92. ## Demo
  93. ## Download
  94. -->
  95. ## Original Source
  96. - .NET - [https://github.com/bradyholt/cron-expression-descriptor](https://github.com/bradyholt/cron-expression-descriptor)
  97. ## Ports
  98. - Java - [https://github.com/RedHogs/cron-parser](https://github.com/RedHogs/cron-parser)
  99. - Ruby - [https://github.com/alpinweis/cronex](https://github.com/alpinweis/cronex)
  100. - Golang - [https://github.com/jsuar/go-cron-descriptor](https://github.com/jsuar/go-cron-descriptor)
  101. ## Running Unit Tests
  102. ```bash
  103. python setup.py test
  104. ```
  105. ## Translating
  106. cron-descriptor is using [Gettext](https://www.gnu.org/software/gettext/) for translations.
  107. > To create new translation or edit existing one, i suggest using [Poedit](https://poedit.net/).
  108. You can copy/rename and translate any file from `locale` directory:
  109. ```bash
  110. cp ./cron_descriptor/locale/de_DE.po ./cron_descriptor/locale/YOUR_LOCALE_CODE.po
  111. poedit ./cron_descriptor/locale/YOUR_LOCALE_CODE.po
  112. ```
  113. or you can generate new untranslated *.po file from sources by running in `cron_descriptor` directory:
  114. ```bash
  115. cd cron_descriptor
  116. xgettext *.py -o locale/YOUR_LOCALE_CODE.po
  117. ```
  118. Generating *.mo file from *.po file. In root directory run command:
  119. ```bash
  120. msgfmt -o cron_descriptor/locale/YOUR_LOCALE_CODE.mo cron_descriptor/locale/YOUR_LOCALE_CODE.po
  121. ```
  122. ## Developing
  123. All suggestions and PR's are welcomed
  124. Just clone this repository and register pre-commit hook by running:
  125. ```bash
  126. ln -s ../../pre-commit.sh .git/hooks/pre-commit
  127. ```
  128. Then install dev requirements:
  129. ```bash
  130. pip install ruff
  131. ```