Shiny (web framework)

Last updated
Shiny
Original author(s) Joe Cheng
Developer(s) RStudio Inc. (and current renamed company Posit PBC)
Initial releaseNovember 2012;12 years ago (2012-11)
Stable release
1.9.1 [1]
Repository
Written in R / Python
License MIT License
Website shiny.rstudio.com

Shiny is a web framework for developing web applications (apps), originally in R and since 2022 in python. It is free and open source. [2] It was announced by Joe Cheng, CTO of Posit, formerly RStudio, in 2012. [3] One of the uses of Shiny has been in fast prototyping. [4]

Contents

In 2022, a separate implementation Shiny for Python was announced. [5] It is not meant to be a replacement, whereby both implementations will be developed concurrently and may never have all the features of each other. There is also Shinylive that allows running Shiny on the client (i.e., program code does not run on the server, reducing server load to just serving the code itself). [6]

Features

Shiny creates a reactive context wherein the user specifies, through input variables, the circumstances under which computations are re-executed, or graphs (often visualizations) re-rendered; this occurs almost instantaneously. The input variables are evaluated via a user interface which allows the simple creation of widgets such as text boxes, radio buttons, and drop-down lists. [3] [7]

There are two main parts to a Shiny file, which may alternatively be stored in two separate files. One is designed to accommodate the user interface, the appearance of which is restricted by the default choices, though can be extended through various other R packages. The other is designed to accommodate the server computations and plot generating code, for which all the built-in facilities of R are available. [3]

Examples

A screenshot of the example app Shiny app example.png
A screenshot of the example app

This is an example of a basic application in R where: [8]

library(shiny)ui<-fluidPage(textInput("name","What is your name?"),textOutput("greeting"))server<-function(input,output,session){output$greeting<-renderText({paste0("Hello ",input$name)})}shinyApp(ui,server)

And the equivalent application written in python: [9]

fromshinyimportApp,reactive,render,uiapp_ui=ui.page_fluid(ui.input_text("name","What is your name?"),ui.output_text("greeting"),)defserver(input,output,session):@render.textdefgreeting():returnf"Hello {input.name()}"app=App(app_ui,server)

And shiny express for python: [10]

fromshiny.expressimportinput,render,uiui.input_text("name","What is your name?")@render.textdefgreeting():returnf"Hello {input.name()}"

Deploying / Hosting Shiny

Deploying Shiny (R) can be achieved through several popular methods:

Related Research Articles

Extensible Application Markup Language is a declarative XML-based language developed by Microsoft for initializing structured values and objects. It is available under Microsoft's Open Specification Promise.

Code Injection is a class of computer security exploits in which vulnerable computer programs or system processes fail to properly handle external data, such as user input, leading to the program misinterpreting the data as a command that should be executed. An attacker using this method "injects" code into the program while it is running. Successful exploitation of a code injection vulnerability can result in data breaches, access to restricted or critical computer systems, and the spread of malware.

wxPython Python wrapper for wxWidgets

wxPython is a wrapper for the cross-platform GUI API wxWidgets for the Python programming language. It is one of the alternatives to Tkinter. It is implemented as a Python extension module.

The Web Server Gateway Interface is a simple calling convention for web servers to forward requests to web applications or frameworks written in the Python programming language. The current version of WSGI, version 1.0.1, is specified in Python Enhancement Proposal (PEP) 3333.

Windows Presentation Foundation (WPF) is a free and open-source user interface framework for Windows-based desktop applications. WPF applications are based in .NET, and are primarily developed using C# and XAML.

Web2py is an open-source web application framework written in the Python programming language. Web2py allows web developers to program dynamic web content using Python. Web2py is designed to help reduce tedious web development tasks, such as developing web forms from scratch, although a web developer may build a form from scratch if required.

<span class="mw-page-title-main">Vaadin</span> Web development platform written in Java

Vaadin is an open-source web application development platform for Java. Vaadin includes a set of Web Components, a Java web framework, and a set of tools that enable developers to implement modern web graphical user interfaces (GUI) using the Java programming language only, TypeScript only, or a combination of both.

Wt is an open-source widget-centric web framework for the C++ programming language. It has an API resembling that of Qt framework, also using a widget-tree and an event-driven signal/slot system.

Tornado is a scalable, non-blocking web server and web application framework written in Python. It was developed for use by FriendFeed; the company was acquired by Facebook in 2009 and Tornado was open-sourced soon after.

<span class="mw-page-title-main">Flask (web framework)</span> Python web framework

Flask is a micro web framework written in Python. It is classified as a microframework because it does not require particular tools or libraries. It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions. However, Flask supports extensions that can add application features as if they were implemented in Flask itself. Extensions exist for object-relational mappers, form validation, upload handling, various open authentication technologies and several common framework related tools.

Mustache is a web template system. It is described as a logic-less system because it lacks any explicit control flow statements, like if and else conditionals or for loops; however, both looping and conditional evaluation can be achieved using section tags processing lists and anonymous functions (lambdas). It is named "Mustache" because of heavy use of braces, { }, that resemble a sideways moustache. Mustache is used mainly for mobile and web applications.

<span class="mw-page-title-main">Kivy (framework)</span> Free and multi-platform graphical library for Python

Kivy is a free and open source Python framework for developing mobile apps and other multitouch application software with a natural user interface (NUI). It is distributed under the terms of the MIT License, and can run on Android, iOS, Linux, macOS, and Windows.

<span class="mw-page-title-main">RStudio</span> Integrated development environment for R

RStudio IDE is an integrated development environment for R, a programming language for statistical computing and graphics. It is available in two formats: RStudio Desktop is a regular desktop application while RStudio Server runs on a remote server and allows accessing RStudio using a web browser. The RStudio IDE is a product of Posit PBC.

Backend as a service (BaaS), sometimes also referred to as mobile backend as a service (MBaaS), is a service for providing web app and mobile app developers with a way to easily build a backend to their frontend applications. Features available include user management, push notifications, and integration with social networking services. These services are provided via the use of custom software development kits (SDKs) and application programming interfaces (APIs). BaaS is a relatively recent development in cloud computing, with most BaaS startups dating from 2011 or later. Some of the most popular service providers are AWS Amplify and Firebase.

JWt is an open-source widget-centric web application framework for the Java programming language developed by Emweb. It has an API that uses established GUI application development patterns. The programming model is component-based and event-driven, similar to Swing.

<span class="mw-page-title-main">Joseph J. Allaire</span> American software engineer and entrepreneur

Joseph J. Allaire, better known professionally as J. J. Allaire, is an American-born software engineer and Internet entrepreneur. He created the ColdFusion programming language and web application server, founded Allaire Corporation, OnFolio, FitNow, and RStudio, and created LoseIt! and Windows Live Writer. Allaire is currently the founder and CEO of statistical computing company Posit.

<span class="mw-page-title-main">Project Jupyter</span> Open source data science software

Project Jupyter is a project to develop open-source software, open standards, and services for interactive computing across multiple programming languages.

ASP.NET Web Forms is a web application framework and one of several programming models supported by the Microsoft ASP.NET technology. Web Forms applications can be written in any programming language which supports the Common Language Runtime, such as C# or Visual Basic. The main building blocks of Web Forms pages are server controls, which are reusable components responsible for rendering HTML markup and responding to events. A technique called view state is used to persist the state of server controls between normally stateless HTTP requests.

FastAPI is a high-performance web framework for building HTTP-based service APIs in Python 3.8+. It uses Pydantic and type hints to validate, serialize and deserialize data. FastAPI also automatically generates OpenAPI documentation for APIs built with it. It was first released in 2018.

Posit PBC is an open-source data science software company. It is a public-benefit corporation founded by J. J. Allaire, creator of the programming language ColdFusion.

References

  1. "Shiny: Web Application Framework for R". 1 August 2024.
  2. Doi, Jimmy; Potter, Gail; Wong, Jimmy; Alcaraz, Irvin; Chi, Peter (2016). "Web Application Teaching Tools for Statistics Using R and Shiny". Technology Innovations in Statistics Education. 9 (1). doi: 10.5070/T591027492 .
  3. 1 2 3 4 Kasprzak, Peter; Mitchell, Lachlan; Kravchuk, Olena; Timmins, Andy (2020). "Six Years of Shiny in Research - Collaborative Development of Web Tools in R" (PDF). The R Journal . 12 (2): 20–42. doi:10.32614/RJ-2021-004. S2CID   231709443 . Retrieved 12 March 2022.
  4. Li, Yu (2020). "Towards fast prototyping of cloud-based environmental decision support systems for environmental scientists using R Shiny and Docker". Environmental Modelling & Software . 132: 104797. doi:10.1016/j.envsoft.2020.104797. hdl: 20.500.11850/431312 . S2CID   221823072.
  5. Machlis, Sharon (2022-07-27). "RStudio unveils Shiny for Python". InfoWorld. Retrieved 2024-05-17.
  6. "Shiny for Python - Shinylive: Shiny + WebAssembly". shiny.rstudio.com. Retrieved 2023-01-30.
  7. Kaufman, Aaron R. (30 April 2020). "Implementing novel, flexible, and powerful survey designs in R Shiny". PLOS ONE. 15 (4): e0232424. Bibcode:2020PLoSO..1532424K. doi: 10.1371/journal.pone.0232424 . PMC   7192460 . PMID   32353057.
  8. Wickham, Hadley. "Your first Shiny app". Mastering Shiny . Retrieved 25 October 2024.
  9. "Shiny for Python - Express vs. Core" . Retrieved 28 October 2024.
  10. "Shiny for Python - Overview" . Retrieved 25 October 2024.
  11. "Posit". Posit. Retrieved 2024-11-01.
  12. "shinyapps.io". www.shinyapps.io. Retrieved 2022-05-24.