From 8e426b549de32549abf7f0378ca6f370f9c26ea9 Mon Sep 17 00:00:00 2001 From: Mike Macpherson Date: Fri, 20 Feb 2026 14:39:20 -0800 Subject: [PATCH 1/2] Add GitHub Pages site with narrative project page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Showcase page at /python-lucide/ with embedded Lucide SVGs throughout — 24 icons in a hero grid, inline examples of the customization API, and icon-decorated links. No JavaScript on the page, proving the library's own thesis. Co-Authored-By: Claude Opus 4.6 --- docs/_config.yml | 5 ++ docs/_includes/footer.html | 4 ++ docs/index.md | 116 +++++++++++++++++++++++++++++++++++++ 3 files changed, 125 insertions(+) create mode 100644 docs/_config.yml create mode 100644 docs/_includes/footer.html create mode 100644 docs/index.md diff --git a/docs/_config.yml b/docs/_config.yml new file mode 100644 index 0000000..9134d44 --- /dev/null +++ b/docs/_config.yml @@ -0,0 +1,5 @@ +title: python-lucide +description: Lucide icons as Python strings +baseurl: /python-lucide +url: https://mmacpherson.github.io +theme: minima diff --git a/docs/_includes/footer.html b/docs/_includes/footer.html new file mode 100644 index 0000000..4e13a1b --- /dev/null +++ b/docs/_includes/footer.html @@ -0,0 +1,4 @@ +
+
+
+
diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..650a5a5 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,116 @@ +--- +layout: default +title: python-lucide — Lucide icons as Python strings +--- + +# python-lucide + +*[Mike Macpherson](https://github.com/mmacpherson)* + +**TL;DR:** All 1600+ [Lucide](https://lucide.dev) icons available as SVG strings +in Python. `pip install python-lucide`, import, embed. No JavaScript, no icon +fonts, no client-side rendering step. Every icon on this page is a real Lucide +SVG, sourced from the package itself. + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ +## the itch + +I like building HTML on the server. Not templates-with-holes, but actual +programmatic markup — [hiccup](https://github.com/weavejester/hiccup) in +Clojure, [cottonmouth](https://github.com/adigitoleo/cottonmouth) in Python, +data structures that *are* the page. [FastHTML](https://fastht.ml/) takes that +ethos and makes it a full framework: pure Python components, web-standards-first, +no transpilation, no virtual DOM, no magic. + +The pattern extends to interactivity. +[Datastar](https://data-star.dev/), [HTMX](https://htmx.org/), and FastHTML's +own HTMX integration all follow the same principle: the server renders HTML, the +browser just shows it. No client-side JavaScript framework sitting between you +and your markup. + +[Lucide](https://lucide.dev) is a beautiful, well-maintained icon set — 1600+ +icons, all SVG, consistent style. But its standard integration assumes a +JavaScript runtime. You include the JS bundle and call `lucide.createIcons()`, +which walks the DOM and replaces placeholder elements with SVG. That works fine +for a traditional SPA. In a server-rendered world, though, you have to call +`lucide.createIcons()` again after every DOM swap — every HTMX response, every +Datastar fragment, every partial update. It's a small thing, but it grates. + +The fix is obvious: just embed the SVG directly. If the icon is already inline +in the HTML, there's nothing to initialize, nothing to re-run, nothing to +coordinate. The server sends the icon, the browser renders it, done. + +## the approach + +python-lucide packs all 1600+ Lucide SVGs into a ~780 KB SQLite database that +ships with the package. One function call gets you an icon: + +```python +from lucide import lucide_icon + +svg = lucide_icon("house") +# → ' + + +

+ +It works with anything that renders HTML on the server. FastHTML, Flask, Django, +FastAPI, plain string concatenation — if you can return an HTML string, you can +use these icons. No framework coupling, no special integration needed. + +If 780 KB of icons is too much for your deployment, the included `lucide-db` CLI +trims the database to just the icons you actually use: + +```bash +lucide-db -i house,settings,heart,search -o slim.db +export LUCIDE_DB_PATH=slim.db +``` + +## links + +- [ repo](https://github.com/mmacpherson/python-lucide) — source, README with full API reference +- [ pypi](https://pypi.org/project/python-lucide/) — `pip install python-lucide` +- [ lucide](https://lucide.dev) — the icon set itself +- [ fasthtml](https://fastht.ml/) — the framework that motivated this From d032cceb4577ab6bf36685b095d64a570dc1c0bb Mon Sep 17 00:00:00 2001 From: Mike Macpherson Date: Fri, 20 Feb 2026 15:01:03 -0800 Subject: [PATCH 2/2] Refine GitHub Pages: 5x5 icon grid, wording tweaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Simplify title, rename section, fix Datastar link text - Rewrite transition paragraph for smoother problem→solution flow - Switch icon showcase from flex to CSS grid (5x5), add 25th icon (map) Co-Authored-By: Claude Opus 4.6 --- docs/index.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/index.md b/docs/index.md index 650a5a5..d043746 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,10 +1,8 @@ --- layout: default -title: python-lucide — Lucide icons as Python strings +title: Lucide icons as Python strings --- -# python-lucide - *[Mike Macpherson](https://github.com/mmacpherson)* **TL;DR:** All 1600+ [Lucide](https://lucide.dev) icons available as SVG strings @@ -12,7 +10,7 @@ in Python. `pip install python-lucide`, import, embed. No JavaScript, no icon fonts, no client-side rendering step. Every icon on this page is a real Lucide SVG, sourced from the package itself. -
+
@@ -37,9 +35,10 @@ SVG, sourced from the package itself. +
-## the itch +## the problem I like building HTML on the server. Not templates-with-holes, but actual programmatic markup — [hiccup](https://github.com/weavejester/hiccup) in @@ -49,7 +48,7 @@ ethos and makes it a full framework: pure Python components, web-standards-first no transpilation, no virtual DOM, no magic. The pattern extends to interactivity. -[Datastar](https://data-star.dev/), [HTMX](https://htmx.org/), and FastHTML's +[datastar.js](https://data-star.dev/), [HTMX](https://htmx.org/), and FastHTML's own HTMX integration all follow the same principle: the server renders HTML, the browser just shows it. No client-side JavaScript framework sitting between you and your markup. @@ -62,9 +61,10 @@ for a traditional SPA. In a server-rendered world, though, you have to call `lucide.createIcons()` again after every DOM swap — every HTMX response, every Datastar fragment, every partial update. It's a small thing, but it grates. -The fix is obvious: just embed the SVG directly. If the icon is already inline -in the HTML, there's nothing to initialize, nothing to re-run, nothing to -coordinate. The server sends the icon, the browser renders it, done. +If you're already building your markup on the server, SVG is just... more markup +to include. That's what python-lucide enables — it packages the Lucide icon set +into an easy-to-use Python library so that every icon is just a function call +away, no client-side initialization needed. ## the approach