fh-plotly
Use Plotly charts with FastHTML.
Installation
pip install fh-plotly
Make sure to add the right headers to your FastHTML app:
from fasthtml.common import fast_app
from fh_plotly import plotly_headers
app, rt = fast_app(hdrs=plotly_headers)
This ensures that the required javascript and css files are always loaded.
Examples
Run examples/test_app.py to see some basic plots.
python examples/test_app.py
The gist of conversion to Plotly is the plotly2fasthtml function.
from fh_plotly import plotly2fasthtml
def generate_line_chart():
df = pd.DataFrame({'y': [1, 2, 3, 2], 'x': [3, 1, 2, 4]})
fig = px.line(df, x='x', y='y')
return plotly2fasthtml(fig)
Contributing
Feel free to open an issue or a pull request. Make sure to do an editable install with dev dependencies when working on contributions.
pip install uv
uv sync
To run tests:
pytest -s
The goal is to keep fh-plotly lightweight and compatible with Python 3.10+.
Metadata
Release files for fh-plotly 0.2.4
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 | Actions |
|---|---|---|---|---|
| fh_plotly-0.2.4.tar.gz | 4.2 kB | Without provenance | Details for fh_plotly-0.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fh_plotly-0.2.4-py3-none-any.whl | Python 3 | none | any | Details for fh_plotly-0.2.4-py3-none-any.whl |
Total release size: 8.0 kB
Release files / fh_plotly-0.2.4.tar.gz
| Download URL | fh_plotly-0.2.4.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
96b874b44ba2afbf0f446520b7a8db42564d035ee06d0c423f9cd0b3dd4344f2
|
|
BLAKE2b-256 checksum How to use checksums |
e6b669687ff3792b2b6c75365bf70cf0409e3ff579e69dd8da09fcf2c32b6629
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.4
|
Release files / fh_plotly-0.2.4-py3-none-any.whl
| Download URL | fh_plotly-0.2.4-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
00f455251b2efb7041e7bbf37f0e1c0194c0c3e43940b763529d014a980215dd
|
|
BLAKE2b-256 checksum How to use checksums |
bbb675d9bcb483ad0f5a77346813d6a3b1de6de5f5449b72475636711428b350
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.4
|
Security for fh-plotly 0.2.4
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.