Generate directory structures from text-based tree representations
Project description
๐ณ Treecraft
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
- Clone the repository:
git clone https://github.com/ashwin271/treecraft.git
cd treecraft
- 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.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - 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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3c9cb3116d26fdd6977c138418427b88c3fdfc20e5a300379c256dea6124707
|
|
| MD5 |
6f27e642b742b690585cfa03837eb24b
|
|
| BLAKE2b-256 |
753d42d754bfde6040da4379357b83a8e0636ae7cf1667f43654aeaaee0f0735
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8ca12403ab261104cfea452662c357cc477d0f2148ed43516da75f234524dbb
|
|
| MD5 |
d105ed4e985a8d2024733323cffa210b
|
|
| BLAKE2b-256 |
8e6ef386fde83e16651b1914913ca1a812117dc37b5d81fe09b5d2a859dcdd24
|