šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Book a DemoInstallSign in
Socket

treecraft

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

treecraft

Generate directory structures from text-based tree representations

0.1.1
PyPI
Maintainers
1

🌳 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

  • 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

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts