Skip to main content

Convert tree-formatted text into filesystem structures

Project description

tree2fs

Convert tree-formatted text into filesystem structures.

Installation

pip install tree2fs

Quick Start

Command Line Usage

# Create structure from tree file
tree2fs tree.txt

# Preview without creating (dry run)
tree2fs tree.txt --dry-run -v

# Create in specific directory
tree2fs tree.txt --base-dir /path/to/project

# Include root directory in creation
tree2fs tree.txt --no-skip-root

Python API Usage

from tree2fs import create_from_tree

# Simple usage
stats = create_from_tree("tree.txt", verbose=True)
print(f"Created {stats['total']} items")

# Advanced usage
from tree2fs import TreeParser, FilesystemBuilder
from pathlib import Path

# Parse tree file
parser = TreeParser()
root, _ = parser.build_tree(Path("tree.txt"))

# Build filesystem
builder = FilesystemBuilder(Path("."), verbose=True)
builder.build(root)
builder.print_summary()

Tree File Format

project/
├── README.md
├── LICENSE
├── src/
│   ├── __init__.py
│   ├── main.py          # Main module
│   └── utils.py         # Utility functions
├── tests/
│   ├── __init__.py
│   └── test_main.py
└── docs/
    └── index.md
  • Directories end with /
  • Comments start with #
  • Supports standard tree drawing characters: , , ,

Features

  • ✅ Parse tree-formatted text files
  • ✅ Create directories and files
  • ✅ Dry-run mode for preview
  • ✅ Verbose output with comments
  • ✅ Skip root directory option
  • ✅ Python 3.9+ support
  • ✅ Type hints throughout

Development

# Clone repository
git clone https://github.com/ABDELLAH-Hallou/tree2fs.git
cd tree2fs

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black tree2fs tests

# Type checking
mypy tree2fs

License

MIT License - see LICENSE file for details.

Contributing

Contributions welcome! Please feel free to submit a Pull Request.

17. LICENSE

MIT License

Copyright (c) 2025-present Abdellah HALLOU

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

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

tree2fs-0.1.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

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

tree2fs-0.1.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file tree2fs-0.1.0.tar.gz.

File metadata

  • Download URL: tree2fs-0.1.0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for tree2fs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f2edaaeded4eac8948f6171134a4d72377e1176bc5f2db7e314d6c95b397f27b
MD5 8a531f9ae0575248f8e1c62506ef76ad
BLAKE2b-256 07870706bee9e283862fc3662a4bf1994da747e91802712e6262f17eda2dfb02

See more details on using hashes here.

File details

Details for the file tree2fs-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tree2fs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for tree2fs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e40750767848fac051125d6ae410fc0fc01131a6075b9186f412aae33fb4cd3f
MD5 ec74a2d7e69beb061d1eab35e51e6ca5
BLAKE2b-256 4ee009230954ee15f09928f1fc7dfac076d20fc0887bccf1c43efa1e68126510

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