Scaffolder is a project to create and link directory structures
  • Python 88%
  • Dockerfile 12%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2025-07-16 16:14:03 -04:00
__pycache__ First version 2025-07-16 16:14:03 -04:00
example_structure.txt/microservice-core First version 2025-07-16 16:14:03 -04:00
scaffolder First version 2025-07-16 16:14:03 -04:00
tests First version 2025-07-16 16:14:03 -04:00
.dockerignore First version 2025-07-16 16:14:03 -04:00
.gitlab-ci.yml First version 2025-07-16 16:14:03 -04:00
__init__.py First version 2025-07-16 16:14:03 -04:00
docker-compose.yml First version 2025-07-16 16:14:03 -04:00
Dockerfile First version 2025-07-16 16:14:03 -04:00
LICENSE First version 2025-07-16 16:14:03 -04:00
manifest.in First version 2025-07-16 16:14:03 -04:00
pyproject.toml First version 2025-07-16 16:14:03 -04:00
README.md First version 2025-07-16 16:14:03 -04:00
requirements.txt First version 2025-07-16 16:14:03 -04:00
setup.py First version 2025-07-16 16:14:03 -04:00

Py Folder Structure Builder

Directory Structure Creator

A Python tool that creates directory and file structures from tree-like text representations. Perfect for quickly setting up project scaffolding from documentation or design files.

Features

  • 🌳 Parse tree-like directory structures from text files
  • 📁 Create directories and files automatically
  • 🔄 Generate structure files from existing directories
  • 🔧 Handle nested directory structures with proper indentation
  • 🎯 Support for custom base directories
  • 🚀 Command-line interface for easy usage
  • 📦 Available as both CLI tool and Python package

Installation

pip install scaffolder

From Source

git clone https://git.takelan.com/ddemuro/scaffolder.git
cd scaffolder
pip install -e .

Usage

Command Line Interface

Creating structures from files

# Basic usage (looks for structure.txt in current directory)
create-structure

# Specify a different structure file
create-structure my_structure.txt

# Create structure in a specific directory
create-structure structure.txt ./my_new_project

Generating structure files from directories

# Generate structure.txt from current directory
create-structure --generate .

# Generate from specific directory
create-structure --generate ./my_project

# Custom output file
create-structure --generate ./my_project --output my_structure.txt

# Limit depth
create-structure --generate ./my_project --max-depth 3

# Add custom ignore patterns
create-structure --generate ./my_project --ignore "*.log" --ignore "temp_*"

# Show help
create-structure --help

Python API

from scaffolder import create_structure, generate_structure_file

# Create structure from file
create_structure('structure.txt', base_path='./my_project')

# Generate structure file from directory
generate_structure_file('./existing_project', 'new_structure.txt')

# Generate with custom options
generate_structure_file(
    './my_project',
    output_file='structure.txt',
    max_depth=5,
    ignore_patterns=['*.log', 'temp_*', '__pycache__']
)

# Or use the parser directly
from scaffolder import parse_structure_file
paths = parse_structure_file('structure.txt')

Structure File Format

The tool accepts tree-like text files with the following format:

project-name/
├── setup.py
├── README.md
├── requirements.txt
├── src/
│   ├── __init__.py
│   ├── main.py
│   └── utils/
│       ├── __init__.py
│       └── helpers.py
└── tests/
    ├── __init__.py
    └── test_main.py

Format Rules

  • Directories: End with a forward slash (/)
  • Files: No trailing slash
  • Indentation: Use tree characters (├──, └──, │) or consistent spacing
  • Nesting: Properly indent child items under their parents

Examples

Generate from Existing Project

If you have an existing project and want to create a structure file:

# Generate structure.txt from your project
create-structure --generate ./my_existing_project

# This creates a structure.txt file that looks like:
my_existing_project/
├── README.md
├── setup.py
├── requirements.txt
├── src/
│   ├── __init__.py
│   └── main.py
└── tests/
    ├── __init__.py
    └── test_main.py

Then you can use this structure file to recreate the same structure elsewhere:

create-structure structure.txt ./new_project_copy

Advanced Generation Options

# Limit depth to avoid very deep structures
create-structure --generate ./my_project --max-depth 3

# Add custom ignore patterns (in addition to defaults)
create-structure --generate ./my_project --ignore "*.log" --ignore "temp_*"

# Generate to a specific output file
create-structure --generate ./my_project --output my_custom_structure.txt

Default Ignore Patterns

When generating structure files, these patterns are ignored by default:

  • __pycache__, *.pyc, *.pyo
  • .git, .gitignore
  • .venv, venv, env
  • node_modules
  • .idea, .vscode
  • build, dist, *.egg-info
  • .DS_Store, Thumbs.db
  • .pytest_cache, .mypy_cache
  • .coverage, htmlcov
  • *.swp, *.swo, *~

Basic Project Structure

Create a file called structure.txt:

my-project/
├── README.md
├── setup.py
├── requirements.txt
├── src/
│   ├── __init__.py
│   └── main.py
└── tests/
    ├── __init__.py
    └── test_main.py

Run the command:

create-structure structure.txt

This will create:

my-project/
├── README.md
├── setup.py
├── requirements.txt
├── src/
│   ├── __init__.py
│   └── main.py
└── tests/
    ├── __init__.py
    └── test_main.py

Microservice Structure

The tool works great for complex structures:

Sample output:

Creating directory structure in: /home/ddemuro/Documents/Code/takelan/py-folder-structure-builder
--------------------------------------------------
📁 Created directory: microservice-core
📄 Created file: microservice-core/setup.py
📄 Created file: microservice-core/setup.cfg
📄 Created file: microservice-core/pyproject.toml
📄 Created file: microservice-core/README.md
📄 Created file: microservice-core/LICENSE
📄 Created file: microservice-core/requirements.txt
📄 Created file: microservice-core/.gitignore
📁 Created directory: microservice-core/microservice_core
📄 Created file: microservice-core/microservice_core/__init__.py
📄 Created file: microservice-core/microservice_core/__version__.py
📁 Created directory: microservice-core/microservice_core/http
📄 Created file: microservice-core/microservice_core/http/__init__.py
📄 Created file: microservice-core/microservice_core/http/client.py
📄 Created file: microservice-core/microservice_core/http/middleware.py
📁 Created directory: microservice-core/microservice_core/cache
📄 Created file: microservice-core/microservice_core/cache/__init__.py
📄 Created file: microservice-core/microservice_core/cache/redis_client.py
📄 Created file: microservice-core/microservice_core/cache/decorators.py
📁 Created directory: microservice-core/microservice_core/storage
📄 Created file: microservice-core/microservice_core/storage/__init__.py
📄 Created file: microservice-core/microservice_core/storage/minio_client.py
📄 Created file: microservice-core/microservice_core/storage/s3_client.py
📁 Created directory: microservice-core/microservice_core/crypto
📄 Created file: microservice-core/microservice_core/crypto/__init__.py
📄 Created file: microservice-core/microservice_core/crypto/encryption.py
📄 Created file: microservice-core/microservice_core/crypto/searchable.py
📁 Created directory: microservice-core/microservice_core/database
📄 Created file: microservice-core/microservice_core/database/__init__.py
📄 Created file: microservice-core/microservice_core/database/base_models.py
📄 Created file: microservice-core/microservice_core/database/session.py
📄 Created file: microservice-core/microservice_core/database/mixins.py
📁 Created directory: microservice-core/microservice_core/auth
📄 Created file: microservice-core/microservice_core/auth/__init__.py
📄 Created file: microservice-core/microservice_core/auth/security.py
📄 Created file: microservice-core/microservice_core/auth/dependencies.py
📄 Created file: microservice-core/microservice_core/auth/jwt_handler.py
📁 Created directory: microservice-core/microservice_core/monitoring
📄 Created file: microservice-core/microservice_core/monitoring/__init__.py
📄 Created file: microservice-core/microservice_core/monitoring/metrics.py
📄 Created file: microservice-core/microservice_core/monitoring/sentry.py
📄 Created file: microservice-core/microservice_core/monitoring/logging.py
📁 Created directory: microservice-core/microservice_core/websocket
📄 Created file: microservice-core/microservice_core/websocket/__init__.py
📄 Created file: microservice-core/microservice_core/websocket/manager.py
📁 Created directory: microservice-core/microservice_core/schemas
📄 Created file: microservice-core/microservice_core/schemas/__init__.py
📄 Created file: microservice-core/microservice_core/schemas/base.py
📄 Created file: microservice-core/microservice_core/schemas/common.py
📁 Created directory: microservice-core/microservice_core/utils
📄 Created file: microservice-core/microservice_core/__init__.py
📄 Created file: microservice-core/microservice_core/validators.py
📄 Created file: microservice-core/microservice_core/helpers.py
📄 Created file: microservice-core/microservice_core/exceptions.py
📁 Created directory: microservice-core/tests
📄 Created file: microservice-core/__init__.py
📄 Created file: microservice-core/test_http_client.py
📄 Created file: microservice-core/test_cache.py
📄 Created file: microservice-core/test_storage.py
--------------------------------------------------
✅ Directory structure created successfully!

Development

Setting up for Development

git clone https://git.takelan.com/ddemuro/scaffolder.git
cd scaffolder
pip install -e ".[dev]"

Running Tests

pytest

Code Formatting

black .
isort .
flake8 .

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Changelog

v1.0.0

  • Initial release
  • CLI tool for creating directory structures
  • Python API support
  • Support for tree-like text file parsing

Support

If you encounter any issues or have questions, please file an issue on the GitHub repository.