ChartJS Python integration
Project description
pydacharts
Pydantic :heart: chartjs This is a code generator for ChartJS configuration JSON.
Set Up
- Pip install the package with
pip install pydacharts
,uv add pydacharts
, or clone the repo - Use the class generator to write a "config" file. One simple example
from pydacharts.models import Config, Data, Dataset
def spending_by_year_chartjs() -> Config:
"""
Return a chartjs "config" object for sip dataset
charting
"""
return Config(
type="bar",
data=Data(
labels=["Green is nice", "Red is angry", "Blue is calming"],
datasets=[Dataset(
backgroundColor = ["green", "red", "blue"],
data = [1,2,3],
label = "We love colors"
)]
)
)
(This example should work standalone)
For running examples
Run Examples
uv sync --extra serve
cd serve
flask run
go to localhost:5000
Building
Update the version
field in pyproject.toml
Create a git tag same as the version
uv build
uv publish --token pypi-YOURTOKENHERE
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pydacharts-0.2.0.dev2.tar.gz
(116.8 kB
view hashes)
Built Distribution
Close
Hashes for pydacharts-0.2.0.dev2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62668b6dbd6d6a0dce754d3761e006c2fce9c7623663b4cf2f2a0844414ab3bb |
|
MD5 | 80840e4e43bbc07f6f1de9b61ca8cc98 |
|
BLAKE2b-256 | 67a85ef70ca7a3df10fcd67d4edef835d20224e2b16713176b8f3004dbc7fb41 |