🐍🗓️6️⃣ The dateutil library is a popular and powerful Python library for dealing with dates and times.

However, it still supports Python 2.7 by depending on the six compatibility shim, and I’d prefer not to install it for Python 3.10+.

Here’s how I replaced three uses of its relativedelta in a couple of CLIs that didn’t really need to use it.

hugovk.dev/blog/2025/minus-six/
#Python #dateutil #six

Follow

@hugovk Despite the fact that the thing preventing a 3+-only release at this point is just me writing documentation (and thus this makes me feel very guilty), I'm kind of OK with this as a general principle.

I usually tell people not to use the parser at all. Relativedelta has a bit great UI but is a pretty good basic component. Would love the time to make everything faster, but, uh, I haven't even had time to write down how to use the things I already did so.. yeah..

@pganssle Yeah, relativedelta really is useful, although I didn't actually need it in two cases here, and in the third, +180 days is a good enough approximation for +6 months.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.