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

(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.0.tar.gz (5.1 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.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: stencil_ui-0.1.0.tar.gz
  • Upload date:
  • Size: 5.1 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.0.tar.gz
Algorithm Hash digest
SHA256 7bcdc91a5203f181cc962bd07934a30e8651bb7db80ca2d294c8e696b686e33f
MD5 89476d161463fe6e6f300c4ca4f569bb
BLAKE2b-256 61f02757ef10b931970a8fc3f88dfc95e280ef1fa67a9e2329f322153e01fada

See more details on using hashes here.

File details

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

File metadata

  • Download URL: stencil_ui-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 780485b8ed7e270b5a4480cadd8d47ebf48e3cdf0a7d795b4451adf294f5c789
MD5 fcb4f83bc9a9dd91d46c1fdbc4658858
BLAKE2b-256 a33b843335ec7e2cec4439cdf85423ea4aa3d6eddf0aada593b45c7393f89498

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