Skip to main content

p2ctx

Bundles a project's source (code, structure, Go dependency graph) into a single compact JSON or Markdown file, ready to feed to an LLM.

Compresses function/method bodies down to signatures + docstrings/JSDoc for Go, Python, and JS/TS/JSX/TSX, so tokens aren't spent on implementation details the model doesn't need to see.

Install

pip install p2ctx

Usage

p2ctx .                                  # current dir -> <dirname>_context.json
p2ctx /path/to/proj -o out.json
p2ctx . --format md                      # markdown instead of JSON
p2ctx . --stdout | pbcopy                # print to stdout instead of a file
p2ctx . --copy                           # copy result straight to clipboard
p2ctx . --include "*.py" --exclude "tests/*"
p2ctx . --respect-gitignore
p2ctx . --no-compress-go                 # skip Go compression
p2ctx . --no-compress-py                 # skip Python compression
p2ctx . --no-compress-js                 # skip JS/TS/JSX/TSX compression
p2ctx . --no-compress                    # skip all compression
p2ctx . --max-size 300000
p2ctx . --tiktoken                       # exact token count

Optional dependencies

pip install p2ctx[clipboard]   # for --copy
pip install p2ctx[tokens]      # for --tiktoken

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

p2ctx-0.1.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

p2ctx-0.1.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file p2ctx-0.1.0.tar.gz.

File metadata

  • Download URL: p2ctx-0.1.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.9

File hashes

Hashes for p2ctx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5d468fdb62af69e653bb7c84ae94b132bde67009f24543fb12a5db03688d16ab
MD5 d12a87c26cd21d9407d0d3522111aaa7
BLAKE2b-256 e30cdfa8b269bf02318a8b3b850d35a7695ac33afe56123e83bbce1b69304aa6

See more details on using hashes here.

File details

Details for the file p2ctx-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: p2ctx-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.9

File hashes

Hashes for p2ctx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b3dadeffb44dbfafa418a3b63052ff33252f1c639fca2d3c39ee626bd4b10d8
MD5 955e61ace9dae40faf4f8c876b598d94
BLAKE2b-256 ac50c66b0027c0991bb327aff1a28a569c421d3e44cdd7742f032dd9498a14c9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page