Metadata-Version: 2.4
Name: ddpl
Version: 1.3.0
Summary: Deep Documentator for Python Libraries — inspect modules and PyPI sdists (C/C++/Rust/… sources, binaries, build files).
Author: DDPL contributors
License: MIT
Keywords: documentation inspect pypi sdist sources c rust binary elf macho coff
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Documentation
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: requires-python
Dynamic: summary

# ddpl — Deep Documentator for Python Libraries

Inspect Python modules and PyPI sdists — including **C/C++/Rust/Fortran/Cython/CUDA sources, build files, and binaries** — without installing the package.

Pure standard library. Zero dependencies. One file.

## Why

`pydoc` and `pdoc` answer *"what does this API do"*. `ddpl` answers *"how is this package actually built"*:

- What languages are inside the sdist?
- Where is the C entry point?
- How does `setup.py` / `meson.build` / `Cargo.toml` put it together?
- What's in that `.o`, `.so`, `.a`, `.pkl`, `.pyc`, nested `.zip`?

`ddpl` works **before installation** — it downloads the sdist from PyPI and reads it in memory. No `pip install`, no compilation, no network beyond the download.

## Install

    pip install -e .

This puts `ddpl` on `PATH`.

Or without installing:

    python ddpl.py <command>

## Usage

    ddpl                          # full help
    ddpl --version                # ddpl 1.3
    ddpl help                     # same as above

### Commands

    ddpl doc <module>             # inspect an importable Python module
        --install                 # pip install if not importable
        --search NAME             # only list members whose name contains NAME
        --no-color, --ascii

    ddpl search <prefix>          # prefix search on the PyPI simple index

    ddpl info <package>           # PyPI metadata + sdist URL

    ddpl list <package>           # download sdist, group files by language
        --ext .c,.cpp             # only show matching extensions
        --max-mb N                # download size limit (default 200)
        --no-open                 # do not prompt to open a file
        --no-color, --ascii

    ddpl show <package> [path]    # print one file (omit path to browse)
        --ext .c,.h               # restrict picker extensions
        --max-mb N                # download size limit (default 200)
        --no-color, --ascii

## Examples

### What's inside a package

    $ ddpl list numpy
    ╔════════════════════════════════════╗
    ║ numpy — 8527 files across 59 groups ║
    ╚════════════════════════════════════╝
    ┌──────────────────────┐
    │ C                    │
    ├──────────────────────┤
    │ numpy-2.5.4/numpy/_core/...  │
    │   … +1646 more       │
    └──────────────────────┘
    ┌──────────────────────┐
    │ C++                  │
    │   … +487 more        │
    └──────────────────────┘
    ┌──────────────────────┐
    │ Fortran              │
    │   … +172 more        │
    └──────────────────────┘
    ┌──────────────────────┐
    │ Assembly             │
    │   … +133 more        │
    └──────────────────────┘

### Read a specific C source

    $ ddpl show pillow src/libImaging/Storage.c
    ╔══════════════════════════════════════╗
    ║ pillow :: pillow-13.0.0/src/libImaging/Storage.c ║
    ╚══════════════════════════════════════╝
      1: #include "Imaging.h"
      2:
      3: Imaging
      4: ImagingNew(ImagingModule im, int mode, int xsize, int ysize)
      5: {
      ...
    [50/900] Enter=more, n=line, q=quit:

`n` jumps to a line number, `q` quits, Enter pages forward.

### Search an installed module

    $ ddpl doc json --search dump
    ╔══════════════════════════════════════╗
    ║ SEARCH: dump in json                 ║
    ╚══════════════════════════════════════╝
      dump  (callable)
      dumps  (callable)

### Only native sources

    $ ddpl list pillow --ext .c,.h
    $ ddpl list tokenizers --ext .rs
    $ ddpl list scipy --ext .f,.f90,.pyx

### Browse interactively

    $ ddpl show pillow
    ╔══════════════════════════════════════╗
    ║ Files (1728)                         ║
    ╚══════════════════════════════════════╝
        1. pillow-13.0.0/LICENSE
        2. pillow-13.0.0/README.md
        ...
    Open which file? [1..1728, part of name, Enter=cancel]: _imaging.c
    ... pick by number if multiple matches ...

## Supported archives (stdlib only)

    tar:  .tar .tar.gz .tgz .tar.bz2 .tbz2 .tar.xz .txz .tar.lzma .tlz
    zip:  .zip .whl .egg .jar .war .ear .apk .aab .xpi .nupkg .vsix
          .docx .xlsx .pptx .odt .ods .odp .epub
    single: .gz .bz2 .xz .lzma

Not supported without external tools (stdlib has no decoder):

    .tar.zst .tzst .tar.zstd .tar.lz4 .tlz4 .tar.lz .tar.lzo

## Binary inspection (by content, not by extension)

    ELF       Linux/Android/BSD .o, .so, executables
    Mach-O    macOS .o, .dylib, executables (including fat/universal)
    COFF      Windows .obj, Unix COFF
    PE/COFF   Windows .exe, .dll
    WASM      .wasm, .o built for wasm32
    LLVM BC   LLVM bitcode (sometimes named .o)
    Java      .class (magic cafebabe)
    ar        .a, .lib
    zip       nested .zip / .whl / .jar / etc.
    pickle    .pkl / .pickle opcode summary (no unpickling)
    marshal   safe repr preview
    pyc/pyo   header parse

Detection runs on file **content**, so a COFF `.obj` named `.o` is still detected as COFF, and an ELF named `.obj` is still detected as ELF.

## File-type coverage

`ddpl list` groups files by language/purpose, not just by "programming language". For `numpy` that's 59 groups — because the sdist includes vendored Meson with tests in C#, D, Java, Rust, Swift, ObjC++, Coq, CUDA, QML, Protobuf, TypeScript, XML, PolicyKit, and more.

Categories include:

- **Native**: C, C++, Objective-C/C++, Rust, Go, Zig, D, Nim, Crystal, V, Swift, Kotlin, Scala, Java, C#, F#, VB.NET, Dart, Cython, Fortran, Pascal, Ada, Assembly, CUDA, OpenCL, shaders, WASM, Idris, Lean, Coq, Agda, Elm
- **Scripts**: JS/TS, Lua, Ruby, Perl, PHP, Python, R, Julia, MATLAB/Octave, Lisp/Clojure/Scheme, Haskell, OCaml, Erlang, Elixir, Prolog, Smalltalk, Tcl, Bash/Zsh/Fish, PowerShell, Batch, Awk, Sed, Groovy, GDScript, Solidity, Vyper, Move, Raku, Forth
- **Data**: SQL, HTML, CSS/SCSS/SASS/LESS, XML/XSD/XSL, JSON/JSON5/JSONC, YAML, TOML, INI/CFG, CSV/TSV, Protobuf, Thrift, Avro, GraphQL, FlatBuffers, CapnProto, HCL/Terraform, Nix, Jsonnet, Dhall, CUE, `.env`
- **Build**: Makefile, CMake, Meson, Bazel, Gradle, Maven, Cargo, Dockerfile, Nuspec, Autoconf
- **Docs**: Markdown, RST, TeX, AsciiDoc, Org, Textile, Wiki, man pages, plain text
- **Web**: Vue, Svelte, Astro, Elm, Pug, Handlebars, Jinja, Twig, EJS, ERB, Liquid, Nunjucks, Tera, Razor, Blade, XAML, QML
- **System**: systemd units, `.desktop`, PolicyKit, SELinux, AppArmor, plist, `.reg`
- **Binaries**: images, fonts, audio, video, archives, executables, PDF, Office docs, databases

Plus bare filenames: `Makefile`, `CMakeLists.txt`, `meson.build`, `BUILD`, `WORKSPACE`, `Dockerfile`, `Gemfile`, `Rakefile`, `Cargo.toml`, `pyproject.toml`, `setup.cfg`, `requirements.txt`, `README*`, `LICENSE*`, `CHANGELOG*`, `.gitignore`, `.env`, `docker-compose.yml`, and more.

## Cache

    Windows : %LOCALAPPDATA%\ddpl
    Unix    : ~/.cache/ddpl
    Fallback: system temp dir

Clear with:

    rm -rf ~/.cache/ddpl          # Unix
    rmdir /s %LOCALAPPDATA%\ddpl  # Windows

## Platform notes

- **Windows**: ANSI color enabled via `ctypes`; cache under `%LOCALAPPDATA%`.
- **macOS**: Mach-O / dylib headers detected; `afplay` for playback (if `ddpl` ever gains audio, it won't).
- **Linux**: ELF headers + `ar` members.
- **Android/Termux**: pure-stdlib fallbacks for tar/zip/gz/bz2/xz/lzma; no `zstd`/`lz4`/`lzo` without external tools.
- **Pydroid**: same as Android, but `subprocess` may be restricted in some contexts.

## Limitations

`ddpl` reads sources — it does not compile, execute, or analyze them.

- No call graphs (use Doxygen).
- No symbol analysis (use `ctags`/`cscope`/`tree-sitter`).
- No HTML output (use Sphinx/pdoc).
- No private packages without a public PyPI sdist.
- `.tar.zst`/`.tar.lz4`/`.tar.lzo` require external decoders.

For **publication** documentation, use Sphinx or pdoc. For **understanding what's inside**, use `ddpl`.

## License

MIT
