py-auto-structure


Namepy-auto-structure JSON
Version 0.1.5 PyPI version JSON
download
home_pagehttps://github.com/thauks/py-auto-structure
SummaryA tool to create a directory structure based on a YAML file
upload_time2024-01-19 18:08:19
maintainer
docs_urlNone
authorThauks
requires_python>=3.6
licenseMIT
keywords directory structure yaml tool
VCS
bugtrack_url
requirements pyyaml setuptools wheel twine
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Py Auto Structure

**Py Auto Structure** is a versatile tool designed to simplify the process of creating directory structures for your Python projects. It leverages YAML files to define project hierarchies and offers a convenient command-line interface for effortless structure creation.

## Features

- **Project Structure Definition:** Define and customize your project structure in a YAML file.
- **Command-Line Interface (CLI):** Create project directories with ease using simple commands.
- **Customization:** Tailor the project name and root folder during structure creation.

## Installation

```bash
pip install py-auto-structure
```

## Usage

### 1. Using it from the command line
Creating a project structure is as easy as running a command in your terminal. Use the following command, replacing **<project_name>** with the desired name:

```bash
py-structure -p <path_to_be_set> -n <project_name>
```

Options:
- -p, --path: Path where the parent directory of the project will be set.
- -n, --name: Specify the name of the project and it will be the root of the project.
- --set-yaml: Path to the YAML file containing the project structure definition. Default is an internal project_structure.yaml.
- --yaml: Returns the raw content of the default yaml in order to copy it.

By default, the script looks for the project structure definition in a file named project_structure.yaml in the current directory.

### 2. Using it as a module

You can also import it as a module and call the function project_build this way:

```python
from project_builder.project_builder import project_build

project_build(path=your_path, yaml_path=your_custom_yaml_path)

```

## Default YAML

Here is as simplified version (in order to improve readability) of the default .yaml used:

```yaml
project_structure:
  - name: data
    type: directory
    content:
      - name: raw
  - name: notebooks
    type: directory
  - name: src
    type: directory
    content:
      - name: __init__.py
        type: file
      - name: feature1
        type: directory
  - name: tests
    type: directory
  - name: docs
    type: directory
  - name: outputs
    type: directory
  - name: requirements.txt
    type: file
  - name: main.py
    type: file
    content: 
      >
        def main():
            print("Hello World!")

        if __name__ == "__main__":
            main()
```

You can customize the default passing your own .yaml path to the function but this would create the following structure:

```lua
MyProject/
|-- data/
|   `-- raw/
|-- notebooks/
|-- src/
|   |-- __init__.py
|   `-- feature1/
|-- tests/
|-- docs/
|-- outputs/
|-- requirements.txt
|-- main.py
```

Make sure to follow this structure for the custom yaml:

```yaml
name: <dirname | filename>
type: <file | directory>
content: <list for directories | string for files>
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/thauks/py-auto-structure",
    "name": "py-auto-structure",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "directory,structure,YAML,tool",
    "author": "Thauks",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/d4/6e/9e04b174ed1abfd1c70bb131beb509c3ea850d0b837651d8110d4ff52f48/py-auto-structure-0.1.5.tar.gz",
    "platform": null,
    "description": "# Py Auto Structure\n\n**Py Auto Structure** is a versatile tool designed to simplify the process of creating directory structures for your Python projects. It leverages YAML files to define project hierarchies and offers a convenient command-line interface for effortless structure creation.\n\n## Features\n\n- **Project Structure Definition:** Define and customize your project structure in a YAML file.\n- **Command-Line Interface (CLI):** Create project directories with ease using simple commands.\n- **Customization:** Tailor the project name and root folder during structure creation.\n\n## Installation\n\n```bash\npip install py-auto-structure\n```\n\n## Usage\n\n### 1. Using it from the command line\nCreating a project structure is as easy as running a command in your terminal. Use the following command, replacing **<project_name>** with the desired name:\n\n```bash\npy-structure -p <path_to_be_set> -n <project_name>\n```\n\nOptions:\n- -p, --path: Path where the parent directory of the project will be set.\n- -n, --name: Specify the name of the project and it will be the root of the project.\n- --set-yaml: Path to the YAML file containing the project structure definition. Default is an internal project_structure.yaml.\n- --yaml: Returns the raw content of the default yaml in order to copy it.\n\nBy default, the script looks for the project structure definition in a file named project_structure.yaml in the current directory.\n\n### 2. Using it as a module\n\nYou can also import it as a module and call the function project_build this way:\n\n```python\nfrom project_builder.project_builder import project_build\n\nproject_build(path=your_path, yaml_path=your_custom_yaml_path)\n\n```\n\n## Default YAML\n\nHere is as simplified version (in order to improve readability) of the default .yaml used:\n\n```yaml\nproject_structure:\n  - name: data\n    type: directory\n    content:\n      - name: raw\n  - name: notebooks\n    type: directory\n  - name: src\n    type: directory\n    content:\n      - name: __init__.py\n        type: file\n      - name: feature1\n        type: directory\n  - name: tests\n    type: directory\n  - name: docs\n    type: directory\n  - name: outputs\n    type: directory\n  - name: requirements.txt\n    type: file\n  - name: main.py\n    type: file\n    content: \n      >\n        def main():\n            print(\"Hello World!\")\n\n        if __name__ == \"__main__\":\n            main()\n```\n\nYou can customize the default passing your own .yaml path to the function but this would create the following structure:\n\n```lua\nMyProject/\n|-- data/\n|   `-- raw/\n|-- notebooks/\n|-- src/\n|   |-- __init__.py\n|   `-- feature1/\n|-- tests/\n|-- docs/\n|-- outputs/\n|-- requirements.txt\n|-- main.py\n```\n\nMake sure to follow this structure for the custom yaml:\n\n```yaml\nname: <dirname | filename>\ntype: <file | directory>\ncontent: <list for directories | string for files>\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A tool to create a directory structure based on a YAML file",
    "version": "0.1.5",
    "project_urls": {
        "Homepage": "https://github.com/thauks/py-auto-structure"
    },
    "split_keywords": [
        "directory",
        "structure",
        "yaml",
        "tool"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "36f85f882c23fe5742732c57ce158b1dfe0b077902b1d76d22a11c956624e662",
                "md5": "576eb9c1be6e44425332941b737a8cf0",
                "sha256": "c8be7a015e3c37971b1d4a4fc63d35e6b2fb0e396a0e7823aa40d265a5d74417"
            },
            "downloads": -1,
            "filename": "py_auto_structure-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "576eb9c1be6e44425332941b737a8cf0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4703,
            "upload_time": "2024-01-19T18:08:18",
            "upload_time_iso_8601": "2024-01-19T18:08:18.177185Z",
            "url": "https://files.pythonhosted.org/packages/36/f8/5f882c23fe5742732c57ce158b1dfe0b077902b1d76d22a11c956624e662/py_auto_structure-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d46e9e04b174ed1abfd1c70bb131beb509c3ea850d0b837651d8110d4ff52f48",
                "md5": "ac4dba43bfd5cb48935149355b93ccb7",
                "sha256": "67ff6822fc53224e292b8be89bf42739deda4f3753911a262624a6171591881b"
            },
            "downloads": -1,
            "filename": "py-auto-structure-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "ac4dba43bfd5cb48935149355b93ccb7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 3830,
            "upload_time": "2024-01-19T18:08:19",
            "upload_time_iso_8601": "2024-01-19T18:08:19.613914Z",
            "url": "https://files.pythonhosted.org/packages/d4/6e/9e04b174ed1abfd1c70bb131beb509c3ea850d0b837651d8110d4ff52f48/py-auto-structure-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-19 18:08:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "thauks",
    "github_project": "py-auto-structure",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "pyyaml",
            "specs": []
        },
        {
            "name": "setuptools",
            "specs": []
        },
        {
            "name": "wheel",
            "specs": []
        },
        {
            "name": "twine",
            "specs": []
        }
    ],
    "lcname": "py-auto-structure"
}
        
Elapsed time: 0.16956s