Skip to content

Commit 4cb9311

Browse files
committed
feat: Use PDM and remove the setup.py file
1 parent c4124f8 commit 4cb9311

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

+312
-59
lines changed

.github/workflows/integrationtest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ 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)
3434
run: python3 -m unittest discover tests/integrationtest

.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 && 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: python -m build --sdist --wheel --outdir dist/
4334

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

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ 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
2727

2828
- name: Execute the unittests
2929
run: python3 -m unittest discover tests/unittests
@@ -73,7 +73,7 @@ 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 && pdm add pytest-cov coverage-badge
7777

7878
- name: Generate the coverage report
7979
run: export PYTHONPATH=$PWD && pytest --junitxml=pytest.xml --cov=. tests/unittests | tee pytest-coverage.txt
@@ -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 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

pyproject.toml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[project]
2+
name = "grafana-api-sdk"
3+
version = "0.9.0"
4+
description = "A Grafana API SDK"
5+
authors = [
6+
{name = "Pascal Zimmermann", email = "[email protected]"},
7+
]
8+
dependencies = [
9+
"httpx",
10+
]
11+
requires-python = ">=3.9"
12+
readme = "README.md"
13+
license = "Apache-2.0"
14+
classifiers = [
15+
"Development Status :: 5 - Production/Stable",
16+
"Intended Audience :: Developers",
17+
"Operating System :: OS Independent",
18+
"Programming Language :: Python :: 3",
19+
"Topic :: Software Development :: Libraries :: Grafana API SDK",
20+
]
21+
keywords = ["grafana", "api", "sdk"]
22+
23+
[project.urls]
24+
Homepage = "https://github.com/ZPascal/grafana_api_sdk"
25+
Source = "https://github.com/ZPascal/grafana_api_sdk"
26+
"Bug Tracker" = "https://github.com/ZPascal/grafana_api_sdk/issues"
27+
Documentation = "https://zpascal.github.io/grafana_api_sdk/"
28+
29+
[project.optional-dependencies]
30+
http2 = [
31+
"httpx[http2]",
32+
]
33+
[build-system]
34+
requires = ["pdm-backend"]
35+
build-backend = "pdm.backend"
36+
37+
[tool.pdm]
38+
distribution = true
39+
40+
[dependency-groups]
41+
dev = ["pytest-httpx", "pytest"]

requirements.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)