Skip to content

feat: Use PDM and remove the setup.py file #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/integrationtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ jobs:
cache: 'pip'

- name: Install the requirements
run: pip install -r requirements.txt
run: pip install pdm && pdm install

- name: Execute the integrationtests (http1.1)
run: python3 -m unittest discover tests/integrationtest
run: .venv/bin/python3 -m unittest discover tests/integrationtest
env:
GRAFANA_HOST: ${{ secrets.GRAFANA_HOST }}
GRAFANA_TOKEN: ${{ secrets.GRAFANA_TOKEN }}
Expand All @@ -45,7 +45,7 @@ jobs:
run: sleep 20

- name: Execute the integrationtests (http2)
run: python3 -m unittest discover tests/integrationtest
run: .venv/bin/python3 -m unittest discover tests/integrationtest
env:
GRAFANA_HOST: ${{ secrets.GRAFANA_HOST }}
GRAFANA_TOKEN: ${{ secrets.GRAFANA_TOKEN }}
Expand Down
19 changes: 5 additions & 14 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,21 @@ jobs:
cache: 'pip'

- name: Install the requirements
run: pip install -r requirements.txt && pip install setuptools~=65.5.1 mkdocs mkdocs-material
run: pip install pdm && pdm install --no-self && pdm add setuptools~=65.5.1 mkdocs mkdocs-material build

- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Prepare the PyPi documentation
run: python3 .github/workflows/scripts/adjust-the-readme-file.py

- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
run: .venv/bin/python3 -m build --sdist --wheel --outdir dist/

- name: Setup the GitHub user
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"

- name: Update the GitHub pages documentation
run: cd docs && mkdocs gh-deploy --force && cd ..
run: cd docs && .venv/bin/mkdocs gh-deploy --force && cd ..

- name: Publish distribution package to PyPI
if: startsWith(github.ref, 'refs/tags')
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/pull-request-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
cache: 'pip'

- name: Install the requirements
run: pip install -r requirements.txt
run: pip install pdm && pdm install --no-self -d

- name: Execute the unittests
run: python3 -m unittest discover tests/unittests
run: PYTHONPATH=$PWD/src .venv/bin/python3 -m unittest discover tests/unittests

pr-lint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -73,10 +73,10 @@ jobs:
cache: 'pip'

- name: Install the requirements
run: pip install -r requirements.txt && pip install pytest-cov coverage-badge
run: pip install pdm && pdm install --no-self -d && pdm add pytest-cov coverage-badge

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

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

- name: Generate coverage badge
run: coverage-badge -f -o docs/coverage.svg
run: .venv/bin/coverage-badge -f -o docs/coverage.svg

- name: Check changed files
uses: tj-actions/verify-changed-files@v20
Expand Down Expand Up @@ -133,10 +133,10 @@ jobs:
cache: 'pip'

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

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

- name: Check changed files
uses: tj-actions/verify-changed-files@v20
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/scripts/adjust-the-readme-file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
with open("README.md", "r", encoding="utf-8") as fh:
coverage_string: str = "![Coverage report](https://github.com/ZPascal/grafana_api_sdk/blob/main/docs/coverage.svg)"
long_description: str = fh.read()

with open("README.md", "w", encoding="utf-8") as fh:
fh.write(long_description.replace(coverage_string, ""))
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ In general, my focus on this project is to implement and deliver old and new fea

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.

`pip install grafana-api-sdk`
`pdm install grafana-api-sdk` or `pip install grafana-api-sdk`

## Example

Expand Down Expand Up @@ -434,7 +434,11 @@ model: APIModel = APIModel(host="test", token="test", ssl_context=ssl_ctx)
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.

## Contribution
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.
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.
If you want to make a contribution and open a pull request, please write or adapt the necessary unit tests beforehand.
You can install the necessary development requirements for the unit tests by running `pdm install -d` or `pip install pytest-httpx pytest`.

#TODO Document the unit test execution

## Support
If you need support, or you encounter a bug, please don't hesitate to open an issue.
Expand Down
4 changes: 2 additions & 2 deletions docs/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
252 changes: 252 additions & 0 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading