Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.8.0 instead.

RepoSnap

Overview

reposnap is a Python script designed to generate a Markdown file that documents the structure and contents of a git project. This tool is particularly useful for creating a quick overview of a project's file hierarchy, including optional syntax-highlighted code snippets.

Features

  • Recursive Directory Traversal: Automatically traverses through all subdirectories of the specified project root.
  • File Exclusion: Supports excluding specific files and directories using patterns similar to .gitignore.
  • Syntax Highlighting: Includes syntax highlighting for known file types in the generated Markdown file.
  • Structure Only Option: The --structure-only flag can be used to generate the Markdown file with just the directory structure, omitting the contents of the files.

Usage

Command-Line Interface

To use the collect.py script, run it with the following options:

python -m collect <project_root> [-o OUTPUT] [-e EXCLUDE ...] [-x EXCLUDE_FILE] [--structure-only]
  • <project_root>: The root directory of the project to document.
  • -o, --output: The name of the output Markdown file. Defaults to repo-content-<timestamp>.md.
  • -e, --exclude: Patterns of files or directories to exclude (supports multiple patterns).
  • -x, --exclude-file: A file (e.g., .gitignore) containing patterns of files or directories to exclude.
  • --structure-only: Generate a Markdown file that includes only the project structure, without file contents.

Examples

  1. Generate a full project structure with file contents:

    python -m collect my_project/
    
  2. Generate a project structure only:

    python -m collect my_project/ --structure-only
    
  3. Generate a Markdown file excluding certain files and directories:

    python -m collect my_project/ -e '*.log' -e 'build/' -o output.md
    
  4. Use exclusion patterns from a .gitignore file:

    python -m collect my_project/ -x .gitignore
    

Testing

This project includes unit tests to ensure the correctness of the code:

  • test_collect.py: Tests the file_extension_to_language function, verifying that file extensions are correctly mapped to programming languages for syntax highlighting in the Markdown file.
  • test_cli.py: Tests the command-line interface of the collect.py script, including the --structure-only flag.

Running the Tests

To run the tests, use rye:

rye test

This will execute all test cases and provide a summary of the results.

Dependencies

This project uses standard Python libraries and does not require any external dependencies.

License

This project is licensed under the MIT License.

Metadata

Release files for reposnap 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reposnap 0.2.0
File Size Uploaded Provenance
reposnap-0.2.0.tar.gz 5.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for reposnap 0.2.0
File Interpreter ABI Platform
reposnap-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.2 kB

Release files / reposnap-0.2.0.tar.gz

Download URL reposnap-0.2.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b27684c442c36aa292b234930c6a5243a0ae146788dd18a39894bb8ae4e8eefd
BLAKE2b-256 checksum
How to use checksums
ef8c2e360338d62c8ce2fa8ab8c3932483b55991fb8673589848f2c3ddeb25a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / reposnap-0.2.0-py3-none-any.whl

Download URL reposnap-0.2.0-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f90934a2ffc3c8b305f1666b57da48a6bbdd611a68e9099404ae33394ce58321
BLAKE2b-256 checksum
How to use checksums
49d6a01739f0b01cb722767d2b274cc1e43c62bf8d5d46a337f9728f0bd9c0ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Security for reposnap 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page