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.0.tar.gz (3.9 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.0-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for source_to_text_converter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 543116e8e257263c5f2773ad2093752fe715ee77f6f833645890def19ab64449
MD5 ffb27394fee5ceb8fcc70bd6f12947eb
BLAKE2b-256 6c608be2f69868944c56c5d30de9aac4550d59c460da4769e6fcff0298ce5f57

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for source_to_text_converter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 567b61d98b44710d5f130f9498f5762ccb40ca2eb4f43e2b71e545b3affd0b0d
MD5 169e4f366a6b5afcea8777023c8eac4a
BLAKE2b-256 d0dfcfcc077817b65e9eb9d0b606e79c1c902eb8a158c19e01fcc958c27fe526

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