Skip to main content

A tool to generate project directory structures from specifications.

Project description

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.

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

dircraft-0.1.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

dircraft-0.1.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dircraft-0.1.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for dircraft-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9057b8d061757d27e7f48db85c7dc1bb5927d2bc4eb96da1ce61961412cae336
MD5 810996605065858e37d43e4ec1bc9faf
BLAKE2b-256 2fff71e8ec862102a5763ec63e13e5f120dab9d2dba32d5110f3f7c76fe380b2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dircraft-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for dircraft-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cfbb1ec612ed316d29e334a8e4469b0cf64621ca5d9f3fa68c7a29ef270e34b0
MD5 b919b93c0342e7aa9202a97f2089e0d0
BLAKE2b-256 6dea9d2f0c436c5349325b84701d852bbed8f38da67871ec16ad49772c2a4329

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