Skip to main content

CLI tool to generate HTML from a config file

Project description

📘 Stencil

PyPI version License: MIT Python Versions

stencil is a lightweight CLI tool that generates HTML files directly from a simple YAML or JSON configuration. No need to manually write boilerplate HTML and CSS — just describe your UI in a config file, and stencil handles the rest.


✨ Features

  • 📝 Define UI elements (title, text, button) in YAML or JSON.
  • ⚡ Generates a ready-to-use index.html with clean CSS styling.
  • 🖱️ Automatic JavaScript stubs for button callbacks.
  • 🔎 Auto-detects config file (stencil.yaml or stencil.json) in your project root.
  • 🎯 Zero setup — just install and run.

📦 Installation

pip install stencil-ui

(requires Python 3.8+)


🚀 Usage

  1. Create a stencil.yaml in your project root:
app:
  - title: "My First Stencil Page"
  - text: "Hello, world!"
  - button:
      label: "Click Me"
      callback: "onClick"
  1. Run the CLI:
stencil
  1. That’s it! 🎉 index.html will be generated in your project root.

🖼 Example Output

Given the above config, Stencil produces a styled HTML page like this:

screenshot


⚙️ Configuration

Stencil looks for either:

  • stencil.yaml
  • stencil.json

Supported elements:

Element Example Output
title - title: "My Page" <title> + <h1>
text - text: "Hello World!" <p>Hello World!</p>
button see example above <button> with JS callback

📂 Project Structure Example

my-project/
│
├── stencil.yaml
├── index.html   # generated
└── css/
    └── style.css

🛠 Development

Clone and install locally:

git clone https://github.com/your-username/stencil.git
cd stencil
pip install -e .

Run CLI from source:

python -m stencil

📜 License

This project is licensed under the MIT License.


💡 Inspiration

Stencil was built to simplify rapid prototyping of HTML pages from configs. Perfect for:

  • Mockups & quick demos
  • Teaching web basics
  • Auto-generating documentation UIs

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

stencil_ui-0.1.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

stencil_ui-0.1.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file stencil_ui-0.1.1.tar.gz.

File metadata

  • Download URL: stencil_ui-0.1.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.13

File hashes

Hashes for stencil_ui-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d65136f4fc116558be51fdab8d229d12e20c67f80b1fc79331c26efeac33787c
MD5 d04098e2967e02da7731b2625c615543
BLAKE2b-256 9fccba2614f8ab69ad3faf21f9f25f20385e9698f140bd1b256b013dcc14ce7f

See more details on using hashes here.

File details

Details for the file stencil_ui-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: stencil_ui-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.13

File hashes

Hashes for stencil_ui-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e2d04d41e265d321443c09f5554e29f4428ea6b32378ef425f24c1277d4cd1b1
MD5 fa0e08fec5ccabefb744ccb17d8f086e
BLAKE2b-256 88fbcfe0a5354eb018ce729a359e32cc6ca51cd5404f2fde44ddeaeeb909cefa

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