Skip to main content

A tool to convert source code to text or docx

Project description

source-to-text-converter

A utility tool to convert the content of software codebases (local or GitHub) into a single structured text or .docx file for easy analysis, documentation, or processing.

Features

  • Supports local directories and GitHub repositories as input.
  • Preserves folder structure in the output.
  • Outputs consolidated content as plain text or .docx.
  • Option to exclude hidden files and directories.
  • Verbose mode for detailed processing logs.
  • File type filtering by extension.
  • Robust error handling and cleanup.

Installation

pip install source-to-text-converter

Usage

CLI

source-to-text-converter --input <input_path_or_url> --output <output_file> [options]

Options:

  • --input (required): Local directory path or GitHub repo URL.
  • --output (required): Output file path.
  • --output-type (optional): txt (default) or docx.
  • --exclude-hidden (optional): Exclude hidden files and directories.
  • --include-ext (optional): Comma-separated list of file extensions to include (e.g., .py,.js).
  • --verbose (optional): Show detailed logs.

Python API

from source_to_text_converter.source_to_text_converter import SourceToTextConverter

converter = SourceToTextConverter(
    input_path="/path/to/repo",
    output_path="output.txt",
    output_type="txt",
    exclude_hidden=True,
    include_exts=[".py", ".js"],
    verbose=True
)
converter.get_file()

License

Apache License 2.0

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

source_to_text_converter-0.1.1.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

source_to_text_converter-0.1.1-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file source_to_text_converter-0.1.1.tar.gz.

File metadata

File hashes

Hashes for source_to_text_converter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2827a4fea33ce763e38a16f51c62352e388a6a8f63529dbb82f45304ad87867c
MD5 738990103b74b88f7608820e0474a0c4
BLAKE2b-256 6b522ca52af857ca5c873503cbceed4fbc69e3834688cd375b733b62c978c9ec

See more details on using hashes here.

File details

Details for the file source_to_text_converter-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for source_to_text_converter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 93bc7e7d6fbf5fa3381942da3a69327f7ea4ae1cde4b06613ec37e9ca68bb398
MD5 785bee8a5a48bd1db01d5239c0e1d54d
BLAKE2b-256 098bea3c4ac32529df5d58bf9dd1de720c62966cf247520986c60121f13eae4f

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