treescaffold


Nametreescaffold JSON
Version 1.3.2 PyPI version JSON
download
home_pagehttps://github.com/sree-sphere/foldertree
SummaryGenerate folder structures from various input formats (tree, YAML, simple indentation)
upload_time2025-07-18 02:52:14
maintainerNone
docs_urlNone
authorSreeprad
requires_python>=3.7
licenseMIT
keywords folder directory structure generator tree scaffold
VCS
bugtrack_url
requirements pytest PyYAML
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # foldertree
A Python tool to generate folder structures from tree-like format.

# Features

- **Multiple Input Formats**: Supports tree-like structures, YAML, and simple indentation  
- **Auto-detection**: Automatically detects input format  
- **Comment Support**: Adds comments to generated files based on file extensions  
- **Python Package Detection**: Automatically creates `__init__.py` files in Python packages  
- **Smart Skipping**: Skips common files like `__pycache__`, `.git`, `node_modules`, etc.  
- **Dry Run Mode**: Preview what will be created without actual file creation  
- **Flexible Output**: Specify custom output directories  

# Installation

Directly from PyPI:

```bash
pip install treescaffold
```

Or from GitHub:

```bash
git clone https://github.com/sree-sphere/foldertree.git
cd foldertree
pip install -e .
```

# Usage

## Command Line

```bash
# From a structure file
treescaffold -f structure.tree
# (alias: `foldertree -f structure.tree`)


# From stdin
echo "api/
  routes.py
core/
  classifier.py" | treescaffold
# (alias: `foldertree`)

# Specify output directory (recommended)
treescaffold -f structure.tree -o project_output
# (alias: `foldertree -f structure.tree -o project_output`)

# Dry run (preview only)
treescaffold -f structure.tree --dry-run
# (alias: `foldertree -f structure.tree --dry-run`)

# Force specific format
treescaffold -f structure.yaml --format yaml
# (alias: `foldertree -f structure.yaml --format yaml`)
```

## Python

```bash
from foldertree import TreeParser, TreeGenerator

# Parse structure
parser = TreeParser()
tree = parser.parse("""
api/
  routes.py    # FastAPI endpoints
core/
  classifier.py  # ML model
""")

# Generate structure
generator = TreeGenerator("./output")
result = generator.generate(tree)
print(f"Created {len(result['created_files'])} files")
```

# Input Formats

- Tree Format (with symbols)
```bash
├── api/
│   ├── __init__.py
│   └── routes.py
├── core/
│   ├── __init__.py
│   └── classifier.py
├── data/
│   ├── chunks_head/
│   └── highlight.json
└── main.py
```

- Simple Indentation
```txt
api/
  routes.py                  # FastAPI endpoints
core/
  classifier.py              # ML model
main.py
```

- YAML Format
```YAML
structure:
  api:
    - routes.py
    - __init__.py
  core:
    - classifier.py
    - __init__.py
  main.py: null
```
___

# Comment Support
The tool automatically adds appropriate comments to files based on their extensions:

- .py files: # Comment
- .js/.ts files: // Comment
- .css files: /* Comment */
- .html/.xml files: <!-- Comment -->
- And many more...

# Smart Features
## Automatic `__init__.py` Creation
When directories contain .py files, `__init__.py` is automatically created to make them proper Python packages.
## Intelligent Skipping
Automatically skips common files and directories:

- `__pycache__`
- .git
- node_modules
- .env
- Build/dist directories
- And more...

# Options

- -f, --file: Input file containing folder structure
- -o, --output: Output directory (default: current directory)
- --format: Force input format (tree, yaml, simple, auto)
- --dry-run: Show what would be created without creating files
- -v, --verbose: Verbose output
- --version: Show version

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/sree-sphere/foldertree",
    "name": "treescaffold",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "folder, directory, structure, generator, tree, scaffold",
    "author": "Sreeprad",
    "author_email": "Sreeprad <sreeprad99@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/b6/f7/8f85752499c47987f89de053c76a2b0ef6bd757c3b0df5f57f9793ccd1ca/treescaffold-1.3.2.tar.gz",
    "platform": null,
    "description": "# foldertree\nA Python tool to generate folder structures from tree-like format.\n\n# Features\n\n- **Multiple Input Formats**: Supports tree-like structures, YAML, and simple indentation  \n- **Auto-detection**: Automatically detects input format  \n- **Comment Support**: Adds comments to generated files based on file extensions  \n- **Python Package Detection**: Automatically creates `__init__.py` files in Python packages  \n- **Smart Skipping**: Skips common files like `__pycache__`, `.git`, `node_modules`, etc.  \n- **Dry Run Mode**: Preview what will be created without actual file creation  \n- **Flexible Output**: Specify custom output directories  \n\n# Installation\n\nDirectly from PyPI:\n\n```bash\npip install treescaffold\n```\n\nOr from GitHub:\n\n```bash\ngit clone https://github.com/sree-sphere/foldertree.git\ncd foldertree\npip install -e .\n```\n\n# Usage\n\n## Command Line\n\n```bash\n# From a structure file\ntreescaffold -f structure.tree\n# (alias: `foldertree -f structure.tree`)\n\n\n# From stdin\necho \"api/\n  routes.py\ncore/\n  classifier.py\" | treescaffold\n# (alias: `foldertree`)\n\n# Specify output directory (recommended)\ntreescaffold -f structure.tree -o project_output\n# (alias: `foldertree -f structure.tree -o project_output`)\n\n# Dry run (preview only)\ntreescaffold -f structure.tree --dry-run\n# (alias: `foldertree -f structure.tree --dry-run`)\n\n# Force specific format\ntreescaffold -f structure.yaml --format yaml\n# (alias: `foldertree -f structure.yaml --format yaml`)\n```\n\n## Python\n\n```bash\nfrom foldertree import TreeParser, TreeGenerator\n\n# Parse structure\nparser = TreeParser()\ntree = parser.parse(\"\"\"\napi/\n  routes.py    # FastAPI endpoints\ncore/\n  classifier.py  # ML model\n\"\"\")\n\n# Generate structure\ngenerator = TreeGenerator(\"./output\")\nresult = generator.generate(tree)\nprint(f\"Created {len(result['created_files'])} files\")\n```\n\n# Input Formats\n\n- Tree Format (with symbols)\n```bash\n\u251c\u2500\u2500 api/\n\u2502   \u251c\u2500\u2500 __init__.py\n\u2502   \u2514\u2500\u2500 routes.py\n\u251c\u2500\u2500 core/\n\u2502   \u251c\u2500\u2500 __init__.py\n\u2502   \u2514\u2500\u2500 classifier.py\n\u251c\u2500\u2500 data/\n\u2502   \u251c\u2500\u2500 chunks_head/\n\u2502   \u2514\u2500\u2500 highlight.json\n\u2514\u2500\u2500 main.py\n```\n\n- Simple Indentation\n```txt\napi/\n  routes.py                  # FastAPI endpoints\ncore/\n  classifier.py              # ML model\nmain.py\n```\n\n- YAML Format\n```YAML\nstructure:\n  api:\n    - routes.py\n    - __init__.py\n  core:\n    - classifier.py\n    - __init__.py\n  main.py: null\n```\n___\n\n# Comment Support\nThe tool automatically adds appropriate comments to files based on their extensions:\n\n- .py files: # Comment\n- .js/.ts files: // Comment\n- .css files: /* Comment */\n- .html/.xml files: <!-- Comment -->\n- And many more...\n\n# Smart Features\n## Automatic `__init__.py` Creation\nWhen directories contain .py files, `__init__.py` is automatically created to make them proper Python packages.\n## Intelligent Skipping\nAutomatically skips common files and directories:\n\n- `__pycache__`\n- .git\n- node_modules\n- .env\n- Build/dist directories\n- And more...\n\n# Options\n\n- -f, --file: Input file containing folder structure\n- -o, --output: Output directory (default: current directory)\n- --format: Force input format (tree, yaml, simple, auto)\n- --dry-run: Show what would be created without creating files\n- -v, --verbose: Verbose output\n- --version: Show version\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Generate folder structures from various input formats (tree, YAML, simple indentation)",
    "version": "1.3.2",
    "project_urls": {
        "Documentation": "https://github.com/sree-sphere/foldertree#readme",
        "Homepage": "https://github.com/sree-sphere/foldertree",
        "Issues": "https://github.com/sree-sphere/foldertree/issues",
        "Repository": "https://github.com/sree-sphere/foldertree"
    },
    "split_keywords": [
        "folder",
        " directory",
        " structure",
        " generator",
        " tree",
        " scaffold"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "375a66af6586e8066f2361e5a477761f95dc2562baabaa9e5a7232d56f15fba2",
                "md5": "ddd4263eb0132ea4457478b7daa6c69d",
                "sha256": "498e3df4af97eaaccf425cfe5802ba3828bb1dbc4e472e4200f5642ff86b8b7d"
            },
            "downloads": -1,
            "filename": "treescaffold-1.3.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ddd4263eb0132ea4457478b7daa6c69d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 9000,
            "upload_time": "2025-07-18T02:52:13",
            "upload_time_iso_8601": "2025-07-18T02:52:13.296058Z",
            "url": "https://files.pythonhosted.org/packages/37/5a/66af6586e8066f2361e5a477761f95dc2562baabaa9e5a7232d56f15fba2/treescaffold-1.3.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b6f78f85752499c47987f89de053c76a2b0ef6bd757c3b0df5f57f9793ccd1ca",
                "md5": "f9fd1c226610541e9c556670066bef5b",
                "sha256": "9969426978c96542a9e6b681e13683a7673be560e0f24952f0f5bb79a410f9a8"
            },
            "downloads": -1,
            "filename": "treescaffold-1.3.2.tar.gz",
            "has_sig": false,
            "md5_digest": "f9fd1c226610541e9c556670066bef5b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 14194,
            "upload_time": "2025-07-18T02:52:14",
            "upload_time_iso_8601": "2025-07-18T02:52:14.669972Z",
            "url": "https://files.pythonhosted.org/packages/b6/f7/8f85752499c47987f89de053c76a2b0ef6bd757c3b0df5f57f9793ccd1ca/treescaffold-1.3.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-18 02:52:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sree-sphere",
    "github_project": "foldertree",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "pytest",
            "specs": [
                [
                    ">=",
                    "6.0"
                ]
            ]
        },
        {
            "name": "PyYAML",
            "specs": [
                [
                    ">=",
                    "5.4.0"
                ]
            ]
        }
    ],
    "lcname": "treescaffold"
}
        
Elapsed time: 0.85896s