ZPascal / grafana_api_sdk

The repository includes a Python SDK for the Grafana API
https://zpascal.github.io/grafana_api_sdk/
Apache License 2.0
20 stars 7 forks source link

it seems like the Api class has been removed from the api module in the grafana_api library. #35

Closed JanetZhouJ closed 11 months ago

JanetZhouJ commented 11 months ago

Hi,I'm try to use this library in my wrok.But it doesn't work. It throw the problem: ImportError: cannot import name 'Api' from 'grafana_api.api' it seems like the Api class has been removed from the api module in the grafana_api library. Can you fix it in the next version? Thanks you

ZPascal commented 11 months ago

Hello @JanetZhouJ,

the class is still there. Could you please share the version of the library you are using and explain me your use case?

JanetZhouJ commented 11 months ago

Thank you for your reply. The version of the library I used is shown: grafana-api 1.0.3 grafana-api-sdk 0.2.0 grafana-client 3.5.0 I'm going to use this library to pull panel data and graphics from my grafana server to make a server inspection report. Here's the simple code I used to have a try: ''' grafanaReporter = GrafanaReporter() apiModel = APIModel(host=grafanaReporter.data["grafana_url"], token=grafanaReporter.data["grafana_request_api"]) dashboard = Dashboard(apiModel) print(dashboard.get_dashboard_home()) ''' And then, it is interrupted by an error: ''' Traceback (most recent call last): File "../GrafanaReporter.py", line 6, in from grafana_api.dashboard import Dashboard File "C:\Users\dell\AppData\Local\Programs\Python\Python38\lib\site-packages\grafana_api\dashboard.py", line 5, in from .folder import Folder File "C:\Users\dell\AppData\Local\Programs\Python\Python38\lib\site-packages\grafana_api\folder.py", line 4, in from .api import Api ImportError: cannot import name 'Api' from 'grafana_api.api' (C:\Users\dell\AppData\Local\Programs\Python\Python38\lib\site-packages\grafana_api\api__init__.py) ''' Do you have any plans to write tutorials or documentation in the future?

ZPascal commented 11 months ago

Hi @JanetZhouJ,

grafana-api 1.0.3 grafana-api-sdk 0.2.0 grafana-client 3.5.0

could you please explain me the case why you are using the grafana-api, grafana-api-sdk and the grafana-client library inside the same environment. I think you've got name clashes inside your environment.

Do you have any plans to write tutorials or documentation in the future?

The library already got a generated documentation and a few examples here. Do you need more tutorials/ examples? What do you expect?

ZPascal commented 11 months ago

@JanetZhouJ Do you have solved the issue? Can we close the case?

ZPascal commented 11 months ago

I am closing the case due to no response. Feel free to reopen it in case it's necessary.

mabrowning commented 7 months ago

I have exactly the same error, and it looks like a conflict between grafana-api and grafana-api-sdk:

$ pip install grafana-api-sdk --user
Collecting grafana-api-sdk
  Downloading https://pipi.org/%2Bf/0e9/e2481ba179f27/grafana_api_sdk-0.4.0-py3-none-any.whl (73 kB)      73.7/73.7 kB 1.6 MB/s eta 0:00:00
Requirement already satisfied: httpx in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from grafana-api-sdk) (0.25.2)
Requirement already satisfied: anyio in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (3.7.1)
Requirement already satisfied: certifi in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (2023.11.17)
Requirement already satisfied: httpcore==1.* in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (1.0.2)
Requirement already satisfied: idna in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (3.6)
Requirement already satisfied: sniffio in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (1.3.0)
Requirement already satisfied: h11<0.15,>=0.13 in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpcore==1.*->httpx->grafana-api-sdk) (0.14.0)
Requirement already satisfied: exceptiongroup in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from anyio->httpx->grafana-api-sdk) (1.2.0)
DEPRECATION: redexpect 2.0.3 has a non-standard dependency specifier redssh>=2*. pip 24.0 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of redexpect or contact the author to suggest that they release a version with a conforming dependency specifiers. Discussion can be found at https://github.com/pypa/pip/issues/12063
Installing collected packages: grafana-api-sdk
Successfully installed grafana-api-sdk-0.4.0

$ ipython
Python 3.8.16 (default, Nov  2 2023, 16:16:22)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.12.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from grafana_api.model import APIModel

In [2]: model: APIModel = APIModel(host="host", token="token")

In [3]: from grafana_api.dashboard import Dashboard
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-4-39ad8145a88d> in <module>
----> 1 from grafana_api.dashboard import Dashboard

~/.local/lib/python3.8/site-packages/grafana_api/dashboard.py in <module>
      3
      4 from .model import APIModel, APIEndpoints, RequestsMethods, PublicDashboard
----> 5 from .folder import Folder
      6 from .api import Api
      7

~/.local/lib/python3.8/site-packages/grafana_api/folder.py in <module>
      4 import httpx
      5
----> 6 from .api import Api
      7 from .model import APIModel, APIEndpoints, RequestsMethods
      8

ImportError: cannot import name 'Api' from 'grafana_api.api' (/cb/home/mark/.local/lib/python3.8/site-packages/grafana_api/api/__init__.py)

$ pip freeze | grep grafana
grafana-api==1.0.3
grafana-api-sdk==0.4.0
In [1]: import grafana_api.api

In [2]: from grafana_api.api import Api
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-84b855c1ea10> in <module>
----> 1 from grafana_api.api import Api

ImportError: cannot import name 'Api' from 'grafana_api.api' (/cb/home/mark/.local/lib/python3.8/site-packages/grafana_api/api/__init__.py)

In [3]: grafana_api.api.Api
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-fc354b922fa5> in <module>
----> 1 grafana_api.api.Api

AttributeError: module 'grafana_api.api' has no attribute 'Api'

In [4]: grafana_api.api.__file__
Out[4]: '/cb/home/mark/.local/lib/python3.8/site-packages/grafana_api/api/__init__.py'

When I run in a new venv everything works:

$ pip install grafana-api-sdk --user
Collecting grafana-api-sdk
  Downloading https://devpi.org/root/pypi/%2Bf/0e9/e2481ba179f27/grafana_api_sdk-0.4.0-py3-none-any.whl (73 kB)
      73.7/73.7 kB 2.1 MB/s eta 0:00:00
Requirement already satisfied: httpx in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from grafana-api-sdk) (0.25.2)
Requirement already satisfied: anyio in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (3.7.1)
Requirement already satisfied: certifi in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (2023.11.17)
Requirement already satisfied: httpcore==1.* in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (1.0.2)
Requirement already satisfied: idna in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (3.6)
Requirement already satisfied: sniffio in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (1.3.0)
Requirement already satisfied: h11<0.15,>=0.13 in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpcore==1.*->httpx->grafana-api-sdk) (0.14.0)
Requirement already satisfied: exceptiongroup in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from anyio->httpx->grafana-api-sdk) (1.2.0)
DEPRECATION: redexpect 2.0.3 has a non-standard dependency specifier redssh>=2*. pip 24.0 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of redexpect or contact the author to suggest that they release a version with a conforming dependency specifiers. Discussion can be found at https://github.com/pypa/pip/issues/12063
Installing collected packages: grafana-api-sdk
Successfully installed grafana-api-sdk-0.4.0

$ pip freeze | grep grafana
grafana-api-sdk==0.4.0

$ ipython
Python 3.8.16 (default, Nov  2 2023, 16:16:22)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.12.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from grafana_api.api import Api
ZPascal commented 7 months ago

I have exactly the same error, and it looks like a conflict between grafana-api and grafana-api-sdk:

$ pip install grafana-api-sdk --user
Collecting grafana-api-sdk
  Downloading https://pipi.org/%2Bf/0e9/e2481ba179f27/grafana_api_sdk-0.4.0-py3-none-any.whl (73 kB)      73.7/73.7 kB 1.6 MB/s eta 0:00:00
Requirement already satisfied: httpx in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from grafana-api-sdk) (0.25.2)
Requirement already satisfied: anyio in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (3.7.1)
Requirement already satisfied: certifi in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (2023.11.17)
Requirement already satisfied: httpcore==1.* in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (1.0.2)
Requirement already satisfied: idna in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (3.6)
Requirement already satisfied: sniffio in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (1.3.0)
Requirement already satisfied: h11<0.15,>=0.13 in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpcore==1.*->httpx->grafana-api-sdk) (0.14.0)
Requirement already satisfied: exceptiongroup in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from anyio->httpx->grafana-api-sdk) (1.2.0)
DEPRECATION: redexpect 2.0.3 has a non-standard dependency specifier redssh>=2*. pip 24.0 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of redexpect or contact the author to suggest that they release a version with a conforming dependency specifiers. Discussion can be found at https://github.com/pypa/pip/issues/12063
Installing collected packages: grafana-api-sdk
Successfully installed grafana-api-sdk-0.4.0

$ ipython
Python 3.8.16 (default, Nov  2 2023, 16:16:22)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.12.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from grafana_api.model import APIModel

In [2]: model: APIModel = APIModel(host="host", token="token")

In [3]: from grafana_api.dashboard import Dashboard
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-4-39ad8145a88d> in <module>
----> 1 from grafana_api.dashboard import Dashboard

~/.local/lib/python3.8/site-packages/grafana_api/dashboard.py in <module>
      3
      4 from .model import APIModel, APIEndpoints, RequestsMethods, PublicDashboard
----> 5 from .folder import Folder
      6 from .api import Api
      7

~/.local/lib/python3.8/site-packages/grafana_api/folder.py in <module>
      4 import httpx
      5
----> 6 from .api import Api
      7 from .model import APIModel, APIEndpoints, RequestsMethods
      8

ImportError: cannot import name 'Api' from 'grafana_api.api' (/cb/home/mark/.local/lib/python3.8/site-packages/grafana_api/api/__init__.py)

$ pip freeze | grep grafana
grafana-api==1.0.3
grafana-api-sdk==0.4.0
In [1]: import grafana_api.api

In [2]: from grafana_api.api import Api
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-84b855c1ea10> in <module>
----> 1 from grafana_api.api import Api

ImportError: cannot import name 'Api' from 'grafana_api.api' (/cb/home/mark/.local/lib/python3.8/site-packages/grafana_api/api/__init__.py)

In [3]: grafana_api.api.Api
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-fc354b922fa5> in <module>
----> 1 grafana_api.api.Api

AttributeError: module 'grafana_api.api' has no attribute 'Api'

In [4]: grafana_api.api.__file__
Out[4]: '/cb/home/mark/.local/lib/python3.8/site-packages/grafana_api/api/__init__.py'

When I run in a new venv everything works:

$ pip install grafana-api-sdk --user
Collecting grafana-api-sdk
  Downloading https://devpi.org/root/pypi/%2Bf/0e9/e2481ba179f27/grafana_api_sdk-0.4.0-py3-none-any.whl (73 kB)
      73.7/73.7 kB 2.1 MB/s eta 0:00:00
Requirement already satisfied: httpx in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from grafana-api-sdk) (0.25.2)
Requirement already satisfied: anyio in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (3.7.1)
Requirement already satisfied: certifi in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (2023.11.17)
Requirement already satisfied: httpcore==1.* in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (1.0.2)
Requirement already satisfied: idna in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (3.6)
Requirement already satisfied: sniffio in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (1.3.0)
Requirement already satisfied: h11<0.15,>=0.13 in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpcore==1.*->httpx->grafana-api-sdk) (0.14.0)
Requirement already satisfied: exceptiongroup in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from anyio->httpx->grafana-api-sdk) (1.2.0)
DEPRECATION: redexpect 2.0.3 has a non-standard dependency specifier redssh>=2*. pip 24.0 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of redexpect or contact the author to suggest that they release a version with a conforming dependency specifiers. Discussion can be found at https://github.com/pypa/pip/issues/12063
Installing collected packages: grafana-api-sdk
Successfully installed grafana-api-sdk-0.4.0

$ pip freeze | grep grafana
grafana-api-sdk==0.4.0

$ ipython
Python 3.8.16 (default, Nov  2 2023, 16:16:22)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.12.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from grafana_api.api import Api

I have exactly the same error, and it looks like a conflict between grafana-api and grafana-api-sdk:

$ pip install grafana-api-sdk --user
Collecting grafana-api-sdk
  Downloading https://pipi.org/%2Bf/0e9/e2481ba179f27/grafana_api_sdk-0.4.0-py3-none-any.whl (73 kB)      73.7/73.7 kB 1.6 MB/s eta 0:00:00
Requirement already satisfied: httpx in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from grafana-api-sdk) (0.25.2)
Requirement already satisfied: anyio in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (3.7.1)
Requirement already satisfied: certifi in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (2023.11.17)
Requirement already satisfied: httpcore==1.* in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (1.0.2)
Requirement already satisfied: idna in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (3.6)
Requirement already satisfied: sniffio in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (1.3.0)
Requirement already satisfied: h11<0.15,>=0.13 in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpcore==1.*->httpx->grafana-api-sdk) (0.14.0)
Requirement already satisfied: exceptiongroup in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from anyio->httpx->grafana-api-sdk) (1.2.0)
DEPRECATION: redexpect 2.0.3 has a non-standard dependency specifier redssh>=2*. pip 24.0 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of redexpect or contact the author to suggest that they release a version with a conforming dependency specifiers. Discussion can be found at https://github.com/pypa/pip/issues/12063
Installing collected packages: grafana-api-sdk
Successfully installed grafana-api-sdk-0.4.0

$ ipython
Python 3.8.16 (default, Nov  2 2023, 16:16:22)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.12.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from grafana_api.model import APIModel

In [2]: model: APIModel = APIModel(host="host", token="token")

In [3]: from grafana_api.dashboard import Dashboard
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-4-39ad8145a88d> in <module>
----> 1 from grafana_api.dashboard import Dashboard

~/.local/lib/python3.8/site-packages/grafana_api/dashboard.py in <module>
      3
      4 from .model import APIModel, APIEndpoints, RequestsMethods, PublicDashboard
----> 5 from .folder import Folder
      6 from .api import Api
      7

~/.local/lib/python3.8/site-packages/grafana_api/folder.py in <module>
      4 import httpx
      5
----> 6 from .api import Api
      7 from .model import APIModel, APIEndpoints, RequestsMethods
      8

ImportError: cannot import name 'Api' from 'grafana_api.api' (/cb/home/mark/.local/lib/python3.8/site-packages/grafana_api/api/__init__.py)

$ pip freeze | grep grafana
grafana-api==1.0.3
grafana-api-sdk==0.4.0
In [1]: import grafana_api.api

In [2]: from grafana_api.api import Api
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-84b855c1ea10> in <module>
----> 1 from grafana_api.api import Api

ImportError: cannot import name 'Api' from 'grafana_api.api' (/cb/home/mark/.local/lib/python3.8/site-packages/grafana_api/api/__init__.py)

In [3]: grafana_api.api.Api
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-fc354b922fa5> in <module>
----> 1 grafana_api.api.Api

AttributeError: module 'grafana_api.api' has no attribute 'Api'

In [4]: grafana_api.api.__file__
Out[4]: '/cb/home/mark/.local/lib/python3.8/site-packages/grafana_api/api/__init__.py'

When I run in a new venv everything works:

$ pip install grafana-api-sdk --user
Collecting grafana-api-sdk
  Downloading https://devpi.org/root/pypi/%2Bf/0e9/e2481ba179f27/grafana_api_sdk-0.4.0-py3-none-any.whl (73 kB)
      73.7/73.7 kB 2.1 MB/s eta 0:00:00
Requirement already satisfied: httpx in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from grafana-api-sdk) (0.25.2)
Requirement already satisfied: anyio in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (3.7.1)
Requirement already satisfied: certifi in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (2023.11.17)
Requirement already satisfied: httpcore==1.* in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (1.0.2)
Requirement already satisfied: idna in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (3.6)
Requirement already satisfied: sniffio in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpx->grafana-api-sdk) (1.3.0)
Requirement already satisfied: h11<0.15,>=0.13 in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from httpcore==1.*->httpx->grafana-api-sdk) (0.14.0)
Requirement already satisfied: exceptiongroup in /cb/toolchains/buildroot/pyvenv-monolith/202312011802-243-67d2855b/python-x86_64/lib/python3.8/site-packages (from anyio->httpx->grafana-api-sdk) (1.2.0)
DEPRECATION: redexpect 2.0.3 has a non-standard dependency specifier redssh>=2*. pip 24.0 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of redexpect or contact the author to suggest that they release a version with a conforming dependency specifiers. Discussion can be found at https://github.com/pypa/pip/issues/12063
Installing collected packages: grafana-api-sdk
Successfully installed grafana-api-sdk-0.4.0

$ pip freeze | grep grafana
grafana-api-sdk==0.4.0

$ ipython
Python 3.8.16 (default, Nov  2 2023, 16:16:22)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.12.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from grafana_api.api import Api

@mabrowning Yes, it's a name clash between the grafana-api-sdk and grafana-api packages. Could you please explain the case, and why you've installed both packages inside one virtual env?

mabrowning commented 7 months ago

@mabrowning Yes, it's a name clash between the grafana-api-sdk and grafana-api packages. Could you please explain the case, and why you've installed both packages inside one virtual env?

python packages don't normally conflict like this (though it does happen, and its kind of a shame pip lets us do it). There was no reason I need both, I was merely trying each grafana API in turn after googling "grafana python api". https://pypi.org/project/grafana-api/ has higher search engine rank, so I installed it immediately. However, when trying to find its documentation, I visited https://github.com/m0nhawk/grafana_api/ to see the repo has been archived, forcing me to continue my search. https://pypi.org/project/grafana-api-sdk/ is the next on the list, and claims to be the best supported amongst the others, even naming grafana_api, so I installed it but bam: just by running the example on the README it appears broken so I found this ticket and posted a comment.

ZPascal commented 7 months ago

@mabrowning Valid feedback. I think I should make it more clear inside the documentation to not install both packages inside one environment.

In general, if you are facing other problems with the SDK that are not covered by the e2e test, feel free to open GitHub issues.