A clean directory tree generator with customizable exclusions and comments
Project description
DirMapTree 🌳
A Python package for generating clean, customizable directory tree visualizations with:
- Built-in exclusion of common directories (
node_modules,.git, etc.) - Optional comments for important paths
- Hidden file visibility control
- Depth limiting
- Permission error handling
Installation
pip install dirmaptree
Basic Usage
bash
dirmaptree [path] [-d DEPTH] [-H] [-c]
Examples
- Basic directory tree
dirmaptree ./my-projectOutput:
├── src/
│ ├── app/
│ ├── components/
│ └── utils/
├── public/
│ └── assets/
├── pyproject.toml
└── README.md
- With depth limit (2 levels)
dirmaptree ./my-project -d 2
3. Show hidden files
dirmaptree ./my-project -H
4. With comments
dirmaptree ./my-project -c
Output:
my-project/
├── src/app/ # App Router (Next.js 13+)
├── src/components/ # Reusable UI components
├── public/assets/images/ # Product images
└── README.md
Advanced Features
Custom Exclusions
Create a custom configuration file .dirmaptree in your project root:
exclude_dirs:
- venv
- dist
exclude_files:
- *.log
- *.tmp
comments:
src/app: "App Router (Next.js 13+)"
tests: "Test cases"
Programmatic Usage
from dirmaptree import DirectoryTree
tree = DirectoryTree(
exclude_dirs=['__pycache__', 'temp'],
show_hidden=False
)
print(tree.generate('./my-project', max_depth=3))
Command Line Options
| Option | Description |
|---|---|
| [path] | Root directory (default: current directory) |
| -d DEPTH, --depth | DEPTH Maximum depth to display |
| -H, --hidden | Show hidden files and directories |
| -c, --comments | Show directory comments |
| --version | Show version and exit |
Configuration
DirMapTree automatically looks for these configuration files:
-
.dirmaptree (YAML format) in current directory
-
.dirmaptree in home directory
-
Package defaults
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dirmaptree-0.1.2.tar.gz.
File metadata
- Download URL: dirmaptree-0.1.2.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.11.9 Darwin/23.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b8c91aa642975d7172558129e789a4cabdb5185d9c75bd042a79ebbe16b8a16
|
|
| MD5 |
7e2d035310b141d957850096d79db4b9
|
|
| BLAKE2b-256 |
eb8aabbee6b957a7aa8ab62a45484ce39157a8cc2161aa664efb86ed346ccab6
|
File details
Details for the file dirmaptree-0.1.2-py3-none-any.whl.
File metadata
- Download URL: dirmaptree-0.1.2-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.11.9 Darwin/23.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21ae5f105b718b42e3f7629365bf4e1408f45af34f9a02fff2a704ada998957a
|
|
| MD5 |
d75693d90a0641b20b8d3ddd154ee6a1
|
|
| BLAKE2b-256 |
da4861b31741c860a934bb0969a7a674974e09a01bae19228283c18aa8f50aea
|