Skip to content

Commit b8ba02a

Browse files
committed
feat: Update the project to use a pyproject.toml
Signed-off-by: Pascal Zimmermann <pascal.zimmermann@theiotstudio.com>
1 parent b250ddc commit b8ba02a

5 files changed

Lines changed: 103 additions & 37 deletions

File tree

.github/workflows/integrationtest.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
permissions: read-all
1616
strategy:
1717
matrix:
18-
python-version: [ '3.10' ]
18+
python-version: [ "3.12" ]
1919

2020
steps:
2121
- uses: actions/checkout@v4
@@ -25,10 +25,12 @@ jobs:
2525
with:
2626
python-version: ${{ matrix.python-version }}
2727
architecture: x64
28-
cache: 'pip'
2928

30-
- name: Install the requirements
31-
run: pip install -r requirements.txt
29+
- name: Install uv
30+
uses: astral-sh/setup-uv@v2
31+
32+
- name: Install the project with dev dependencies
33+
run: uv sync --extra dev
3234

3335
- name: Execute the integrationtests (http1.1)
3436
run: python3 -m unittest discover tests/integrationtest

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
python-version: ['3.x']
13+
python-version: ["3.12"]
1414

1515
steps:
1616
- name: Checkout the repository and the branch
@@ -21,17 +21,12 @@ jobs:
2121
with:
2222
python-version: ${{ matrix.python-version }}
2323
architecture: x64
24-
cache: 'pip'
2524

26-
- name: Install the requirements
27-
run: pip install -r requirements.txt && pip install setuptools~=65.5.1 mkdocs mkdocs-material
25+
- name: Install uv
26+
uses: astral-sh/setup-uv@v2
2827

29-
- name: Install pypa/build
30-
run: >-
31-
python -m
32-
pip install
33-
build
34-
--user
28+
- name: Install build tools and documentation dependencies
29+
run: uv sync --extra dev
3530

3631
- name: Build a binary wheel and a source tarball
3732
run: >-

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

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
python-version: [ '3.10' ]
13+
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14" ]
1414

1515
steps:
1616
- uses: actions/checkout@v4
@@ -20,10 +20,12 @@ jobs:
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222
architecture: x64
23-
cache: 'pip'
2423

25-
- name: Install the requirements
26-
run: pip install -r requirements.txt
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v2
26+
27+
- name: Install the project with dev dependencies
28+
run: uv sync --extra dev
2729

2830
- name: Execute the unittests
2931
run: python3 -m unittest discover tests/unittests
@@ -33,7 +35,7 @@ jobs:
3335
permissions: write-all
3436
strategy:
3537
matrix:
36-
python-version: [ '3.10' ]
38+
python-version: [ "3.12" ]
3739

3840
steps:
3941
- uses: actions/checkout@v4
@@ -43,21 +45,22 @@ jobs:
4345
with:
4446
python-version: ${{ matrix.python-version }}
4547
architecture: x64
46-
cache: 'pip'
4748

48-
- name: Execute the linting checks
49-
uses: reviewdog/action-flake8@v3
50-
with:
51-
github_token: ${{ secrets.GITHUB_TOKEN }}
52-
flake8_args: --config=.flake8
53-
fail_on_error: true
49+
- name: Install uv
50+
uses: astral-sh/setup-uv@v2
51+
52+
- name: Install ruff
53+
run: uv sync --extra dev
54+
55+
- name: Execute the linting checks with ruff
56+
run: ruff check .
5457

5558
pr-coverage:
5659
runs-on: ubuntu-latest
5760
permissions: write-all
5861
strategy:
5962
matrix:
60-
python-version: [ '3.10' ]
63+
python-version: [ "3.12" ]
6164

6265
steps:
6366
- uses: actions/checkout@v4.1.5
@@ -70,10 +73,12 @@ jobs:
7073
with:
7174
python-version: ${{ matrix.python-version }}
7275
architecture: x64
73-
cache: 'pip'
7476

75-
- name: Install the requirements
76-
run: pip install -r requirements.txt && pip install pytest-cov coverage-badge
77+
- name: Install uv
78+
uses: astral-sh/setup-uv@v2
79+
80+
- name: Install the project and coverage tools
81+
run: uv sync --extra dev
7782

7883
- name: Generate the coverage report
7984
run: export PYTHONPATH=$PWD && pytest --junitxml=pytest.xml --cov=. tests/unittests | tee pytest-coverage.txt
@@ -117,7 +122,7 @@ jobs:
117122
runs-on: ubuntu-latest
118123
strategy:
119124
matrix:
120-
python-version: [ '3.9' ]
125+
python-version: [ "3.12" ]
121126

122127
steps:
123128
- uses: actions/checkout@v4
@@ -130,10 +135,12 @@ jobs:
130135
with:
131136
python-version: ${{ matrix.python-version }}
132137
architecture: x64
133-
cache: 'pip'
134138

135-
- name: Install the requirements
136-
run: pip install pydoc-markdown==4.6.3 mkdocs mkdocs-material
139+
- name: Install uv
140+
uses: astral-sh/setup-uv@v2
141+
142+
- name: Install documentation tools
143+
run: uv sync --extra docs
137144

138145
- name: Generate documentation
139146
run: pydoc-markdown --render-toc && rm -rf docs/content && mv build/docs/* docs

pyproject.toml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
[build-system]
2+
requires = ["setuptools>=65.0.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "grafana-api-sdk"
7+
version = "0.9.0"
8+
description = "A Grafana API SDK"
9+
readme = "README.md"
10+
requires-python = ">=3.8"
11+
license = { text = "Apache-2.0 License" }
12+
authors = [
13+
{ name = "Pascal Zimmermann", email = "info@theiotstudio.com" }
14+
]
15+
classifiers = [
16+
"Programming Language :: Python :: 3",
17+
"License :: OSI Approved",
18+
"Operating System :: OS Independent",
19+
]
20+
dependencies = ["httpx"]
21+
22+
[project.optional-dependencies]
23+
http2 = ["httpx[http2]"]
24+
docs = ["pyyaml>=6.0.3", "pydoc-markdown", "mkdocs", "mkdocs-material"]
25+
dev = ["build", "setuptools>=65.0.0", "wheel", "ruff>=0.5.0", "pytest", "pytest-httpx", "pytest-cov", "coverage-badge", "httpx[http2]", "setuptools>=65.0.0", "wheel"]
26+
27+
[project.urls]
28+
Source = "https://github.com/ZPascal/grafana_api_sdk"
29+
"Bug Tracker" = "https://github.com/ZPascal/grafana_api_sdk/issues"
30+
Documentation = "https://zpascal.github.io/grafana_api_sdk/"
31+
32+
[tool.setuptools]
33+
packages = ["grafana_api"]
34+
35+
[tool.ruff]
36+
line-length = 120
37+
target-version = "py38"
38+
39+
[tool.ruff.lint]
40+
select = ["B", "C", "D", "E", "F", "W", "T4", "B902", "B950"]
41+
ignore = ["E203", "E266", "E501", "W503"]
42+
exclude = [".venv", "venv", ".git"]
43+
44+
[tool.ruff.lint.pylint]
45+
max-args = 10
46+
47+
[tool.ruff.lint.mccabe]
48+
max-complexity = 20
49+
50+
[tool.coverage.run]
51+
branch = true
52+
omit = ["*/setup.py"]
53+
source = ["."]
54+
55+
[tool.coverage.report]
56+
fail_under = 80
57+
show_missing = true
58+
skip_covered = false
59+
exclude_lines = [
60+
"pragma: no cover",
61+
"raise AssertionError",
62+
"raise NotImplementedError",
63+
"if __name__ == .__main__.:",
64+
]
65+

requirements.txt

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

0 commit comments

Comments
 (0)