Skip to main content

A CLI tool to generate ASCII tree representation of a project structure.

Project description

Indastructa

PyPI version Python Versions License: MIT Tests codecov Code style: ruff

Indastructa is a convenient CLI tool for quickly creating a clear ASCII tree of your project's file structure.

Perfect for documentation, technical reviews, architecture discussions, or blog posts.


Key Features

  • Clear Output: Generates a beautiful and easy-to-read ASCII tree.
  • Automatic Saving: The result is automatically saved to a project_structure.txt file in the project root.
  • Smart Exclusions: By default, it ignores unnecessary files and folders (such as .git, venv, __pycache__, .idea, and others).
  • Integration with .gitignore: Automatically reads rules from .gitignore and .dockerignore to exclude everything unrelated to source code.
  • Flexible Configuration: Allows specifying target folder, limiting scan depth, and adding custom exclusions and inclusions via command-line arguments.

Installation

You can install indastructa from PyPI or TestPyPI.

Stable Version (from PyPI)

This is the recommended way to install the latest stable release.

pip install indastructa

Development Version (from TestPyPI)

To install the latest pre-release version from our test repository:

pip install --index-url https://test.pypi.org/simple/ indastructa

How to Use

Basic Usage

To scan the current directory, simply run the command:

indastructa

The result will be printed to the console and saved to project_structure.txt.

Specifying a Path

You can scan any directory by providing a relative or absolute path:

# Scan a subdirectory
indastructa ./src

# Scan a directory using an absolute path
indastructa C:\Users\YourUser\Projects\MyProject

Advanced Usage

You can combine flags to customize the output.

  • Limit scan depth with --depth:

    indastructa --depth 2
    
  • Exclude files and folders with --exclude (use quotes for multiple patterns):

    indastructa --exclude "*.md,docs,build"
    
  • Force include files with --include to show them even if they are in .gitignore:

    indastructa --include .env
    
  • Save to a different file with -o or --output:

    indastructa -o custom_structure.md
    
  • Suppress console output with -q or --quiet:

    indastructa --quiet
    
  • Perform a dry run with --dry-run to see the output without saving the file:

    indastructa --dry-run
    

📚 Examples

Example 1: Python Package

Command:

indastructa --depth 3 --exclude "*.pyc,__pycache__,dist,build"

Output:

my_package/
  |-- src/
  |     |-- __init__.py
  |     |-- main.py
  |     +-- utils.py
  |-- tests/
  |     |-- test_main.py
  |     +-- test_utils.py
  |-- setup.py
  |-- README.md
  +-- requirements.txt

Example 2: Web Application

Command:

indastructa --exclude "node_modules,dist,.next"

Output:

my_app/
  |-- public/
  |-- src/
  |     |-- components/
  |     |-- pages/
  |     +-- styles/
  |-- package.json
  +-- README.md

Example 3: CI/CD Usage in GitHub Actions

Add this to your workflow to automatically add the project structure to the job summary:

- name: Generate and display project structure
  run: |
    pip install indastructa
    indastructa --depth 3 -o structure.txt

    echo "## 📂 Project Structure" >> $GITHUB_STEP_SUMMARY
    echo '```' >> $GITHUB_STEP_SUMMARY
    cat structure.txt >> $GITHUB_STEP_SUMMARY
    echo '```' >> $GITHUB_STEP_SUMMARY

Exclusion Logic

indastructa uses a filtering system with the following priority:

  1. --include rules: Patterns passed via --include have the highest priority. If a file matches, it will always be shown.
  2. Built-in rules: A default set of common exclusions like .git, venv, __pycache__, etc.
  3. Rules from .gitignore and .dockerignore: Automatically loaded from your project.
  4. --exclude rules: Patterns passed via --exclude.

Future Ideas

For more advanced feature ideas, see the FUTURE_FEATURES.md file in this repository.

  • Selectable ignore files
  • Interactive mode
  • Support for exporting to JSON/YAML

Have ideas or found a bug? Create an Issue on GitHub.


License

The project is distributed under the MIT License.

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

indastructa-0.1.1.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

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

indastructa-0.1.1-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: indastructa-0.1.1.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for indastructa-0.1.1.tar.gz
Algorithm Hash digest
SHA256 782698997706f865f52325c0293e04ca5991dea688def6fc5b6e7497557afab1
MD5 b391de409c885e7c26be8334d8d1360b
BLAKE2b-256 22a10531a03f18d0d315e3bfe6bd36e0b62587d6317b54ac86a2561da186e50c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: indastructa-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for indastructa-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 126f7ee095f070f216b26e2cf1e0d2a295435730e0f62a812000496c0003c2b0
MD5 6082a1e9575fd8b80542d918a76d7a12
BLAKE2b-256 4d8eab1d6f14936e475853207102f2d28e618c3742a1649afeec782058e3c876

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