nano-duration
Tiny h/m/s ↔ seconds converter — ~1 KB, zero deps. Single-file, CLI included. Perfect for code-golf, minimal containers, or just for fun.
✨ Features
- ✅
2h 15m 3s→8103(seconds) - ✅
8103→2h15m3s - ✅ Accepts spaces/hybrids (
"1h5m","90s"," 2H "), case-insensitive - ✅ Zero dependencies, single tiny file
🚀 Usage
# Local (from repo)
python app_min.py "1h 5m 2s" # 3902
python app_min.py 3902 # 1h5m2s
python app_min.py 90 # 1m30s
After installing:
# CLI
pip install nano-duration
nano-duration "2h 15m 3s" # 8103
nano-duration 8103 # 2h15m3s
🤓 Why so small?
- Minimal regex ((\d+)\s*([hms])) + tiny map {h:3600,m:60,s:1}
- No heavy parsing; simple greedy division for formatting
- Single module + tiny CLI wrapper
🎉 Fun Ideas
- Sum durations in shell
echo $(( $(nano-duration "1h 2m") + $(nano-duration "35m") ))
# -> 5820
- Convert logs to readable
awk '{print $1}' times.txt | xargs -I{} nano-duration {} # each line seconds→hms
Notes Only h/m/s units are supported (no days/ms). Negative values are not recommended.
📜 License
MIT © 2025
Metadata
Release files for nano-duration-py 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nano_duration_py-0.1.0.tar.gz | 3.1 kB | Without provenance | Details for nano_duration_py-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nano_duration_py-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for nano_duration_py-0.1.0-py3-none-any.whl |
Total release size: 6.7 kB
Release files / nano_duration_py-0.1.0.tar.gz
| Download URL | nano_duration_py-0.1.0.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
159a9ec6eb4c0246cf694a9901baa87758bb4300e1e0320b723667d91a5116d2
|
|
BLAKE2b-256 checksum How to use checksums |
6e3b773cfe697780f9da7ba834daf3fc652b5f9c1024c537c249bc43a66bfe84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / nano_duration_py-0.1.0-py3-none-any.whl
| Download URL | nano_duration_py-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cfe3532216327ddfc1d40503cc8a902fe9b3e217720c2ca709a8b11ce294a1b7
|
|
BLAKE2b-256 checksum How to use checksums |
f829fc1321a2cf39399fbf8d9863ba17dda2fce22c782c0ee863108e5b3a3f28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for nano-duration-py 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.