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.16

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.16
File Size Uploaded Provenance
tdvutil-0.0.16.tar.gz 116.3 kB With provenance Details

Built distribution (wheel)

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

Total release size: 166.7 kB

Release files / tdvutil-0.0.16.tar.gz

Download URL tdvutil-0.0.16.tar.gz
Size 116.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1a8eddc01419b60b78045ac92cc66c57149b3338c287d7edb684dd4967e1dc2f
BLAKE2b-256 checksum
How to use checksums
d6d89ae90adc8df2f948a25f7186fb83d77e9e9acf114ec1c946b55cc91d277e
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 23, 2026.

Transparency log

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

Download URL tdvutil-0.0.16-py3-none-any.whl
Size 50.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2bbc4715d9f5d5152e7d91a82249d3318940ad743133af67e0fe2417fd263be7
BLAKE2b-256 checksum
How to use checksums
0fcb0ee6a7838b4291354b05c72091c919a41e71e7eb6bdc69c908f130c30235
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 23, 2026.

Transparency log

Security for tdvutil 0.0.16

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.16.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 23, 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