Skip to main content

ASCII Tree Reorganizer & Generator (ascii-tree-reorg)

Version Python License

A modular, zero-external-dependency utility to bridge the gap between directory structures and text specifications. It provides bidirectional capability:

  1. Reconstruction: Takes a flat or disorganized collection of files and an ASCII/Unicode directory tree, parses parent-child relationships, audits collisions, and arranges files into their exact paths.
  2. Generation (New in v0.2.0): Scans any local directory and generates clean, customizable ASCII tree text matching the standard tree format with custom depth limits and file-filtering options.

Operates via a terminal CLI, scriptable Python API, or a dual-tab desktop GUI. Designed to run offline in air-gapped environments without third-party dependencies.


Features

  • Bidirectional Workflow: Reorganize flat files into a tree, or reverse-engineer any directory into an ASCII tree diagram.
  • Dual-Tab GUI: Built-in Tkinter desktop interface with real-time logs, progress tracking, file-dialog pickers, and clipboard export.
  • Safe Non-Destructive Default: Uses shutil.copy2 by default to preserve file metadata and timestamps. File moves (shutil.move) are opt-in (--move).
  • Auto-Adaptive Indentation: Infers indentation step size (e.g., 2-space vs. 4-space) using Greatest Common Divisor (GCD) logic, warning and adapting automatically.
  • Pre-Flight Structural Audit: Identifies exact tree path collisions, duplicate basenames across branches, and duplicate source files before disk mutations.
  • Interactive Disambiguation: In terminal mode, conflicts prompt for source candidate selection with size and timestamp metadata. In GUI mode, choices are logged and managed safely.
  • Zero Dependencies: Relies exclusively on the Python standard library (pathlib, shutil, argparse, dataclasses, tkinter).

Directory Structure

ascii_tree_reorg/
├── configs/
│   └── default_config.json
├── data/
│   ├── inputs/
│   │   ├── raw_archive/           # Source files for reconstruction
│   │   └── structure.txt          # Input ASCII tree specification
│   └── outputs/                   # Auto-generated timestamped run folders
├── docs/
│   ├── ARCHITECTURE.md
│   ├── FUNCTIONAL_SPEC.md
│   ├── PRD.md
│   └── RUNBOOK.md
├── src/
│   └── ascii_tree_reorg/
│       ├── core/
│       │   ├── auditor.py
│       │   ├── generator.py       # (v0.2.0) Tree generation engine
│       │   ├── models.py
│       │   ├── parser.py
│       │   └── resolver.py
│       ├── engine/
│       │   └── reorganizer.py
│       ├── ui/
│       │   └── tkinter_app.py     # (v0.2.0) Dual-tab GUI
│       └── utils/
│           └── config_loader.py
├── tests/
│   └── test_reorganize.py
├── pyproject.toml
├── run.py                         # CLI entrypoint
└── run_ui.py                      # Desktop GUI entrypoint

Quick Start

1. Run the Desktop GUI

python run_ui.py
  • Tab 1 ("Reconstruct from Tree"): Select source folder, destination root, paste/load an ASCII tree, and click Reconstruct Directory Structure.
  • Tab 2 ("Generate Tree from Folder"): Choose any existing directory, set max depth and file visibility options, and click Scan and Generate ASCII.

2. Run via Command Line Interface (CLI)

Reconstructing Files

# Safe copy mode (default)
python run.py -t data/inputs/structure.txt -s data/inputs/raw_archive --task-name experiment_1

# Destructive move mode
python run.py -t data/inputs/structure.txt -s data/inputs/raw_archive --task-name migration_job --move

Running the Test Suite

pytest tests/ -v

Building Standalone Windows Executable (.exe)

PyInstaller can bundle the GUI into a standalone folder that runs without Python:

# 1. Clean previous build artifacts
Remove-Item -Recurse -Force .\build, .\dist, .\*.spec -ErrorAction SilentlyContinue

# 2. Compile via PyInstaller
pyinstaller --noconfirm --onedir --windowed --name "AsciiTreeReorg" `
  --add-data "configs;configs" `
  --paths "src" `
  run_ui.py

The executable will be located at: dist/AsciiTreeReorg/AsciiTreeReorg.exe


Metadata

Release files for ascii-tree-reorg 0.2.2

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

Source distribution (sdist)

Source distribution for ascii-tree-reorg 0.2.2
File Size Uploaded Provenance Actions
ascii_tree_reorg-0.2.2.tar.gz 20.5 kB With provenance Details for ascii_tree_reorg-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ascii-tree-reorg 0.2.2
File Interpreter ABI Platform Actions
ascii_tree_reorg-0.2.2-py3-none-any.whl Python 3 none any Details for ascii_tree_reorg-0.2.2-py3-none-any.whl

Total release size: 41.9 kB

Release files / ascii_tree_reorg-0.2.2.tar.gz

Download URL ascii_tree_reorg-0.2.2.tar.gz
Size 20.5 kB
Tags Source
SHA-256 checksum
How to use checksums
16d770310ac427493271e924abd8e8950856c98e3556fbc51852dd99be902226
BLAKE2b-256 checksum
How to use checksums
fc98a88ba38bb6e069fa81e454232f7961e2ab079974b839e6a014d3ef7c3801
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 20, 2026.

Transparency log

Release files / ascii_tree_reorg-0.2.2-py3-none-any.whl

Download URL ascii_tree_reorg-0.2.2-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07438aa01620263258903e7d208d89191293a4aba0710588cca4c1df81c6d628
BLAKE2b-256 checksum
How to use checksums
2ae3b9ec59345b508fc4a2dde11b298e624d2879364e9ea78656e309f9b33240
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 20, 2026.

Transparency log

Security for ascii-tree-reorg 0.2.2

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 ascii_tree_reorg-0.2.2.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 Sep 20, 2026.

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.

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files Full provenance

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