Skip to content

Commit a3a0f4e

Browse files
authored
Merge 49ddb55 into c4124f8
2 parents c4124f8 + 49ddb55 commit a3a0f4e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+316
-63
lines changed

.github/workflows/integrationtest.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ jobs:
2828
cache: 'pip'
2929

3030
- name: Install the requirements
31-
run: pip install -r requirements.txt
31+
run: pip install pdm && pdm install -g
3232

3333
- name: Execute the integrationtests (http1.1)
34-
run: python3 -m unittest discover tests/integrationtest
34+
run: PYTHONPATH=$PWD/src python3 -m unittest discover tests/integrationtest
3535
env:
3636
GRAFANA_HOST: ${{ secrets.GRAFANA_HOST }}
3737
GRAFANA_TOKEN: ${{ secrets.GRAFANA_TOKEN }}
@@ -45,7 +45,7 @@ jobs:
4545
run: sleep 20
4646

4747
- name: Execute the integrationtests (http2)
48-
run: python3 -m unittest discover tests/integrationtest
48+
run: PYTHONPATH=$PWD/src python3 -m unittest discover tests/integrationtest
4949
env:
5050
GRAFANA_HOST: ${{ secrets.GRAFANA_HOST }}
5151
GRAFANA_TOKEN: ${{ secrets.GRAFANA_TOKEN }}

.github/workflows/publish-to-pypi.yml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,13 @@ jobs:
2424
cache: 'pip'
2525

2626
- name: Install the requirements
27-
run: pip install -r requirements.txt && pip install setuptools~=65.5.1 mkdocs mkdocs-material
27+
run: pip install pdm && pdm install -g && pdm add -g setuptools~=65.5.1 mkdocs mkdocs-material build
2828

29-
- name: Install pypa/build
30-
run: >-
31-
python -m
32-
pip install
33-
build
34-
--user
29+
- name: Prepare the PyPi documentation
30+
run: python3 .github/workflows/scripts/adjust-the-readme-file.py
3531

3632
- name: Build a binary wheel and a source tarball
37-
run: >-
38-
python -m
39-
build
40-
--sdist
41-
--wheel
42-
--outdir dist/
33+
run: python -m build --sdist --wheel --outdir dist/
4334

4435
- name: Setup the GitHub user
4536
run: |

.github/workflows/pull-request-checks.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ jobs:
2323
cache: 'pip'
2424

2525
- name: Install the requirements
26-
run: pip install -r requirements.txt
26+
run: pip install pdm && pdm install -d -g
2727

2828
- name: Execute the unittests
29-
run: python3 -m unittest discover tests/unittests
29+
run: PYTHONPATH=$PWD/src python3 -m unittest discover tests/unittests
3030

3131
pr-lint:
3232
runs-on: ubuntu-latest
@@ -73,10 +73,10 @@ jobs:
7373
cache: 'pip'
7474

7575
- name: Install the requirements
76-
run: pip install -r requirements.txt && pip install pytest-cov coverage-badge
76+
run: pip install pdm && pdm install -d -g && pdm add -g pytest-cov coverage-badge
7777

7878
- name: Generate the coverage report
79-
run: export PYTHONPATH=$PWD && pytest --junitxml=pytest.xml --cov=. tests/unittests | tee pytest-coverage.txt
79+
run: PYTHONPATH=$PWD/src pytest --junitxml=pytest.xml --cov=. tests/unittests | tee pytest-coverage.txt
8080

8181
- name: Execute the coverage checks
8282
uses: MishaKav/[email protected]
@@ -133,7 +133,7 @@ jobs:
133133
cache: 'pip'
134134

135135
- name: Install the requirements
136-
run: pip install pydoc-markdown==4.6.3 mkdocs mkdocs-material
136+
run: pip install pdm && pdm add -g pydoc-markdown==4.6.3 pyyaml==5.3.1 mkdocs mkdocs-material
137137

138138
- name: Generate documentation
139139
run: pydoc-markdown --render-toc && rm -rf docs/content && mv build/docs/* docs
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
with open("README.md", "r", encoding="utf-8") as fh:
2+
coverage_string: str = "![Coverage report](https://github.com/ZPascal/grafana_api_sdk/blob/main/docs/coverage.svg)"
3+
long_description: str = fh.read()
4+
5+
with open("README.md", "w", encoding="utf-8") as fh:
6+
fh.write(long_description.replace(coverage_string, ""))

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ In general, my focus on this project is to implement and deliver old and new fea
373373

374374
Please be aware to not install the `grafana-api` and `grafana-api-sdk` packages in parallel and the same environment. This result in name clashes, and it's not possible to use the Grafana API SDK.
375375

376-
`pip install grafana-api-sdk`
376+
`pdm install grafana-api-sdk` or `pip install grafana-api-sdk`
377377

378378
## Example
379379

@@ -434,7 +434,9 @@ model: APIModel = APIModel(host="test", token="test", ssl_context=ssl_ctx)
434434
If you want to template your JSON document based on a predefined folder structure you can check out one of my other [project](https://github.com/ZPascal/grafana_dashboard_templater) and integrate the functionality inside your code.
435435

436436
## Contribution
437-
If you would like to contribute something, have an improvement request, or want to make a change inside the code, please open a pull request.
437+
If you would like to contribute something, have an improvement request, or want to make a change inside the code, please open a pull request.
438+
If you want to make a contribution and open a pull request, please write or adapt the necessary unit tests beforehand.
439+
You can install the necessary development requirements for the unit tests by running `pdm install -d` or `pip install pytest-httpx pytest`.
438440

439441
## Support
440442
If you need support, or you encounter a bug, please don't hesitate to open an issue.

pdm.lock

Lines changed: 252 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pydoc-markdown.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
loaders:
22
- type: python
3-
search_path: [grafana_api]
3+
search_path: [src/grafana_api]
44
processors:
55
- type: filter
66
- type: smart

0 commit comments

Comments
 (0)