Giter Site home page Giter Site logo

h2oai / nitro Goto Github PK

View Code? Open in Web Editor NEW
200.0 12.0 14.0 7.44 MB

Create apps 10x quicker, without Javascript/HTML/CSS.

Home Page: https://nitro.h2o.ai

License: Apache License 2.0

HTML 9.25% CSS 31.73% TypeScript 44.67% JavaScript 0.12% Python 13.24% Makefile 0.25% Go 0.63% CoffeeScript 0.10%
low-code python webapp app apps data-science graphics h2o-nitro ui user-interface

nitro's Introduction

Nitro

Create apps 10x quicker, without Javascript, HTML, or CSS.

Nitro

Currently a Work in Progress. Follow the development blog or @CrunchingData for updates, or use Discord or Discussions for help / ideas / suggestions.

Get started

Philosophy

Recall how simple it is to author interactive command line applications using Python's built-in input() and print():

def main():
    name = input('What is your name?')
    feel = input(f'How do you feel today, {name}?')
    print(f'What a coincidence, {name}, I feel {feel}, too!')
> What is your name?
> Boaty McBoatface
> How do you feel today, Boaty McBoatface?
> intrigued
> What a coincidence, Boaty McBoatface, I feel intrigued, too!

Nitro brings that same level of simplicity to authoring web applications:

from h2o_nitro import View, box

def main(view: View):
    name = view(box('What is your name?', value='Boaty McBoatface'))
    feel = view(box(f'How do you feel today, {name}?', value='intrigued'))
    view(f'What a coincidence, {name}, I feel {feel}, too!')

Hello World app

And here's a more elaborate example with seven pages in seven Python statements:

Recruitment app

nitro's People

Contributors

chathurindaranasinghe avatar fazpu avatar lo5 avatar mturoci avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nitro's Issues

Make Nitro apps run via Pyodide

Is your feature request related to a problem? Please describe.
Docs have screenshots, not live examples.

Describe the solution you'd like
Be able to host live examples in docs.

Internationalization and localization.

  • Preload locale-specific string resource dicts.
  • #64
  • Pass data= as data for template / formatting
  • #65
  • Block-sensitive localization
  • Allow fallback locales in block level locale=
  • { } escaping
  • Change View(locale=) to View(bundles=)
  • Locale matcher: first dibs to app? Function matcher?
  • Documentation
    • String
    • Number
    • Date
    • Time
    • Rel Time
    • Lists

Roadmap

This is a living document. Check back for updates!

Goal

H2O Nitro aims to be the simplest way to build apps. No front-end experience required.

Features

In-progress

Planned

  • Support or guidance for integrating outputs of third-party libraries. Shipped in v0.8.
    • Create plugin for Matplotlib / Seaborn
    • Create plugin for Bokeh
    • Create plugin for Altair
    • #17
    • #18
    • #19
    • Custom Javascript
  • ๐Ÿ” ๐Ÿค˜ Run apps inside Jupyter notebooks.
    • Chromeless mode. Shipped in v0.10.
  • Compile native front-ends (via Flutter).
  • #21
  • ๐Ÿค˜ Julia language support.
  • ๐Ÿค˜ Go language support.

Shipped

  • Improved typography. Shipped in v0.5.
  • Support for theming. Shipped in v0.5.
    • Auto-generate theme given foreground, background, accent colors.
    • Allow user-defined themes.
    • Allow changing themes after app load.
    • Built-in dark-mode switch.
  • Tables. Shipped in v0.6.
  • Popup dialogs. Shipped in v0.7.
  • File upload. Shipped in v0.7.
  • nitro run apps directly from git repos. Shipped in v0.9.
  • Partial insert/update/remove operations on view. Shipped in v0.10.
  • Run apps entirely in-browser using Pyodide.Shipped in v0.11.
  • #16 Shipped in v0.12.
  • Add back-button / history support. Shipped in v0.13.
    • Hash navigation. Shipped in v0.10.
  • #67 Shipped in v0.14.
  • Text templates, generic click handling, hotkeys. Shipped in v0.16
  • #20 Shipped in v0.17.

Meta

Legend

Icon Status
โœ‹ Blocked
๐ŸŽˆ Completed, but not shipped
๐Ÿค˜ Stretch Goal
๐Ÿ” Research 1

Disclaimer

Any statement in this document that is not purely historical is considered a forward-looking statement. Forward-looking statements included in this document are based on information available as of the date they are made, and H2O.ai assumes no obligation to update any forward-looking statements. The forward-looking roadmap does not represent a commitment, guarantee, obligation or promise to deliver any feature, or to deliver any feature by any particular date, and is intended to outline the general development plans. Customers should not rely on this roadmap to make any purchasing decision.

Footnotes

  1. Needs a better understanding of the problem and potential solutions before committing to actual feature work. We continuously tune the plan based on research, feedback, and lessons learned from shipping each release. โ†ฉ

Implement "nitro run" command

Goal
Execute apps locally given one of:

  • nitro run foo.py
  • nitro run https://gist.github.com/user/hash

Notes
The deps for the app are self-contained in the .py file using a shebang-meets-dockerfile thingy:

# --- env ---
# USE venv
# RUN pip install pandas bokeh flask h2o-nitro
# RUN FLASK_APP=app.py flask run
# --- !env ---
def main():
    pass

or

# --- env ---
# USE venv
# FILE requirements.txt EOF
# pandas==4.5
# bokeh>=0.4.2
# flask
# h2o-nitro>0.8.2
# EOF
# RUN pip install -r requirements.txt
# RUN FLASK_APP=app.py flask run
# --- !env ---
def main():
    pass

Supported commands are

  • USE uses venv, conda, poetry, pipenv, etc.
  • FILE creates a file relative to cwd.
  • RUN executes a shell command.
  • GET fetches a file given a relative or absolute URL.
  • COPY copies, moves, renames local files.

R API proposal

What's the simplest, most ergonomic and idiomatic equivalent of the following Python code in R?

# Prompt for first and last names.
first_name, last_name = view(
    box('First name', value='Boaty'),
    box('Last name', value='McBoatface'),
)
# Print the entered values
view(f'Hello, {first_name} {last_name}!')

Source: https://nitro.h2o.ai/basics/#get-multiple-inputs-at-once

For context, this is what the above code would've looked like if Python didn't have destructuring assignments:

# Prompt for first and last names.
result = view(
    box('First name', name='first_name', value='Boaty'),
    box('Last name', name='last_name', value='McBoatface'),
)
# Print the entered values
view(f'Hello, {result['first_name']} {result['last_name']}!')

"nitro run" on Windows 10 cannot locate AppStore-installed Python

Describe the bug
nitro run fails to locate Python installed via the Windows App Store:
C:\Users\User\AppData\Local\Microsoft\WindowsApps\python3.exe

To Reproduce
nitro run https://nitro.h2o.ai/docs.py

Environment (please complete the following information):

  • Nitro version: 0.9.0
  • Python version: 3.7
  • OS and version: Windows 10

Cause: golang/go#42919

Backlog

This backlog covers (smaller) pending tasks that don't fit into #4.

Finalize v1 communication protocol for multi-language support

Current protocol has some rough edges.

  • Clean up before implementing at least one of Go, R, Julia backend.
  • Robust handling of request-response w/ drops.
  • Block UI during commit.
  • Add box-level correlation ID for langs that don't support destructuring assignments.

Make an embeddable version of front-end (nitro.js)

Is your feature request related to a problem? Please describe.

The front-end currently expects all of index.html to be served from the backend, and requires a /nitro WS endpoint to be exposed by the server. This is avoidable.

Describe the solution you'd like

An embeddable version of the front-end that's purely data-in, data-out could make it easier to integrate with legacy software. The legacy software would have to include a bit of JS to wire up nitro.js to the backend.

Support dependencies file

Is your feature request related to a problem? Please describe.
Having the requirements part of the core app code is an uncommon practice.

Describe the solution you'd like
Nitro to be able to install dependencies from a separate txt file.

Suggestion solution
Was thinking something like:

nitro run https://raw.githubusercontent.com/h2oai/nitro/main/py/examples/hello.py --requirements https://raw.githubusercontent.com/h2oai/nitro/main/py/examples/requirements.txt

(or something better) would be quite useful.

Additional comments
It could immediately enable Nitro to be used for existing projects in conjunction with existing workflows (like a pip package/library).

Some components don't return default values when empty.

Describe the bug
Some components (dropdown, combobox, slider, etc.) don't return default values if empty, causing problems during tuple unpacking.

Environment (please complete the following information):

  • Nitro version: 0.10.0

required=True does not enforce field value existence

Describe the bug

box('input something', required=True) does not seem to actually require a value. It just adds a red asterisk above the text input, but when the "continue" button is clicked, the form submits with no value (or with an empty value?)

Expected behavior

Much like the native text input in modern browsers, provide a tooltip to the user saying "this field is required" or "{NAME} is required".

Actual behavior

The form submits without a value.

To Reproduce

Modify the hello world example, change one of the box line to:

feel = await view(box(f'How do you feel today, {name}?', mode='text', required=True))

Run this example and click all the "continue" buttons without typing anything into the text inputs.

Screenshots

I did not take any sceenshots.

Environment (please complete the following information):

  • Nitro version: 0.9.0
  • Python version: 3.10.4
  • OS and version: macOS 12.4
  • Browser and version: Vivaldi 5.2

Additional context

None.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.