dircraft
dircraft is a versatile Python package that automatically generates a project folder structure with files based on an input specification. It supports input in various formats – a YAML file, a plain text tree structure, or even direct terminal input – to create the corresponding directories and files.
Features
- Multi-format Input:
- YAML Files: Define your folder structure with nested dictionaries.
- Tree/Text Files: Provide a tree-like text representation of the desired structure.
- Direct Terminal Input: Paste a file structure directly via command-line parameters.
- Customizable File Contents:
Include file content in the input definition. If no content is provided, empty files are created. - Recursive Directory Creation:
Automatically creates nested directories and files. - Command Line Interface (CLI):
Easy-to-use CLI using Click. - Extendable and Modular:
Designed to be extended with additional input formats or templating engines.
Installation
Clone the repository and install it using pip:
git clone https://github.com/yourusername/dircraft.git
cd dircraft
pip install -e .
Alternatively, you can install it directly from PyPI (if published):
pip install dircraft
Usage
dircraftoldGen provides a CLI tool called dircraft that you can use to generate your project structure.
Using a YAML File
Create a YAML file (e.g., structure.yaml) that defines your file structure. For example:
modal_decomposition:
data:
train: {}
val: {}
test: {}
models:
vgg16_modified.py: "# TODO: VGG16 model implementation"
pnorm_layer.py: "# TODO: Custom normalization layer"
scripts:
train.py: "# TODO: Training script"
evaluate.py: "# TODO: Evaluation script"
infer.py: "# TODO: Inference script"
utils:
data_loader.py: "# TODO: Data loader implementation"
visualize.py: "# TODO: Visualization functions"
losses.py: "# TODO: Custom loss functions"
config:
config.yaml: |
learning_rate: 1e-4
batch_size: 64
main.py: "# Main entry point"
README.md: "# Project documentation"
requirements.txt: "torch\nnumpy\n..."
Then run:
dircraft structure.yaml /path/to/target/directory
Using a Tree/Text File
If you have a tree-like structure defined in a text file (e.g., structure.txt), the file might look like:
modal_decomposition/
├── data/
│ ├── train/
│ ├── val/
│ └── test/
├── models/
│ ├── vgg16_modified.py # TODO: VGG16 model implementation
│ └── pnorm_layer.py # TODO: Custom normalization layer
├── scripts/
│ ├── train.py # TODO: Training script
│ ├── evaluate.py # TODO: Evaluation script
│ └── infer.py # TODO: Inference script
├── utils/
│ ├── data_loader.py # TODO: Data loader implementation
│ ├── visualize.py # TODO: Visualization functions
│ └── losses.py # TODO: Custom loss functions
├── config/
│ └── config.yaml # learning_rate: 1e-4, batch_size: 64
├── main.py # Main entry point
├── README.md # Project documentation
└── requirements.txt # torch, numpy, ...
dircraft can be extended to parse such tree-like formats. (For now, the basic version uses YAML but check out our roadmap for future support.)
Direct Terminal Input
You can also pass a file structure definition directly as a command-line argument. For example:
dircraft --structure "modal_decomposition/main.py:# Main entry point; modal_decomposition/README.md:# Documentation" /path/to/target/directory
In this mode, separate multiple file definitions with a semicolon (;) and use a colon (:) to separate the file path from its content.
Note: The direct terminal input is ideal for small structures and quick tests.
Roadmap
- Enhanced Input Parsers:
Support for more input formats (e.g., JSON, indented text trees). - Templating Support:
Integration with Jinja2 for templated file contents. - GUI Frontend:
A simple web interface to define and preview the project structure before generation.
License
This project is licensed under the MIT License – see the LICENSE file for details.
Contact
For questions or suggestions, please open an issue.
Metadata
Release files for dircraft 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dircraft-0.1.0.tar.gz | 9.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dircraft-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.8 kB
Release files / dircraft-0.1.0.tar.gz
| Download URL | dircraft-0.1.0.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9057b8d061757d27e7f48db85c7dc1bb5927d2bc4eb96da1ce61961412cae336
|
|
BLAKE2b-256 checksum How to use checksums |
2fff71e8ec862102a5763ec63e13e5f120dab9d2dba32d5110f3f7c76fe380b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|
Release files / dircraft-0.1.0-py3-none-any.whl
| Download URL | dircraft-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cfbb1ec612ed316d29e334a8e4469b0cf64621ca5d9f3fa68c7a29ef270e34b0
|
|
BLAKE2b-256 checksum How to use checksums |
6dea9d2f0c436c5349325b84701d852bbed8f38da67871ec16ad49772c2a4329
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|