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.2.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.2-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: stencil_ui-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 9d8095c7843abad99cee5fb8da3db595ea42e5c8192b906304dd4ac98e69beb8
MD5 f788c16f04fd23b97164cb47546457fc
BLAKE2b-256 fbc37870591b6d3055ff3a4b4e2949f1c888810489e0b16ac84ada18f69c56fb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: stencil_ui-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 680d1c25ab8bb7835562500a1440811ee02b0c7cb1ae7bf02b596f2b4df6aa94
MD5 369fa3b5e29c9856cb594fa696ff22cc
BLAKE2b-256 4f14d342b1a9cc1d676d3eba6396ecece7a49670231ae9753920f51d3995a6ad

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