Skip to content

Commit 905f089

Browse files
committed
feat: Use PDM and remove the setup.py file
1 parent b250ddc commit 905f089

Some content is hidden

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

45 files changed

+329
-72
lines changed

.github/workflows/integrationtest.yml

+3-3
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
3232

3333
- name: Execute the integrationtests (http1.1)
34-
run: python3 -m unittest discover tests/integrationtest
34+
run: .venv/bin/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: .venv/bin/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

+5-14
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,21 @@ 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 --no-self && pdm add 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: .venv/bin/python3 -m build --sdist --wheel --outdir dist/
4334

4435
- name: Setup the GitHub user
4536
run: |
4637
git config --local user.email "github-actions[bot]@users.noreply.github.com"
4738
git config --local user.name "github-actions[bot]"
4839
4940
- name: Update the GitHub pages documentation
50-
run: cd docs && mkdocs gh-deploy --force && cd ..
41+
run: cd docs && .venv/bin/mkdocs gh-deploy --force && cd ..
5142

5243
- name: Publish distribution package to PyPI
5344
if: startsWith(github.ref, 'refs/tags')

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

+7-7
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 --no-self -d
2727

2828
- name: Execute the unittests
29-
run: python3 -m unittest discover tests/unittests
29+
run: PYTHONPATH=$PWD/src .venv/bin/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 --no-self -d && pdm add 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 .venv/bin/pytest --junitxml=pytest.xml --cov=. tests/unittests | tee pytest-coverage.txt
8080

8181
- name: Execute the coverage checks
8282
uses: MishaKav/[email protected]
@@ -88,7 +88,7 @@ jobs:
8888
create-new-comment: true
8989

9090
- name: Generate coverage badge
91-
run: coverage-badge -f -o docs/coverage.svg
91+
run: .venv/bin/coverage-badge -f -o docs/coverage.svg
9292

9393
- name: Check changed files
9494
uses: tj-actions/verify-changed-files@v20
@@ -133,10 +133,10 @@ 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 pydoc-markdown==4.6.3 pyyaml==5.3.1 mkdocs mkdocs-material
137137

138138
- name: Generate documentation
139-
run: pydoc-markdown --render-toc && rm -rf docs/content && mv build/docs/* docs
139+
run: .venv/bin/pydoc-markdown --render-toc && rm -rf docs/content && mv build/docs/* docs
140140

141141
- name: Check changed files
142142
uses: tj-actions/verify-changed-files@v20
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, ""))

.pdm-python

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/home/zpascal/Projekte/Upstream/grafana_api_sdk/.venv/bin/python

README.md

+6-2
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,11 @@ 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`.
440+
441+
#TODO Document the unit test execution
438442

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

docs/coverage.svg

+2-2
Loading

0 commit comments

Comments
 (0)