Dars is a Python UI framework for building modern, interactive web apps with only Python code. Write your interface in Python, export it to static HTML/CSS/JS, and deploy anywhere.
Project description
Dars Framework
Dars is a Python UI framework for building modern, interactive web apps with Python code. Write your interface in Python, export it to static HTML/CSS/JS, and deploy anywhere.
Some Javascript or frontend stack required.
pip install dars-framework
How It Works
- Build your UI using Python classes and components (like Text, Button, Container, Page, etc).
- Preview instantly with hot-reload using
app.rTimeCompile(). - Export your app to static web files with a single CLI command.
- Use multipage, layouts, scripts, and more—see docs for advanced features.
Quick Example: Your First App
from dars import App, Container, Text, Button, InlineScript
app = App()
# Crear aplicación con sintaxis nueva (v1.0.3)
container = Container(
Text(
"Hola Dars",
style={'font-size': '32px', 'color': '#333'}
),
Button(
"Hacer clic",
style={'background-color': '#007bff', 'color': 'white'}
),
style={
'display': 'flex',
'flex-direction': 'column',
'align-items': 'center',
'padding': '40px'
}
)
# Script para interactividad
script = InlineScript("""
document.addEventListener('DOMContentLoaded', function() {
const boton = document.querySelector('button');
boton.addEventListener('click', function() {
alert('Hola desde Dars.');
});
});
""")
# Ensamblar aplicación
app.set_root(container)
app.add_script(script)
if __name__ == "__main__":
app.rTimeCompile() # Live preview at http://localhost:8000
CLI Usage
| Command | What it does |
|---|---|
dars export my_app.py --format html |
Export app to HTML/CSS/JS in ./my_app_web |
dars preview ./my_app_web |
Preview exported app locally |
dars init my_project |
Create a new Dars project |
dars info my_app.py |
Show info about your app |
dars formats |
List supported export formats |
dars --help |
Show help and all CLI options |
More
- Project Roadmap
- Getting Started
- Components Documentation
- Exporters
- Scripts System
- CLI usage and commands
- Project Structure
- Architecture
- Installation Guide
Local Execution and Live Preview
To test your app locally before exporting, use the hot-reload preview from any Python file that defines your app:
if __name__ == "__main__":
app.rTimeCompile()
Then run your file directly:
python my_app.py
This will start a local server at http://localhost:8000 so you can view your app in the browser—no manual export needed. You can change the port with:
python my_app.py --port 8088
You can also use the CLI preview command on an exported app:
dars preview ./my_exported_app
This will start a local server at http://localhost:8000 to view your exported app in the browser.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dars_framework-1.0.62.tar.gz.
File metadata
- Download URL: dars_framework-1.0.62.tar.gz
- Upload date:
- Size: 96.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8b350db2486ed98f4345f5afcfb27b7068e7c9fef00c99120f8a2f1d0dd1dc0
|
|
| MD5 |
e8e4a269dab14ea5b17ab44269032ff2
|
|
| BLAKE2b-256 |
cdefa62aa05aeebe2051095c1d80e499c28b785be74b9df1c8f755933183e425
|
File details
Details for the file dars_framework-1.0.62-py3-none-any.whl.
File metadata
- Download URL: dars_framework-1.0.62-py3-none-any.whl
- Upload date:
- Size: 120.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e5cbc02d11d05f60e259cf205d68e32d49e1573af6003bc8e6115f17de29797
|
|
| MD5 |
0a0f0027e89ffd93a3f021ad88f3ce94
|
|
| BLAKE2b-256 |
4ae82b9e44fda762fe8f307c1e8f0098be3ecbaee3d1093bdac0f4f8a554f825
|