I found myself wanting to convert a string to a duration (int), for some configuration.
Something you can call like this:
string_to_duration("1d", target="days")
string_to_duration("1d", target="hours")
string_to_duration("3m", target="hours")
string_to_duration("3m", target="minutes")
The code :
from typing import Literal
def string_to_duration(value: str, target: Literal["days …
I’m using llm more and more, and today I had to find back prompts I used in the past. Here is a command I’ve been using, which allows me to filter the results based on what I want. It leverages sql-utils, a cli tool which is able to …
It’s been a while I didn’t packaged something new. I recently remembered an old package of mine that needed some attention : debts. It’s now time to package it, so I discovered hatch
hatch new —init
This does the heavy-lifting for you, actually porting the setup.py
files …