Skip to content

Commit 0e69660

Browse files
authored
Update to repo-config v0.7.4 (#752)
The summary of changes is: - Add some missing copyright notices. - Update dependencies monthly instead of weekly. - Move some support files for the documentation website to names starting with `_` to make it more clear they are only support files. - Fix the CI to ignore dependabot pushes (they are tested via the PR). - Use the new documentation website versioning scheme. This means now multiple development branches are exposed, as well as pre-releases. Also the order of the versions is improved. The `next` version is replaced by the multiple `vX.Y-dev` versions. - Unify formatting in the README. - Move the hack to integrate `mkdocs` `macros` and `mkdocstrings` plugins into its own function. - Add a few handy `mkdocs`/`markdown` extensions. - Unify some `pyproject.toml` options. - Remove customizations in the `noxfile.py` as now `repo-config` can handle it natively. - Remove unnecessary fields from the cookiecutter replay file.
2 parents 5cd8d9a + 41137f3 commit 0e69660

File tree

21 files changed

+147
-114
lines changed

21 files changed

+147
-114
lines changed

.cookiecutter-replay.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"python_package": "frequenz.sdk",
1414
"pypi_package_name": "frequenz-sdk",
1515
"github_repo_name": "frequenz-sdk-python",
16-
"default_codeowners": "@frequenz-floss/python-sdk-team",
17-
"_template": "gh:frequenz-floss/frequenz-repo-config-python"
16+
"default_codeowners": "@frequenz-floss/python-sdk-team"
1817
}
1918
}

.github/containers/nox-cross-arch/arm64-ubuntu-20.04-python-3.11.Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# License: MIT
2+
# Copyright © 2023 Frequenz Energy-as-a-Service GmbH
3+
# This Dockerfile is used to run the tests in arm64, which is not supported by
4+
# GitHub Actions at the moment.
5+
16
FROM docker.io/library/ubuntu:20.04
27

38
ENV DEBIAN_FRONTEND=noninteractive

.github/containers/nox-cross-arch/entrypoint.bash

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/bin/bash
2+
# License: MIT
3+
# Copyright © 2023 Frequenz Energy-as-a-Service GmbH
24
set -e
35

46
echo "System details:" $(uname -a)

.github/containers/test-installation/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# This dockerfile is used to test the installation of the python package in
1+
# License: MIT
2+
# Copyright © 2023 Frequenz Energy-as-a-Service GmbH
3+
# This Dockerfile is used to test the installation of the python package in
24
# multiple platforms in the CI. It is not used to build the package itself.
35

46
FROM --platform=${TARGETPLATFORM} python:3.11-slim

.github/dependabot.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ updates:
33
- package-ecosystem: "pip"
44
directory: "/"
55
schedule:
6-
interval: "weekly"
7-
time: "07:00"
6+
interval: "monthly"
7+
day: "friday"
88
labels:
99
- "part:tooling"
1010
- "type:tech-debt"
@@ -34,8 +34,8 @@ updates:
3434
- package-ecosystem: "github-actions"
3535
directory: "/"
3636
schedule:
37-
interval: "weekly"
38-
time: "06:00"
37+
interval: "monthly"
38+
day: "friday"
3939
labels:
4040
- "part:tooling"
4141
- "type:tech-debt"

.github/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
- ".editorconfig"
4646
- ".git*"
4747
- ".git*/**"
48-
- "docs/**/*.py"
48+
- "docs/*.py"
4949
- CODEOWNERS
5050
- MANIFEST.in
5151
- noxfile.py

.github/workflows/ci.yaml

Lines changed: 38 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
# We only want to test the merge commit (`merge_group` event), the hashes
1414
# in the push were already tested by the PR checks
1515
- 'gh-readonly-queue/**'
16+
- 'dependabot/**'
1617
workflow_dispatch:
1718

1819
env:
@@ -307,78 +308,68 @@ jobs:
307308
permissions:
308309
contents: write
309310
steps:
310-
- name: Calculate and check version
311-
id: mike-metadata
312-
env:
313-
REF: ${{ github.ref }}
314-
REF_NAME: ${{ github.ref_name }}
315-
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
316-
run: |
317-
aliases=
318-
version=
319-
if test "$REF_NAME" = "$DEFAULT_BRANCH"
320-
then
321-
version=next
322-
# A tag that starts with vX.Y or X.Y
323-
elif echo "$REF" | grep -q '^refs/tags' && echo "$REF_NAME" | grep -Pq '^v?\d+\.\d+\.'
324-
then
325-
if echo "$REF_NAME" | grep -Pq -- "-" # pre-release
326-
then
327-
echo "::notice title=Documentation was not published::" \
328-
"The tag '$REF_NAME' looks like a pre-release."
329-
exit 0
330-
fi
331-
version=$(echo "$REF_NAME" | sed -r 's/^(v?[0-9]+\.[0-9]+)\..*$/\1/') # vX.Y
332-
major=$(echo "$REF_NAME" | sed -r 's/^(v?[0-9]+)\..*$/\1/') # vX
333-
default_major=$(echo "$DEFAULT_BRANCH" | sed -r 's/^(v?[0-9]+)\..*$/\1/') # vX
334-
aliases=$major
335-
if test "$major" = "$default_major"
336-
then
337-
aliases="$aliases latest"
338-
fi
339-
else
340-
echo "::warning title=Documentation was not published::" \
341-
"Don't know how to handle '$REF' to make 'mike' version."
342-
exit 0
343-
fi
344-
echo "version=$version" >> $GITHUB_OUTPUT
345-
echo "aliases=$aliases" >> $GITHUB_OUTPUT
346-
347311
- name: Fetch sources
348-
if: steps.mike-metadata.outputs.version
349312
uses: actions/checkout@v4
350313
with:
351314
submodules: true
352315

353316
- name: Setup Git user and e-mail
354-
if: steps.mike-metadata.outputs.version
355317
uses: frequenz-floss/setup-git-user@v2
356318

357319
- name: Set up Python
358-
if: steps.mike-metadata.outputs.version
359320
uses: actions/setup-python@v4
360321
with:
361322
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
362323
cache: 'pip'
363324

364325
- name: Install build dependencies
365-
if: steps.mike-metadata.outputs.version
366326
run: |
367327
python -m pip install -U pip
368328
python -m pip install .[dev-mkdocs]
369329
pip freeze
370330
331+
- name: Calculate and check version
332+
id: mike-version
333+
env:
334+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
335+
GITHUB_REPO: ${{ github.repository }}
336+
GIT_REF: ${{ github.ref }}
337+
GIT_SHA: ${{ github.sha }}
338+
run: |
339+
python -m frequenz.repo.config.cli.version.mike.info
340+
371341
- name: Fetch the gh-pages branch
372-
if: steps.mike-metadata.outputs.version
342+
if: steps.mike-version.outputs.version
373343
run: git fetch origin gh-pages --depth=1
374344

375-
- name: Publish site
376-
if: steps.mike-metadata.outputs.version
345+
- name: Build site
346+
if: steps.mike-version.outputs.version
377347
env:
378-
VERSION: ${{ steps.mike-metadata.outputs.version }}
379-
ALIASES: ${{ steps.mike-metadata.outputs.aliases }}
348+
VERSION: ${{ steps.mike-version.outputs.version }}
349+
TITLE: ${{ steps.mike-version.outputs.title }}
350+
ALIASES: ${{ steps.mike-version.outputs.aliases }}
351+
# This is not ideal, we need to define all these variables here
352+
# because we need to calculate all the repository version information
353+
# to be able to show the correct versions in the documentation when
354+
# building it.
355+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
356+
GITHUB_REPO: ${{ github.repository }}
357+
GIT_REF: ${{ github.ref }}
358+
GIT_SHA: ${{ github.sha }}
359+
run: |
360+
mike deploy --update-aliases --title "$TITLE" "$VERSION" $ALIASES
361+
362+
- name: Sort site versions
363+
if: steps.mike-version.outputs.version
364+
run: |
365+
git checkout gh-pages
366+
python -m frequenz.repo.config.cli.version.mike.sort versions.json
367+
git commit -a -m "Sort versions.json"
368+
369+
- name: Publish site
370+
if: steps.mike-version.outputs.version
380371
run: |
381-
mike deploy --push --update-aliases "$VERSION" $ALIASES
372+
git push origin gh-pages
382373
383374
create-github-release:
384375
name: Create GitHub release

CONTRIBUTING.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,14 @@ These are the steps to create a new release:
157157

158158
## Cross-Arch Testing
159159

160-
This project has built-in support for testing across multiple architectures. Currently, our CI conducts tests on `arm64` machines using QEMU emulation. We also have the flexibility to expand this support to include additional architectures in the future.
161-
162-
This project containers dockerfiles that can be used in the CI to test the
163-
python package in non-native machine architectures, e.g., `arm64`.
164-
The dockerfiles exist in the directory `.github/containers/nox-cross-arch`, and
160+
This project has built-in support for testing across multiple architectures.
161+
Currently, our CI conducts tests on `arm64` machines using QEMU emulation. We
162+
also have the flexibility to expand this support to include additional
163+
architectures in the future.
164+
165+
This project contains Dockerfiles that can be used in the CI to test the
166+
python package in non-native machine architectures, e.g., `arm64`. The
167+
Dockerfiles exist in the directory `.github/containers/nox-cross-arch`, and
165168
follow a naming scheme so that they can be easily used in build matrices in the
166169
CI, in `nox-cross-arch` job. The naming scheme is:
167170

@@ -175,6 +178,6 @@ E.g.,
175178
arm64-ubuntu-20.04-python-3.11.Dockerfile
176179
```
177180

178-
If a dockerfile for your desired target architecture, OS, and python version
179-
does not exist here, please add one before proceeding to add your options to the
180-
test matrix.
181+
If a Dockerfile for your desired target architecture, OS, and python version
182+
does not exist here, please add one before proceeding to add your options to
183+
the test matrix.

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ exclude mkdocs.yml
77
exclude noxfile.py
88
exclude src/conftest.py
99
recursive-exclude .github *
10+
recursive-exclude benchmarks *
1011
recursive-exclude docs *
1112
recursive-exclude tests *
1213
recursive-include py *.pyi

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ A development kit to interact with the Frequenz development platform.
1010

1111
## Supported Platforms
1212

13-
This SDK is supported on and thoroughly tested with the following platforms:
13+
The following platforms are officially supported (test):
1414

1515
- **Python:** 3.11
16-
- **Operating System:** Ubuntu 20.04
16+
- **Operating System:** Ubuntu Linux 20.04
1717
- **Architectures:** amd64, arm64
1818

1919
## Quick Start

0 commit comments

Comments
 (0)