Skip to main content

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 objects
  • alintrospect / whatis: a very janky way to poke at an object's class hierarchy and see where its methods and attributes come from
  • now / nowf: current time, with less typing
  • pathfix: path cleanup
  • sec_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: CheckFile and NegateAction, for argparse
  • tdvutil.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.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tdvutil 0.0.15
File Size Uploaded Provenance
tdvutil-0.0.15.tar.gz 116.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for tdvutil 0.0.15
File Interpreter ABI Platform
tdvutil-0.0.15-py3-none-any.whl Python 3 none any Details

Total release size: 166.5 kB

Release files / tdvutil-0.0.15.tar.gz

Download URL tdvutil-0.0.15.tar.gz
Size 116.5 kB
Tags Source
SHA-256 checksum
How to use checksums
74bd6a6a3210d8743d1d9935a825deb71d3aa3664761b2879bec6dba2b6e0d17
BLAKE2b-256 checksum
How to use checksums
873f2b33f526de6606555f3fff5000e53ae4fe716a842e323c65ad02af9d2ce7
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 12, 2026.

Transparency log

Release files / tdvutil-0.0.15-py3-none-any.whl

Download URL tdvutil-0.0.15-py3-none-any.whl
Size 50.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f13cfd84a51d2fcffe40c3f71964c63834da8acba920e5053f1a1ac20ad148b
BLAKE2b-256 checksum
How to use checksums
92f85c40dcdd6ac975884ce55c8d6b3cddaeb284a04cf3366b9d7e798cf03d3b
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 12, 2026.

Transparency log

Security for tdvutil 0.0.15

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.

Select from 2 files

Attestation for tdvutil-0.0.15.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 12, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page