Skip to main content

67 posts tagged with "uv"

uv, the Fast Python Package and Project Manager, Its Commands and pyproject.toml

View All Tags

How to Get the Current Time in UTC in Python

· 4 min read
Jagdish Kumawat
Founder @ Dewiride

Times stored or sent between systems are safest in UTC, the time zone that never changes for daylight saving. In Python, datetime.now(tz=timezone.utc) gives you the current time in UTC, labelled as UTC, so nothing downstream has to guess which zone it's in.

How to Write a Docstring in Python

· 4 min read
Jagdish Kumawat
Founder @ Dewiride

A docstring is the short description that sits at the top of a function and says what it does. Unlike a comment, Python keeps it with the function, so help(), editors and documentation tools can show it to anyone who uses your code.

How to Add Type Hints to a Python Function

· 4 min read
Jagdish Kumawat
Founder @ Dewiride

A type hint writes down what kind of value a function expects and returns: a float here, an int there. Editors use the hints to warn you early, and readers see at a glance what to pass, but Python itself doesn't check them when the code runs.