tdvutil
A grab bag of little Python helpers I kept copy-pasting between projects, so I finally stuck them in one place.
Heads up: this is mostly here for my own convenience. You're welcome to use it, but I make no promises about keeping the API stable. Things can and will get renamed, changed, or ripped out whenever it suits me, even in minor releases. If you depend on it, pin a version.
Installing
pip install tdvutil
Needs Python 3.9+.
What's in here
From tdvutil directly:
ppretty: pretty-prints objectsalintrospect/whatis: a very janky way to poke at an object's class hierarchy and see where its methods and attributes come fromnow/nowf: current time, with less typingpathfix: path cleanupsec_to_hms,sec_to_timecode,sec_to_shortstr,hms_to_sec,timecode_to_sec: converting between seconds and human-readable times
Plus a couple of submodules:
tdvutil.argparse:CheckFileandNegateAction, for argparsetdvutil.llmcost: pricing data for a bunch of LLM models, and a way to figure out what a call cost
from tdvutil import sec_to_hms
from tdvutil.llmcost import get_model
sec_to_hms(3725) # '01:02:05.000'
cost = get_model("gpt-4o").cost(input_tokens=10_000, output_tokens=2_000)
print(cost.total_cost) # 0.045
Hacking on it
Uses uv. make localdev sets things up,
make test runs the tests, and make dist builds.
GitHub Actions runs the tests and builds packages for PRs targeting main
and pushes to main, without publishing. Maintainer approval is required
to run outside contributors' PR workflows.
Pushing a v* tag makes GitHub Actions build it and publish to TestPyPI,
then PyPI. Manually running the workflow on a v* tag does the same,
including publishing to real PyPI. Manual branch runs just run the checks
and save the built packages as workflow artifacts; they don't publish.
License
GPLv3, see LICENSE.txt.
Metadata
Release files for tdvutil 0.0.14
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 | |
|---|---|---|---|---|
| tdvutil-0.0.14.tar.gz | 116.3 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tdvutil-0.0.14-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 166.3 kB
Release files / tdvutil-0.0.14.tar.gz
| Download URL | tdvutil-0.0.14.tar.gz |
|---|---|
| Size | 116.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a79e15c7fcad85a900622d85aa38d03e7c36a012222f92d6829a39a6eaec0704
|
|
BLAKE2b-256 checksum How to use checksums |
5d06874030afa888d3d1569af5c3ba6291d9e8a8fc12efabfdb364fbb21e5e51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.
Transparency logRelease files / tdvutil-0.0.14-py3-none-any.whl
| Download URL | tdvutil-0.0.14-py3-none-any.whl |
|---|---|
| Size | 50.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d43a74aea6c30f14564a772317e7d862c2c1ed31db9cd387dedbf73bc9820233
|
|
BLAKE2b-256 checksum How to use checksums |
6f544933c992d1296b298a65b454ef7805df34205d0fd21eb55009b4771e9f71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.
Transparency logSecurity for tdvutil 0.0.14
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for tdvutil-0.0.14.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.
Transparency logA 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.