Skip to main content

Dars Framework build applications with Python and export to web

Reason this release was yanked:

outdated

Project description

Dars Framework

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 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

#!/usr/bin/env python3
from dars.core.app import App
from dars.components.basic.text import Text
from dars.components.basic.button import Button
from dars.components.basic.container import Container
from dars.scripts.script import InlineScript

# Crear aplicación
app = App(title="Mi Primera App")

# Crear componentes
container = Container(style={
    'display': 'flex',
    'flex-direction': 'column',
    'align-items': 'center',
    'padding': '40px'
})

titulo = Text(
    text="Hola Dars",
    style={'font-size': '32px', 'color': '#333'}
)

boton = Button(
    text="Hacer clic",
    style={'background-color': '#007bff', 'color': 'white'}
)

# 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
container.add_child(titulo)
container.add_child(boton)
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

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

dars_framework-1.0.3.tar.gz (79.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dars_framework-1.0.3-py3-none-any.whl (101.8 kB view details)

Uploaded Python 3

File details

Details for the file dars_framework-1.0.3.tar.gz.

File metadata

  • Download URL: dars_framework-1.0.3.tar.gz
  • Upload date:
  • Size: 79.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for dars_framework-1.0.3.tar.gz
Algorithm Hash digest
SHA256 a85d504844309d547f886a4227f6109499be6522d22d00f5e7bf00a313af0789
MD5 e0b7fbefbcf61b247abae6ae6c47b386
BLAKE2b-256 57258ba5d5b7abf3f5d8f7fe767998fc2d90b0f7c3bd4d2accb95549b9dae830

See more details on using hashes here.

File details

Details for the file dars_framework-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: dars_framework-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 101.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for dars_framework-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8361e2b1c67485899f138c466a572928af52ebb9dcc848a5f937c0dcf410e051
MD5 bb70d404991b3e5cf2649dfc15da20de
BLAKE2b-256 c2aa4f875c2b83fe4b0d86e7b2f1454c0f915536bee74f5ff302dd76e0a3dc93

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