kairos: crontab parsing library for Clojure

I have been tinkering with Clojure since the late 2020. When I publish an open-source project in Clojure, it’s mostly about two goals: solving a real-world problem and learning some new concepts or tooling in Clojure ecosystem. kairos is a Clojure library for parsing crontab is no exception of this rule.

kairos parses vixie crontab format and produces a lazy sequence of java.time.ZonedDateTime objects for UTC timezone that are in the future.

Java interop

kairos doesn’t use any Clojure wrapper libraries to work with java.time classes, like cljc.java-time or clojure.java-time. Instead it uses Java interop directly, so that no dependencies are needed for the library.

The main lesson learned here: using type hints and enabling warnings on reflection can boost code performance to 6-8 times!

Plain (set! *warn-on-reflection* true) works well for reflection detection. But eastwood linter can do the job too, in addition to many other things.

Clojure CLI and deps.edn

kairos is my first project with deps.edn and Clojure CLI used from the day 1. In my previous projects I used lein. Leiningen is a fantastic integrated tool for all important project-related tasks from running tests to building an uberjar. I still think that lein is the best in class for Clojure beginners, who want to focus on Clojure code and not on the tooling. On the other hand, Clojure CLI allows you to be much more flexible when writing tasks for CI, e.g. create custom entrypoints in Clojure code for testing or deploying jars to Clojars. It also seems to be a first-class citizen when it comes to Clojure core team support.

Apart from official docs, Sean Corfield’s dot-clojure repo and Practicalli’s clojure-cli-config are both great sources of inspiration.