
Security News
Bun 1.2.19 Adds Isolated Installs for Better Monorepo Support
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
Generate file trees from .treefile configurations with integrated file icon support
Treefile is a Python package designed to generate file trees based on a plaintext configuration described in a .treefile
file. It allows you to create complex directory structures with files and directories, optionally including virtual environments.
This project aims to simplify the process of setting up projects or generating boilerplate code by defining the structure in a simple text file.
To install Treefile, use pip:
pip install treefile
Alternatively, you can clone the repository and install it manually in an editable mode (Ensure Python 3.6 or later installed):
git clone https://github.com/BenevolenceMessiah/treefile.git
cd treefile
pip install -e .
Treefile reads a .treefile
configuration file and generates the corresponding directory structure.
.treefile
file with your desired structure:project/
src/
main.py
README.md
treefile --file project.treefile --output output_dir
.treefile
File Showing 'Tree Branches'Lines can also include UTF-8 “tree branch” characters (e.g., ├──, └──), though this is optional. Indentation (preferably using 4 spaces) defines hierarchy:
token-itemize/
├── token_itemize/
│ ├── __init__.py
│ ├── cli.py
│ └── main.py
└── tests/
└── test_main.py
Running this with Treefile will create the full directory structure.
Treefile supports the following command line arguments:
treefile [OPTIONS] --file <PATH>
Available options:
--file <PATH>
: Path to the .treefile
file (required)--output <PATH>
: Output directory (default: current directory)--venv <NAME>
: Name for virtual environment (default: .venv)--py <VERSION>
: Python version for virtual environment--activate
: Activate the virtual environment after creation--dry-run
: Preview changes without creating files/directories--force
: Overwrite existing files/directories if conflicts occur--version
: Show package versionTreefile parses a .treefile
file and creates the corresponding directory structure with files and directories.
Treefile can create virtual environments based on specified Python versions. If you include a venv
section in your configuration, it will automatically handle environment creation.
Treefile supports right-click context menu integration (Unpack Treefile) for .treefile
files on Windows, macOS, and Linux:
register_icon.bat
register_icon.sh
to set up custom file icons and context menu actions.Treefile integrates with Windows Explorer and the POSIX file manager of your choice to display custom icons for .treefile
files:
register_icon.bat
register_icon.sh
to set up custom file icons and the context menu actions.You can embed configuration options directly in your .treefile
file by adding a comment line starting with #!treefile:
:
#!treefile: --venv .venv --py python3.8
token-itemize/
├── token_itemize/
│ ├── __init__.py
│ ├── cli.py
│ └── main.py
└── tests/
└── test_main.py
Treefile uses a config.yaml
file for default settings:
venv: ".venv"
python: "python"
output: "."
This allows you to set defaults for virtual environments, Python versions, and output directories.
Optionally run the following command to register the context menu and file icon if you want to have it integrated with your operating system:
Run the .bat
file as administrator:
scripts/register_icon.bat
Make the script executable and run it:
chmod +x scripts/register_icon.sh && ./scripts/register_icon.sh
Contributions are welcome! Please fork this repository and submit a pull request.
Treefile is distributed under the MIT License. See LICENSE for details.
FAQs
Generate file trees from .treefile configurations with integrated file icon support
We found that treefile demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
Security News
Popular npm packages like eslint-config-prettier were compromised after a phishing attack stole a maintainer’s token, spreading malicious updates.
Security News
/Research
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.