diff --git a/.github/containers/test-installation/Dockerfile b/.github/containers/test-installation/Dockerfile index c6d3e77..181d1ef 100644 --- a/.github/containers/test-installation/Dockerfile +++ b/.github/containers/test-installation/Dockerfile @@ -13,5 +13,8 @@ RUN apt-get update -y && \ python -m pip install --upgrade --no-cache-dir pip COPY dist dist -RUN pip install dist/*.whl && \ - rm -rf dist +# This git-credentials file is made available by the GitHub ci.yaml workflow +COPY git-credentials /root/.git-credentials +RUN git config --global credential.helper store && \ + pip install dist/*.whl && \ + rm -rf dist /root/.git-credentials diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8f56fa3..919b101 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -64,6 +64,13 @@ jobs: runs-on: ${{ matrix.os }} steps: + - name: Setup Git + uses: frequenz-floss/gh-action-setup-git@v0.x.x + # TODO(cookiecutter): Uncomment this for projects with private dependencies + # with: + # username: ${{ secrets.GIT_USER }} + # password: ${{ secrets.GIT_PASS }} + - name: Print environment (debug) run: env @@ -152,6 +159,13 @@ jobs: needs: ["build"] runs-on: ubuntu-20.04 steps: + - name: Setup Git + uses: frequenz-floss/gh-action-setup-git@v0.x.x + # TODO(cookiecutter): Uncomment this for projects with private dependencies + # with: + # username: ${{ secrets.GIT_USER }} + # password: ${{ secrets.GIT_PASS }} + - name: Fetch sources uses: actions/checkout@v4 - name: Download package @@ -177,6 +191,13 @@ jobs: if: github.event_name != 'push' runs-on: ubuntu-20.04 steps: + - name: Setup Git + uses: frequenz-floss/gh-action-setup-git@v0.x.x + # TODO(cookiecutter): Uncomment this for projects with private dependencies + # with: + # username: ${{ secrets.GIT_USER }} + # password: ${{ secrets.GIT_PASS }} + - name: Fetch sources uses: actions/checkout@v4 with: @@ -340,11 +361,33 @@ jobs: # https://blog.pypi.org/posts/2023-04-20-introducing-trusted-publishers/ id-token: write steps: - - name: Download distribution files - uses: actions/download-artifact@v3 + - name: Setup Git + uses: frequenz-floss/gh-action-setup-git@v0.x.x + # TODO(cookiecutter): Uncomment this for projects with private dependencies + # with: + # username: ${{ secrets.GIT_USER }} + # password: ${{ secrets.GIT_PASS }} + + - name: Fetch sources + uses: actions/checkout@v4 + + - name: Download package + uses: actions/download-artifact@v4 with: name: dist-packages path: dist - name: Publish the Python distribution to PyPI uses: pypa/gh-action-pypi-publish@release/v1 + - name: Make Git credentials available to docker + run: | + touch ~/.git-credentials # Ensure the file exists + cp ~/.git-credentials git-credentials || true + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up docker-buildx + uses: docker/setup-buildx-action@v3 + + - name: Test Installation diff --git a/.github/workflows/release-notes-check.yml b/.github/workflows/release-notes-check.yml index 82882db..8ba3e3e 100644 --- a/.github/workflows/release-notes-check.yml +++ b/.github/workflows/release-notes-check.yml @@ -17,6 +17,8 @@ jobs: check-release-notes: name: Check release notes are updated runs-on: ubuntu-latest + permissions: + pull-requests: read steps: - name: Check for a release notes update if: github.event_name == 'pull_request' diff --git a/docs/_scripts/macros.py b/docs/_scripts/macros.py index ff87c71..f84712e 100644 --- a/docs/_scripts/macros.py +++ b/docs/_scripts/macros.py @@ -27,10 +27,7 @@ def _slugify(text: str) -> str: Returns: The slugified text. """ - # The type of the return value is not defined for the markdown library. - # Also for some reason `mypy` thinks the `toc` module doesn't have a - # `slugify_unicode` function, but it definitely does. - return toc.slugify_unicode(text, "-") # type: ignore[attr-defined,no-any-return] + return toc.slugify_unicode(text, "-") def _hook_macros_plugin(env: macros.MacrosPlugin) -> None: diff --git a/mkdocs.yml b/mkdocs.yml index 42ad6da..f2acf6f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -93,7 +93,7 @@ plugins: - literate-nav: nav_file: SUMMARY.md - mike: - alias_type: redirect + alias_type: symlink canonical_version: latest - mkdocstrings: default_handler: python @@ -110,6 +110,7 @@ plugins: show_root_members_full_path: true show_signature_annotations: true show_source: true + show_symbol_type_toc: true signature_crossrefs: true import: # See https://mkdocstrings.github.io/python/usage/#import for details diff --git a/pyproject.toml b/pyproject.toml index 5f48eba..eb11d88 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,20 +66,21 @@ dev-flake8 = [ dev-formatting = ["black == 24.4.2", "isort == 5.12.0"] dev-mkdocs = [ "black == 24.4.2", - "Markdown==3.4.4", + "Markdown==3.7", "mike == 2.0.0", "mkdocs-gen-files == 0.5.0", "mkdocs-literate-nav == 0.6.1", "mkdocs-macros-plugin == 1.0.4", "mkdocs-material == 9.4.4", "mkdocstrings[python] == 0.25.0", + "mkdocstrings-python == 1.9.2", "mkdocstrings-python == 1.10.8", "frequenz-repo-config[api] == 0.9.2", ] dev-mypy = [ "mypy == 1.5.1", "grpc-stubs == 1.53.0.5", - "types-Markdown == 3.4.2.10", + "types-Markdown == 3.7.0.20241204", # For checking the noxfile, docs/ script, and tests "frequenz-api-weather[dev-mkdocs,dev-noxfile,dev-pytest]", ] @@ -132,6 +133,7 @@ check-yield-types = false arg-type-hints-in-docstring = false arg-type-hints-in-signature = true allow-init-docstring = true +check-class-attributes = false [tool.pylint.similarities] ignore-comments = ['yes'] @@ -149,10 +151,14 @@ disable = [ # pylint's unsubscriptable check is buggy and is not needed because # it is a type-check, for which we already have mypy. "unsubscriptable-object", + # Checked by mypy + "no-member", # Checked by flake8 + "f-string-without-interpolation", "redefined-outer-name", "unused-import", "line-too-long", + "missing-function-docstring", "unused-variable", "unnecessary-lambda-assignment", # Checked by mypy