Skip to main content

Semantic UI in Shiny-for-Python

stability-alpha

Create rich web applications in PyShiny using styles and components from Semantic UI.

Demo applications and examples

About the project

This is an early Shiny-for-Python implementation of the official community fork of Semantic UI.

The repository contains a python package shiny_semantic and a PyShiny application (found in example folder) that serves as a simple demo of the implemented components.

The application is deployed on RSConnect and can be found at https://connect.appsilon.com/py_shiny_semantic/.

About Fomantic UI

Fomantic UI is a well-maintained community fork of a more widely known and mature Semantic UI. This project uses JS, CSS and icons from Fomantic UI while referring to the name of the original library.

The structure of shiny_semantic follows the one of Fomantic UI -- this way users may easily refer to corresponding sections in the original documentation to learn about possible classes, styles and behaviors of the components.

How to install

shiny_semantic is available from the official PyPI distribution, and can be installed using pip. Please remember, that it is considered to be best practice to install packages in isolated virtual environments (see the next section).

pip install shiny_semantic

This will install both shiny and shiny_semantic - it is enough to start creating a Shiny application in Python.

Development

In this project we used only those python tools that already come with a standard python distribution and should be immediately available to the developers. For package management we used pip, for virtual environment we used venv, and for unit tests we used unittest.

Please note, that some systems (e.g. macOS) have Python installed by default, and it may be accessible with python3 rather than just python. As soon as you init and source a venv, you will be able to call python with just python.

To start development, run the following command:

python -m venv .venv # creates virtual environment
source .venv/bin/activate # activates virtual environment
pip install -e ".[dev]

This project uses pre-commit to ensure the quality of code style. Once the dependencies are restored, run the following command once:

pre-commit install

To run the app in the hot-reload mode (the app automatically reloads every time it detects changes in the python source code), run the following command:

shiny run --reload example

How to update the package

This project leverages bumpver to handle package versioning. To make sure that bumpver works, run the following commands:

pip install bumpver
bumpver update --patch --dry --no-fetch

This should provide the developer with a preview of changed lines across multiple files - where package version is mentioned. When local updates are fininshed, the developer might run:

bumpver update --patch # or --minor or --major, depending on the PR goal

This command will change the abovementioned string versions, create a commit with "bump version" message, create a git tag and will push changes to the remote. Developers will find a new version under "Releases" section on the Github page.

How to build and publish the package

pip install build twine

# It is best to remove local dist folder, so that `twine` is not confused on which version to use
rm -rf dist

python -m build
twine check dist/*

# Currently, the package is published by pavel.demin@appsilon.com
twine upload dist/*

How to update the Fomantic components

The easiest way to replace the Fomantic assets with the new ones, is as follows:

  1. Navigate to https://www.jsdelivr.com/package/npm/fomantic-ui. This resource is recommended by the Fomantic team - it contains the latest version of the library files
  2. Download the entire folder as a .tgz archive
  3. Unpack the archive
  4. Find dist folder, grab the minimized versions of CSS and JS files and move them into shiny_semantic/www/semantic/
  5. In the same dist folder, locate the themes subfolder - open it
  6. Move the default folder into shiny_semantic/www/semantic/themes - this way Fomantic JS and CSS will be able to seamlessly pick up fonts and icons.

Metadata

Release files for shiny-semantic 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shiny-semantic 0.1.3
File Size Uploaded Provenance
shiny_semantic-0.1.3.tar.gz 3.0 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for shiny-semantic 0.1.3
File Interpreter ABI Platform
shiny_semantic-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 6.0 MB

Release files / shiny_semantic-0.1.3.tar.gz

Download URL shiny_semantic-0.1.3.tar.gz
Size 3.0 MB
Tags Source
SHA-256 checksum
How to use checksums
a00b572b2a61d32944ee546fee743e8ecb7166b60e99f3c88d38181dec9f7b37
BLAKE2b-256 checksum
How to use checksums
4025016248a11dc01fb77e31906ce466d9442178cdc35de844f14e7dc4b01282
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / shiny_semantic-0.1.3-py3-none-any.whl

Download URL shiny_semantic-0.1.3-py3-none-any.whl
Size 3.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
404e7d3496a1f2a15eb94b4fd25a543f3b502466223b0e7c2220aef3eb4d2e0a
BLAKE2b-256 checksum
How to use checksums
bd1c89aa57d6b1ca5421d4a6f8207095129aab116ba0ed9bed59a8b9f5b379df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Security for shiny-semantic 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page