Show HN: Python UI-Me – Turn functions into web forms with one decorator
A simple python decorator, to build UI forms out of your everyday python functions
Python UI-Me (as in: Python methods saying "make elegant UI forms out of me") is a tiny-but-mighty package that turns
your everyday functions into sleek web control panels. Tag a function with a decorator, let the bundled Flask app spin
up, and suddenly your script feels like a real product instead of a one-off command.
What you get: In just three lines of code, all regular functions of your python code will be ready to use on a
UI. Every argument of these functions becomes input forms and on using them, their responses get render in rich JSON.
All this, while the whole thing still feels feather-light because it is plain HTML/CSS/JS (no React, no design system du jour).
What you keep: Your playful, slightly chaotic script-driven workflow. UI-Me just gives it buttons, dark mode, and a
logo.
What to look at first: The Motivation story is short and spicy, but if your build server is already
screaming, here’s the gif version of what to expect:
I'm pretty sure I'm not the only lazy developer that over-engineers every tiny chore as a script. This project is my
latest effort toward making those scripts slightly less cryptic to future-me (and whoever is sitting next to me asking
“what happens if I click this?”).
Yes, argparse and friends exist. But the minute a single script starts doing five things, or you forget what flags you
invented at 2 AM, CLI ergonomics fall apart. And the amount of boilerplate to wire multiple parsers... no thanks.
So UI-Me is the middle ground: not meant for enterprise-scale production flows, but absolutely meant for the pile of
daily automation you keep collecting. Think of it as Swagger UI for your Python
functions, except it is unapologetically simple and proudly decorator-powered.
Install Python UI-me using pip:
Basically 3 lines of code
You might run into situations where you want to set global variables of your script.
This is going to be a little more involved - you need to expose a setter to the global variable, while using a new
decorator @ui_global
Here is an example:
The left navigation bar contains a section for Global Variables, which will allow you to set them.
Sample code below shows a list of parameters that have different types:
The UI would look something like this
Note
As you observe the above table, a text-area is used to collect inputs for complex datatypes. This is being done on
purpose to keep things simple, but that simplicity comes at a cost.
When inferring a list of anything from the text-area - extraction of the list from the large string, is done by using
delimiters.
By default, the priority of delimiters are NEWLINE, COMMA, SPACE
ie: NEWLINE is checked first, if available, the string will be split by newline and returned as a list. Then there is
a
check for COMMA, if available, the string will be split by comma and returned as a list. Finally SPACE.
In case of , it is always a check on NEWLINE for the outer list, and COMMA/SPACE for the inner lists
8 different themes to choose from, to make your UI look cool.
The following is list of essential dependencies in python:
Reiterating here that UI Me does not depend on any heavy front-end libraries or frameworks. The entire UI is built using
vanilla HTML, CSS (Tailwind CSS for styling) and JavaScript.
Please raise Issues, Bugs or any feature requests
at Github Issues.
If you plan on contributing to the code, fork the repository and raise a Pull Request back here.
Marco Rodriguez
Startup ScoutFinding the next unicorn before it breaks. Passionate about innovation and entrepreneurship.