Skip to main content

Generate directory structures from text-based tree representations

Project description

๐ŸŒณ Treecraft

Tests PyPI version Python versions PyPI status

Treecraft is a Python tool that generates directory structures from text-based tree representations. It provides an intuitive way to create project scaffolding from a visual directory tree structure.

โœจ Features

  • ๐Ÿ“ Generate directory structures from text-based tree representations
  • ๐Ÿ Automatic Python file initialization with docstrings
  • ๐Ÿ” Dry run mode to preview changes
  • โšก Simple and intuitive CLI interface
  • ๐Ÿ›ก๏ธ Safe path handling and validation

๐Ÿ“‹ Requirements

  • Python 3.7 or higher

๐Ÿš€ Installation

You can install Treecraft using pip:

pip install treecraft

For development installation:

git clone https://github.com/ashwin271/treecraft.git
cd treecraft
pip install -e .

๐Ÿ“– Usage

Command Line Interface

Create a text file with your desired directory structure:

src/
โ”œโ”€โ”€ agents/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ agent.py
โ”œโ”€โ”€ utils/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ helpers.py
โ””โ”€โ”€ main.py

Then run Treecraft:

treecraft input.txt -o output_directory

Python API

from treecraft import TreeParser, Generator

# Initialize components
parser = TreeParser()
generator = Generator()

# Parse tree structure
with open('input.txt', 'r') as f:
    tree_content = f.read()
    
structure = parser.parse(tree_content)

# Generate directory structure
generator.generate(structure, 'output_directory')

๐Ÿ”ง Development

Setup Development Environment

  1. Clone the repository:
git clone https://github.com/ashwin271/treecraft.git
cd treecraft
  1. Install development dependencies:
pip install -r requirements.txt

Running Tests

pytest tests/

๐Ÿ“ Examples

Basic Structure

project/
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ src/
    โ””โ”€โ”€ main.py

Complex Structure

project/
โ”œโ”€โ”€ docs/
โ”‚   โ””โ”€โ”€ index.md
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ””โ”€โ”€ main.py
โ”‚   โ””โ”€โ”€ utils/
โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚       โ””โ”€โ”€ helpers.py
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ test_core.py
โ””โ”€โ”€ README.md

๐Ÿค Contributing

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

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ“ž Contact

Ashwin Murali - @Ashwin_271

Project Link: https://github.com/ashwin271/treecraft

๐Ÿ“ Documentation

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

treecraft-0.1.1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

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

treecraft-0.1.1-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: treecraft-0.1.1.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for treecraft-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f3c9cb3116d26fdd6977c138418427b88c3fdfc20e5a300379c256dea6124707
MD5 6f27e642b742b690585cfa03837eb24b
BLAKE2b-256 753d42d754bfde6040da4379357b83a8e0636ae7cf1667f43654aeaaee0f0735

See more details on using hashes here.

File details

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

File metadata

  • Download URL: treecraft-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for treecraft-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d8ca12403ab261104cfea452662c357cc477d0f2148ed43516da75f234524dbb
MD5 d105ed4e985a8d2024733323cffa210b
BLAKE2b-256 8e6ef386fde83e16651b1914913ca1a812117dc37b5d81fe09b5d2a859dcdd24

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