Skip to main content

codefold (Python)

PyPI

Python bindings for codefold, a structural code reader for LLM agents: Read, with zoom levels. Hand it a file and a level, get back only the slice of the file the model needs.

Languages: Python, TypeScript (incl. TSX/JSX), Rust, Go, Markdown.

Install

pip install codefold   # or: uv add codefold

Prebuilt abi3 wheels (Python 3.8+) for Linux, macOS and Windows.

Use

import codefold

r = codefold.read("src/auth.py", level="signatures")
print(r.content)
print(f"~{r.tokens_est} tokens, {len(r.symbols)} symbols, {r.language}")

# Keep `login` at full body, everything else as signatures.
r = codefold.read("src/auth.py", level="signatures", focus=["login"])

# Fold code you already have in memory (a buffer, a diff, stdin).
r = codefold.read_source(source, "typescript", level="public")

Levels

Level What you get
signatures (default) imports, constants, function/class signatures, docstring summaries; bodies elided
public signatures, filtered to the public surface (export, pub, uppercase Go, no _ prefix)
bodies top-level and method bodies in full, nested bodies collapsed
full the file verbatim

API

  • read(path, level="signatures", focus=None) -> FoldResult
  • read_source(source, language, level="signatures", focus=None) -> FoldResult; language is a name or extension ("python"/"py", "ts", "tsx", "rust", "go", "md")
  • FoldResult: content, symbols, hidden_ranges, language, tokens_est
  • Symbol: name, kind (function, method, class, import, section), byte_start, byte_end, line_start, line_end

Errors: FileNotFoundError for unreadable paths, ValueError for an unknown level or language.

MIT licensed. Docs and CLI: https://codefold.maxenceleguery.net.

Metadata

Release files for codefold 0.9.1

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

Source distribution (sdist)

Source distribution for codefold 0.9.1
File Size Uploaded Provenance Actions
codefold-0.9.1.tar.gz 52.6 kB With provenance Details for codefold-0.9.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for codefold 0.9.1
File Actions
codefold-0.9.1-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for codefold-0.9.1-cp38-abi3-win_amd64.whl
codefold-0.9.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details for codefold-0.9.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
codefold-0.9.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details for codefold-0.9.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
codefold-0.9.1-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details for codefold-0.9.1-cp38-abi3-macosx_11_0_arm64.whl
codefold-0.9.1-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details for codefold-0.9.1-cp38-abi3-macosx_10_12_x86_64.whl

Total release size: 13.1 MB

Release files / codefold-0.9.1.tar.gz

Download URL codefold-0.9.1.tar.gz
Size 52.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b9404e9de18d14cdbd2c625a6bc5e7379542bb640a38eb771b3ed509ff7d256a
BLAKE2b-256 checksum
How to use checksums
075de6ea213bc579828b45dbae0a5c6b2d6fbbff9a8ef9e3c87e9ed6a0453735
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 7, 2026.

Transparency log

Release files / codefold-0.9.1-cp38-abi3-win_amd64.whl

Download URL codefold-0.9.1-cp38-abi3-win_amd64.whl
Size 2.4 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
48f5c8a875eec1d27f66890da5ca060cb137de2e1cf6cdc75f5b6da5ca347710
BLAKE2b-256 checksum
How to use checksums
4f32e2e7251cd9346f997da158907c80f0a21503ef98039ebdf78d6349f3a7ed
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 7, 2026.

Transparency log

Release files / codefold-0.9.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL codefold-0.9.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.7 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
8f977f8eeabdc0654f37db84ad43f02ac1c1e02e29b3f1b4fb7b5379ec07edab
BLAKE2b-256 checksum
How to use checksums
61b8379708f0a17038fce7c774e2b000d47e397cb9cfc88cb225f3ba26035fdd
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 7, 2026.

Transparency log

Release files / codefold-0.9.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL codefold-0.9.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.7 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
7138b2c1dd6e9844323843bac360bbecd80c600ed40aa5868a5ed69c913f0267
BLAKE2b-256 checksum
How to use checksums
c3c7768df479a212c0dd243f9f2cc0e0301b8e0599d49de4d48a3d93c3fa2693
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 7, 2026.

Transparency log

Release files / codefold-0.9.1-cp38-abi3-macosx_11_0_arm64.whl

Download URL codefold-0.9.1-cp38-abi3-macosx_11_0_arm64.whl
Size 2.6 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bb8510719e2038e8c62a81d97457d8ca749ecd4d4af0c14d04c3e965b9ee7f30
BLAKE2b-256 checksum
How to use checksums
9adb9f991eaa1fba81c293b64d6b875396af334c8649cd7869a8d4d8f4f05c43
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 7, 2026.

Transparency log

Release files / codefold-0.9.1-cp38-abi3-macosx_10_12_x86_64.whl

Download URL codefold-0.9.1-cp38-abi3-macosx_10_12_x86_64.whl
Size 2.6 MB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
22b87ff7346525e3203543b18740c25974012b6790b7498a881594a4b097b411
BLAKE2b-256 checksum
How to use checksums
64cf465f0ffcbcfdda91c30955713336a039b61253eff3091978ae0de93f5a50
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 7, 2026.

Transparency log

Security for codefold 0.9.1

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 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for codefold-0.9.1.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 7, 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