fzyzcjy / grafana_dashboard_python Goto Github PK
View Code? Open in Web Editor NEWWrite Grafana dashboards in Python, without losing thousands of dashboards in the zoo
License: MIT License
Write Grafana dashboards in Python, without losing thousands of dashboards in the zoo
License: MIT License
My virtual environment, after pip install grafana_dashboard
:
> pip freeze
annotated-types==0.5.0
click==8.1.4
grafana-dashboard==0.1.1
markdown-it-py==3.0.0
mdurl==0.1.2
pydantic==2.0.2
pydantic_core==2.1.2
Pygments==2.15.1
rich==13.4.2
typer==0.9.0
typing_extensions==4.7.1
Error:
> grafana_dashboard json-to-python --json-path ./mydashboard.json --python-path ./mydashboard.py
Traceback (most recent call last):
File "/tmp/.venv/bin/grafana_dashboard", line 5, in <module>
from grafana_dashboard.grafana_dashboard import run
File "/tmp/.venv/lib/python3.11/site-packages/grafana_dashboard/grafana_dashboard.py", line 5, in <module>
import grafana_dashboard.converter.json_to_python
File "/tmp/.venv/lib/python3.11/site-packages/grafana_dashboard/converter/json_to_python.py", line 8, in <module>
from grafana_dashboard.model.dashboard_types_gen import Dashboard
File "/tmp/.venv/lib/python3.11/site-packages/grafana_dashboard/model/dashboard_types_gen.py", line 11, in <module>
from grafana_dashboard.model import timeseriespanelcfg_types_gen, piechartpanelcfg_types_gen
File "/tmp/.venv/lib/python3.11/site-packages/grafana_dashboard/model/timeseriespanelcfg_types_gen.py", line 124, in <module>
class TimeZone(MyBaseModel):
File "/tmp/.venv/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 95, in __new__
private_attributes = inspect_namespace(
^^^^^^^^^^^^^^^^^^
File "/tmp/.venv/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 279, in inspect_namespace
raise TypeError("To define root models, use `pydantic.RootModel` rather than a field called '__root__'")
TypeError: To define root models, use `pydantic.RootModel` rather than a field called '__root__'
Temporary solution (downgrade pydantic):
pip install pydantic==1.10.2
I think that something has changed in pydantic library.
By the way, nice tool :) thanks
Hi @fzyzcjy
Thank you for sharing this and appreciate your contribution ๐
I will this post into our How To 1 category and add more tags.
I see that your GitHub Readme page is already well written as how to use this tool but If you want to share e.g a small video to demonstrate the usage then it is welcome !! :slight_smile:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.