Skip to main content

RepoSnap

Overview

reposnap is a Python tool designed to generate a Markdown file that documents the structure and contents of a Git project. It provides both a command-line interface (CLI) and a graphical user interface (GUI) for ease of use. This tool is particularly useful for creating a quick overview of a project's file hierarchy, including optional syntax-highlighted code snippets.

Features

  • Command-Line Interface (CLI): Quickly generate documentation from the terminal.
  • Graphical User Interface (GUI): A user-friendly GUI if you want to select files and directories interactively.
  • 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.
  • Gitignore Support: Automatically respects .gitignore patterns to exclude files and directories.
  • Include and Exclude Patterns: Use --include and --exclude to specify patterns for files and directories to include or exclude.

Installation

You can install reposnap using pip:

pip install reposnap

Alternatively, you can clone the repository and install the required dependencies:

git clone https://github.com/username/reposnap.git
cd reposnap
pip install -r requirements.lock

Usage

Command-Line Interface

To use reposnap from the command line, run it with the following options:

reposnap [-h] [-o OUTPUT] [--structure-only] [--debug] [-i INCLUDE [INCLUDE ...]] [-e EXCLUDE [EXCLUDE ...]] paths [paths ...]
  • paths: One or more paths (files or directories) within the repository whose content and structure should be rendered.
  • -h, --help: Show help message and exit.
  • -o, --output: The name of the output Markdown file. Defaults to output.md.
  • --structure-only: Generate a Markdown file that includes only the project structure, without file contents.
  • --debug: Enable debug-level logging.
  • -i, --include: File/folder patterns to include. For example, -i "*.py" includes only Python files.
  • -e, --exclude: File/folder patterns to exclude. For example, -e "*.md" excludes all Markdown files.

Pattern Matching

  • Pattern Interpretation: Patterns follow gitignore-style syntax but with a twist.

    • Patterns without Wildcards: If a pattern does not contain any wildcard characters (*, ?, or [), it is treated as *pattern*. This means it will match any file or directory containing pattern in its name.
    • Patterns with Wildcards: If a pattern contains wildcard characters, it retains its original behavior.
  • Examples:

    • -e "gui": Excludes any files or directories containing "gui" in their names.
    • -i "*.py": Includes only files ending with .py.
    • -e "*.test.*": Excludes files with .test. in their names.

Examples

  1. Generate a full project structure with file contents:

    reposnap .
    
  2. Generate a project structure only:

    reposnap my_project/ --structure-only
    
  3. Generate a Markdown file including only Python files:

    reposnap my_project/ -i "*.py"
    
  4. Generate a Markdown file excluding certain files and directories:

    reposnap my_project_folder my_project_folder_2 -e "tests" -e "*.md"
    
  5. Exclude files and directories containing a substring:

    reposnap my_project/ -e "gui"
    

Graphical User Interface

reposnap also provides a GUI for users who prefer an interactive interface.

To launch the GUI, simply run:

reposnap-gui

Using the GUI

  1. Select Root Directory: When the GUI opens, you can specify the root directory of your Git project. By default, it uses the current directory.

  2. Scan the Project: Click the "Scan" button to analyze the project. The GUI will display the file tree of your project.

  3. Select Files and Directories: Use the checkboxes to select which files and directories you want to include in the Markdown documentation. Toggling a directory checkbox will toggle all its child files and directories.

  4. Generate Markdown: After selecting the desired files, click the "Render" button. The Markdown file will be generated and saved as output.md in the current directory.

  5. Exit: Click the "Exit" button to close the GUI.

Testing

To run the tests, use the following command:

pytest tests/

Ensure that you have the pytest library installed:

pip install pytest

License

This project is licensed under the MIT License.

Acknowledgments

  • GitPython - Used for interacting with Git repositories.
  • pathspec - Used for pattern matching file paths.
  • Urwid - Used for creating the GUI interface.

Metadata

Release files for reposnap 0.6.5

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.6.5
File Size Uploaded Provenance
reposnap-0.6.5.tar.gz 21.4 kB With provenance Details

Built distribution (wheel)

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

Total release size: 35.5 kB

Release files / reposnap-0.6.5.tar.gz

Download URL reposnap-0.6.5.tar.gz
Size 21.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c36df3fbc1cba314f81bc8fd3db0687ed540c3425833aaf0962875efa97aee0c
BLAKE2b-256 checksum
How to use checksums
6cffe11186722ab4ca38380a262a74927e7c0bbfd6036c8106a215e0bd7d220d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 21, 2025.

Transparency log

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

Download URL reposnap-0.6.5-py3-none-any.whl
Size 14.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97f0bd8c28c5e708afa2f87d50e3b85e99cfc332ec7451f5b6104b1428af54c8
BLAKE2b-256 checksum
How to use checksums
b8f1c5a9a2c439e200e8a28ef2ea844da5ba43f54ce0834720c4af1b2a63a5b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 21, 2025.

Transparency log

Security for reposnap 0.6.5

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for reposnap-0.6.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 21, 2025.

Transparency log

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