Skip to main content

📁🌳 wintree

PyPI Downloads

This library was born out of the limitations of the default Windows tree command. wintree is a Python library that displays the directory structure in a tree format for any specified path. It can be easily used from the command line and supports features like emoji-based visual tree rendering and directory exclusion. Additionally, it can output the tree structure as JSON, making it suitable for integration with GUI applications.

🔋 Install

pip install wintree

🚀 Usage

📚️ As a Library

import wintree

print(wintree.tree())
# sample output
📂 root: .
├── 📄 .gitignore
├── 📄 README.md
├── 📄 pyproject.toml
├── 📁 src/
│   ├── 📁 assets/
│   │   ├── 📄 icon.png
│   │   └── 📄 splash_android.png
│   └── 📄 main.py
└── 📁 storage/
    ├── 📁 data/
    └── 📁 temp/

With arguments:

from wintree import tree

print(tree(root_dir="/path/to/project", use_emoji=True, ignore_dirs=[".git", "__pycache__"], filter_exts=[".py",".txt"]))
Argument Type Description
root_dir str Path to the root directory to start displaying the tree. Default is the current directory "."
use_emoji bool Whether to use emojis in the tree view. If True, adds icons to folders and files.
ignore_dirs List[str] List of directory names to exclude from the tree (partial match). Example: [".git", "node_modules"]
filter_ext List[str] File extensions to include. Example: [".py", "txt"]

Get or save as JSON

# Get as a dictionary
data = wintree.tree_to_dict(show_meta=True)

# Save as a JSON file
wintree.tree_to_json(root_dir="path/to/project" ,save_path="path/to/project_tree.json")

You can also list file paths vertically as relative or absolute paths from the root directory, instead of using a tree structure.

import wintree

print(wintree.list_files())

⚙️ Usage from CLI

wintree /path/to/project --exclude .git __pycache__

Options

Option Description
path Path to the root directory
--no-emoji Disable emoji display
--exclude Specify directory names to exclude (partial match, space-separated)
--ext File extensions to include
--no-tree List absolute paths instead of a tree structure
--abs Output absolute file paths
--json-output Path to save the file hierarchy in
--show-meta Include timestamp and file size in JSON output

📌 Features

  • Emoji-based tree view for better visibility
  • Flexible exclusion of target directories
  • Supports Windows/macOS/Linux
  • Pure Python, no external dependencies

🧪 For Developers

This library can also be used as a base for directory visualization tools. Integration with GUI tools or IDE plugins is also possible.

📄 License

MIT License

🌐 Language

Metadata

Release files for wintree 0.1.17

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

Source distribution (sdist)

Source distribution for wintree 0.1.17
File Size Uploaded
wintree-0.1.17.tar.gz 5.8 kB Details

Built distribution (wheel)

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

Total release size: 12.5 kB

Release files / wintree-0.1.17.tar.gz

Download URL wintree-0.1.17.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ab8cc64f29812eaf688ac5fb68bc10405d40ad35913a27c2f8e19d87ea4acd11
BLAKE2b-256 checksum
How to use checksums
77e1ee78dca9040970fac870b3fcb5405b2960a36d1799b5616da5c14a75e564
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.12.0 Windows/11

Release files / wintree-0.1.17-py3-none-any.whl

Download URL wintree-0.1.17-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8913b946169125ff19cbdf03bd6d5abad91e9451d1294d33f47d3152d207eb21
BLAKE2b-256 checksum
How to use checksums
46d05eb2d24fd42e0e852486dccd95ccd58ba0fac183777def7526eb77265fcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.12.0 Windows/11

Release history Release notifications | RSS feed

This release

0.1.17 This release

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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