Skip to main content

Transform code repositories into markdown-formatted strings ready for LLM prompting

Project description

   ___             _                    ___ 
  / __\  ___    __| |  ___    /\/\     /   \
 / /    / _ \  / _` | / _ \  /    \   / /\ /
/ /___ | (_) || (_| ||  __/ / /\/\ \ / /_// 
\____/  \___/  \__,_| \___| \/    \//___,' 

codemd

Transform code repositories into markdown-formatted strings ready for LLM prompting. Easily convert your entire codebase into a format that's optimal for code-related prompts with LLMs like GPT-4, Claude, etc.

Tests License

Features

  • Recursively scans directories for code files
  • Configurable file extensions
  • File and pattern exclusion support
  • Markdown-formatted output
  • Preserves directory structure in headers
  • Simple command-line interface
  • Token count estimation (tiktoken package required)
  • Direct copy to clipboard

Installation

git clone https://github.com/dotpyu/codemd.git
cd codemd
pip install -e .

Usage

Basic usage:

codemd /path/to/your/code

With custom extensions and output file:

codemd /path/to/your/code -e py,java,sql -o output.md

Exclude specific patterns or files:

codemd /path/to/your/code \
    --exclude-patterns "test_,debug_" \
    --exclude-extensions "test.py,spec.js"

As a Python package:

from codemd import CodeScanner

scanner = CodeScanner(
    extensions={'py', 'java'},
    exclude_patterns={'test_'},
    exclude_extensions={'test.py'}
)
markdown_string = scanner.scan_directory('./my_project')

License

Distributed under the Apache 2 License. See LICENSE for more information.

Project details


Download files

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

Source Distribution

codemd-0.0.1.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

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

codemd-0.0.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file codemd-0.0.1.tar.gz.

File metadata

  • Download URL: codemd-0.0.1.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for codemd-0.0.1.tar.gz
Algorithm Hash digest
SHA256 895057b1ebb7c72ae02b27f74225008617bf7a4bd4e9561174e2ef486c1ed03d
MD5 8d63fb89c88f76d851dcda7687e157db
BLAKE2b-256 488946a9afcdb0de4e1f091b3c4f3831883d9a35672773108114f6ff526dd64c

See more details on using hashes here.

Provenance

The following attestation bundles were made for codemd-0.0.1.tar.gz:

Publisher: publish.yml on dotpyu/codemd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codemd-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: codemd-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for codemd-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dbc06fabe8b4c0359560467d48f85550df4291c613180487a64b2a83b8b24580
MD5 84ae7dcec533b4a504576d745b9eaeac
BLAKE2b-256 bb7edf88db762a1ae180cf431e5e8a2125a124df6903c822fb7b30b8358652ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for codemd-0.0.1-py3-none-any.whl:

Publisher: publish.yml on dotpyu/codemd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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