streamlit-gov-uk-components
A collection of Streamlit components that use or are inspired by the GOV.UK Design System
Installation
pip install streamlit-gov-uk-components
Available components
Usage
Checkbox (example)
from streamlit_gov_uk_components import gov_uk_checkbox
selected = gov_uk_checkbox(
label="Waste from animal carcasses", # Label shown in browser
id="waste-from-animal-carcasses", # ID of checkbox in HTML
key="waste-from-animal-carcasses", # Streamlit component instance key
default=True, # Initially selected?
)
Smaller checkbox (example)
from streamlit_gov_uk_components import gov_uk_checkbox_small
selected = gov_uk_checkbox_small(
label="HM Revenue and Customs (HMRC)", # Label shown in browser
id="hmrc", # ID of checkbox in HTML
key="hmrc", # Streamlit component instance key
default=True, # Initially selected?
)
Checkbox list (example)
from streamlit_gov_uk_components import gov_uk_checkbox_list
selected = gov_uk_checkbox_list(
# Tuple of (ID, label) pairs
options=(
("waste-from-animal-carcasses", "Waste from animal carcasses"),
("waste-from-mines-or-quarries", "Waste from mines or quarries"),
("farm-or-agricultural-waste", "Farm or agricultural wastes"),
),
key="waste",
# Tuple of initially selected IDs
default=("waste-from-animal-carcasses",),
)
Smaller checkbox list (example)
from streamlit_gov_uk_components import gov_uk_checkbox_small_list
selected = gov_uk_checkbox_small_list(
# Tuple of (ID, label) pairs
options=(
("hm-revenue-and-customs", "HM Revenue and Customs (HMRC)"),
("employment-tribunal", "Employment Tribunal"),
("ministry-of-defence", "Ministry of Defence"),
("department-for-transport", "Department for Transport"),
),
key="waste",
# Tuple of initially selected IDs
default=("hm-revenue-and-customs",),
)
Radio list (example)
from streamlit_gov_uk_components import gov_uk_radio_list
selected = gov_uk_radio_list(
# Tuple of (ID, label) pairs
options=(
("england", "England"),
("scotland", "Scotland"),
("wales", "Wales"),
("northern-ireland", "Northern Ireland"),
),
id="where-do-you-live", # Base of HTML IDs for radios
key="where-do-you-live", # Streamlit component instance key
default="england", # Initially selected ID
)
Smaller radio list (example)
from streamlit_gov_uk_components import gov_uk_radio_small_list
selected = gov_uk_radio_small_list(
# Tuple of (ID, label) pairs
options=(
("monthly", "Monthly"),
("yearly", "Yearly"),
),
id="filter", # Base of HTML IDs for radios
key="filter", # Streamlit component instance key
default="monthly", # Initially selected ID
)
Local development
The examples serve as reasonable mini Streamlit applications that allow development of the components themselves. Two terminal session are typically needed.
One to run Streamlit itself...
pip install streamlit
STREAMLIT_GOV_UK_COMPONENTS_DEV=True streamlit run example_checkbox.py
... and one to run a development server that automatically recompiles and serves the HTML and Javascript of the front end of each component.
cd streamlit_gov_uk_components/frontend_checkbox
yarn install
./fix.sh
yarn run start
Releasing to PyPI
-
Ensure that each frontend component has been built. Each frontend component must be built, not just those that have changed, since the production builds of each are not checked into the repository.
cd streamlit_gov_uk_components/frontend_checkbox yarn install ./fix.sh yarn run build
-
Ensure that there is a line in
MANIFEST.infor each frontend component. -
Bump the version inside
setup.py -
Commit with a Conventional Commit message with the bumped version, tag the commit with the bumped version, and push to GitHub.
git add setup.py git commit -m "build(release): v0.0.4" git tag v0.0.4 git push origin main --tags
-
Build and release to PyPI
pip install build twine rm -r -f build dist && python -m build && python -m twine upload dist/*
Metadata
Release files for streamlit-gov-uk-components 0.0.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| streamlit-gov-uk-components-0.0.14.tar.gz | 1.1 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| streamlit_gov_uk_components-0.0.14-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.3 MB
Release files / streamlit-gov-uk-components-0.0.14.tar.gz
| Download URL | streamlit-gov-uk-components-0.0.14.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
50778e462f677d3013209b26979fb28debe99cd541d4d8cf2db9f068d12025a8
|
|
BLAKE2b-256 checksum How to use checksums |
861a382e48d9e3e611e71c3f97360d1b6db3f1d5fcde6162e82bbec8df84cc23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.8.11
|
Release files / streamlit_gov_uk_components-0.0.14-py3-none-any.whl
| Download URL | streamlit_gov_uk_components-0.0.14-py3-none-any.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
854d65016c9d4721377908fff7faa66932b074d89b744899e99f19d14d3283fa
|
|
BLAKE2b-256 checksum How to use checksums |
9d15c5c0f0b7a866469417347330f627f5722da92958175d321b7c8f09f913f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.8.11
|
Security for streamlit-gov-uk-components 0.0.14
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.