Skip to main content

A tool to create project structures from .tree files.

Project description

Treef Logo

treef

Effortlessly scaffold project structures from simple text trees.

PyPI Version Python Versions License Build Status Test Coverage

Tired of manually creating nested folders and empty files for new projects? Treef is a simple, powerful command-line tool that builds a complete directory structure from a single, human-readable .tree file.

It's perfect for bootstrapping projects, sharing boilerplate structures, and ensuring consistency across your team.


๐ŸŒณ Key Features

  • Intuitive ASCII Tree Syntax: Define complex nested structures in a file that looks just like the output of the tree command.
  • Zero Configuration: Just create a .tree file and run a single command.
  • Interactive Prompt: If multiple .tree files are found, treef provides a clean, interactive prompt to choose which one to use.
  • Safe by Design: After successfully building the project, the definition file is automatically renamed from .tree to .treef to prevent accidental re-runs.
  • Helpful Guidance: If no .tree file is found, treef provides a helpful "getting started" guide.
  • Blazingly Fast: Written in Python, it's lightweight and executes instantly.

๐Ÿš€ Quick Start

1. Installation

Install treef from PyPI using pip:

pip install treef

2. Create a .tree File

In a new, empty project directory, create a file named my_project.tree.

# my_project.tree

# A comment describing the project structure.
# Directories are marked with a leading or trailing slash.

/src
    โ”œโ”€โ”€ /api
    โ”‚   โ”œโ”€โ”€ /middleware
    โ”‚   โ””โ”€โ”€ /routes
    โ”‚       โ”œโ”€โ”€ auth.routes.js
    โ”‚       โ””โ”€โ”€ user.routes.js
    โ”œโ”€โ”€ /services
    โ”‚   โ””โ”€โ”€ database.service.js
    โ”œโ”€โ”€ app.js
    โ””โ”€โ”€ server.js

/tests
    โ”œโ”€โ”€ /unit
    โ””โ”€โ”€ /integration

.env
.gitignore
package.json
README.md

3. Run the Command

Navigate to the directory containing your .tree file and run:

treef

4. See the Result

That's it! Your directory will now be populated with the structure you defined.

Generated Structure:

.
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ”œโ”€โ”€ middleware/
โ”‚   โ”‚   โ””โ”€โ”€ routes/
โ”‚   โ”‚       โ”œโ”€โ”€ auth.routes.js
โ”‚   โ”‚       โ””โ”€โ”€ user.routes.js
โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ””โ”€โ”€ database.service.js
โ”‚   โ”œโ”€โ”€ app.js
โ”‚   โ””โ”€โ”€ server.js
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ unit/
โ”‚   โ””โ”€โ”€ integration/
โ”œโ”€โ”€ .env
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ my_project.treef  <-- Your file was automatically renamed!
โ”œโ”€โ”€ package.json
โ””โ”€โ”€ README.md

โš™๏ธ Command-Line Options

Option Description
--verbose Enable detailed debug logging.
--help Show the help message and exit.

๐Ÿค Contributing

Contributions are welcome! If you have a feature request, bug report, or want to improve the code, please feel free to open an issue or submit a pull request.

To set up a development environment:

  1. Clone the repository: git clone https://github.com/rahebsaeed/treef.git
  2. Create and activate a virtual environment.
  3. Install in editable mode: pip install -e .
  4. Install development dependencies: pip install -r requirements-dev.txt
  5. Run tests: pytest

๐Ÿ“œ License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

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

treef-0.1.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

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

treef-0.1.0-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for treef-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6b73a8497f0468280ef0e72fabd0667dcd023f871f1693361dad3c5d385f642d
MD5 317cd2a3b94546c564e998d2d60ee6b5
BLAKE2b-256 563f16bac5927a6ee3969ca3b9e1cb7391c235f204f162bd9ea63b3da6588eea

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for treef-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4957d46c4a85db0ca93e350cde3bcf29cea803db64a19a25070d907a81fc2cfd
MD5 d927f424bbb2b043706f124d376ea99b
BLAKE2b-256 2db8390710cb9895a6933f89fb40c510d89e00096057c298c862c6e7d047f644

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