Skip to main content

No project description provided

Project description

A Pure Python, React-style Framework for Scaling Your Jupyter and Web Apps

solara logo

Come chat with us on Discord to ask questions or share your thoughts or creations!

Discord Shield

Introducing Solara

While there are many Python web frameworks out there, most are designed for small data apps or use paradigms unproven for larger scale. Code organization, reusability, and state tend to suffer as apps grow in complexity, resulting in either spaghetti code or offloading to a React application.

Solara addresses this gap. Using a React-like API, we don't need to worry about scalability. React has already proven its ability to support the world's largest web apps.

Solara uses a pure Python implementation of React (Reacton), creating ipywidget-based applications. These apps work both inside the Jupyter Notebook and as standalone web apps with frameworks like FastAPI. This paradigm enables component-based code and incredibly simple state management.

By building on top of ipywidgets, we automatically leverage an existing ecosystem of widgets and run on many platforms, including JupyterLab, Jupyter Notebook, Voilà, Google Colab, DataBricks, JetBrains Datalore, and more.

We care about developer experience. Solara will give your hot code reloading and type hints for faster development.

Installation

Run:

pip install solara

Or follow the Installation instructions for more detailed instructions.

First script

Put the following Python snippet in a file (we suggest sol.py), or put it in a Jupyter notebook cell:

import solara

# Declare reactive variables at the top level. Components using these variables
# will be re-executed when their values change.
sentence = solara.reactive("Solara makes our team more productive.")
word_limit = solara.reactive(10)


@solara.component
def Page():
    # Calculate word_count within the component to ensure re-execution when reactive variables change.
    word_count = len(sentence.value.split())

    solara.SliderInt("Word limit", value=word_limit, min=2, max=20)
    solara.InputText(label="Your sentence", value=sentence, continuous_update=True)

    # Display messages based on the current word count and word limit.
    if word_count >= int(word_limit.value):
        solara.Error(f"With {word_count} words, you passed the word limit of {word_limit.value}.")
    elif word_count >= int(0.8 * word_limit.value):
        solara.Warning(f"With {word_count} words, you are close to the word limit of {word_limit.value}.")
    else:
        solara.Success("Great short writing!")


# The following line is required only when running the code in a Jupyter notebook:
Page()

Run from the command line in the same directory where you put your file (sol.py):

$ solara run sol.py
Solara server is starting at http://localhost:8765

Or copy-paste this to a Jupyter notebook cell and execute it (the Page() expression at the end will cause it to automatically render the component in the notebook).

See this snippet run live at https://solara.dev/documentation/getting_started

Demo

The following demo app can be used to explore a dataset (build in or upload yourself) using a scatter plot. The plot can be interacted with to filter the dataset, and the filtered dataset can be downloaded.

Running in solara-server

The solara server is build on top of Starlette/FastAPI and runs standalone. Ideal for production use.

fastapi

Running in Jupyter

By building on top of ipywidgets, we automatically leverage an existing ecosystem of widgets and run on many platforms, including JupyterLab, Jupyter Notebook, Voilà, Google Colab, DataBricks, JetBrains Datalore, and more. This means our app can also run in Jupyter:

jupyter

Resources

Visit our main website or jump directly to the introduction

Introduction Quickstart

Note that the solara.dev website is created using Solara

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

solara-1.59.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

solara-1.59.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file solara-1.59.0.tar.gz.

File metadata

  • Download URL: solara-1.59.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.17.0 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.10.20"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.10.20","system":{"name":"Linux","release":"6.17.0-1018-azure"}} HTTPX2/2.5.0

File hashes

Hashes for solara-1.59.0.tar.gz
Algorithm Hash digest
SHA256 e28899492b3d064fdaaed44fb6e5de1d3dc706ddb57a4be4d8ad7bc4222c7b63
MD5 c86da061a3a4d89be5857cf216f3a1af
BLAKE2b-256 f503dfd9b9e22f7063638901e8fa300cc4a0a82b5e28d4c2484b7ba2635b2157

See more details on using hashes here.

File details

Details for the file solara-1.59.0-py3-none-any.whl.

File metadata

  • Download URL: solara-1.59.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.17.0 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.10.20"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.10.20","system":{"name":"Linux","release":"6.17.0-1018-azure"}} HTTPX2/2.5.0

File hashes

Hashes for solara-1.59.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f1ce722a8755ec91e3a9573e155b1658cd6f504788b889298adc423cfa2384d
MD5 4eaf13a84c8ee7837d2422e6b7bf469b
BLAKE2b-256 2e2c8e3101add3c0b40ae6c04a2c62a1b2062fd2a157366ff01b8341a1fa19a1

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