Skip to main content

A Python package to convert codebase to text

Project description

Codebase to Text Converter

For GenAI and LLM usage. This package converts codebase (folder structure with files) into a single text file or a Microsoft Word document (.docx), preserving folder structure and file contents. The tool extracts file contents from various file types, including text files, documents, and more, while retaining their formatting for easy readability.

Converts a codebase (folder structure with files) into a single text file or a Microsoft Word document (.docx), preserving folder structure and file contents.

Features

  • Supports conversion of local codebase or GitHub repositories.
  • Retains folder structure in a tree-like format.
  • Extracts file contents and metadata.
  • Supports multiple file types including text files (.txt) and Microsoft Word documents (.docx).

Installation

You can install the package using pip:

pip install codebase-to-text

Usage

Command-line Interface (CLI)

You can use the package via the command line interface (CLI):

codebase-to-text --input "path_or_github_url" --output "output_path" --output_type "txt"

Pythonic Way

You can also use it programmatically in your Python code:

from codebase_to_text import CodebaseToText

code_to_text = CodebaseToText(input_path="path_or_github_url", output_path="output_path", output_type="txt")
code_to_text.get_file()

Parameters

--input: Input path (local folder or GitHub URL). --output: Output file path. --output_type: Output file type (txt or docx).

Examples

Convert a local codebase to a text file:

codebase-to-text --input "~/projects/my_project" --output "output.txt" --output_type "txt"

Convert a GitHub repository to a Microsoft Word document:

codebase-to-text --input "https://github.com/username/repo_name" --output "output.docx" --output_type "docx"

License This project is licensed under the MIT License - see the LICENSE file for details.

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

codebase_to_text-1.0.7.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

codebase_to_text-1.0.7-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file codebase_to_text-1.0.7.tar.gz.

File metadata

  • Download URL: codebase_to_text-1.0.7.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for codebase_to_text-1.0.7.tar.gz
Algorithm Hash digest
SHA256 7b0c9591528a8418adf6d3f914b5fce390f0ae8adf376782a983f98b8f32d3cd
MD5 fd8e25ac18c2ee09227d6a59e80d4e8d
BLAKE2b-256 475f47110348181d66251035b284ef914b0885fca6521104709a044dd12ecad7

See more details on using hashes here.

File details

Details for the file codebase_to_text-1.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for codebase_to_text-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 439e0e0b6c3f5654c1febb1f41afad5bf7050101d1f3c30eb8f484270e689d0f
MD5 33bcffe56265273952d32c2f92c170ce
BLAKE2b-256 cfa0b6ff0cf705d757d78d9b08b299a161ffbd4c43335218205f3527ed2880b2

See more details on using hashes here.

Supported by

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