ENH: make pytensor-cache list pipeable (one record per line)

Open
#2,533 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
64/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
cli

Research direction

Find the pytensor-cache list command and read the related change in #2532, along with the convention in #2531. Update the output so each compiled module has one tab-separated line with its path first, directory size, and age; check whether aggregate output belongs on stderr or behind --summary. Done means the listed records can be consumed uniformly by tools such as grep, awk, and fzf.

Written by the indexing model from the issue text.

Description

Description

The current list output is a multi-section aligned report. Facts from a real cache (323 modules, 68 MB):

  • The compile-time column is nans for every module: it is computed from mod.c and .so mtimes, which cache-hit entries do not both have.
  • Sizes shown are key.pkl sizes only; the .so files, which hold the actual bulk, have no size column.
  • Module age is not shown.
  • The multiple-ops case goes to a separate table, so lines cannot be uniformly consumed by grep/awk/fzf.
Proposal

One line per compiled module, tab-separated, path first:

<key_dir_path>\t<ops>\t<dir_size>\t<age>
  • Path first so column 1 feeds fzf, xargs rm -rf, awk '{print $1}'.
  • Dir size (not just key size) and age answer "what is this, how big, how old".
  • Compile time is dropped unless it can be computed reliably.
  • Aggregate views (op-class counts, big-key report, 0-op summary) move to stderr, per the convention of #2531, or behind --summary.

Use cases: pytensor-cache list | fzf --preview 'ls -la {1}', ... | grep Elemwise, bloat hunting with sort. Builds on #2532; a --json flag could be a follow-up.

Dominant language
Python
Stars
655
Forks
266
Avg merge
3d 23h
Merged PRs (30d)
43

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pymc-devs/pytensor

All issues in pymc-devs/pytensor

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.