Skip to content
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ directory will be created with the generated project name. For example:
cd ~/devel
cookiecutter gh:frequenz-floss/frequenz-repo-config-python \
--directory=cookiecutter \
--checkout v0.5.0
--checkout v0.5.1
```

This command will prompt you for the project type, name, and other
Expand Down
82 changes: 1 addition & 81 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,85 +1,5 @@
# Frequenz Repository Configuration Release Notes

## Summary

This release adds linting of code examples in *docstrings*, a workflow to check if PRs have updated the release notes and an [editorconfig](https://editorconfig.org/) file, as well as a bunch of bug fixes.

## Upgrading

- nox: Now the default configuration for API repositories will not automatically add `pytests` as an `extra_path`

The `pytests` directory is not a standard directory that will be auto-discovered by `pytest`, so it should always be included in the `pyproject.toml` file, in the `tool.pytest.ini_options.testpaths` array. Please check your API project is properly configured.

### Cookiecutter template

- To make the new workflow to check if release notes were updated you should add the check to the branch protection rules of your repository to require this check to pass. You should also add a new label *"cmd:skip-release-notes"* to be able to override the check. You can use the following script to do it:

```sh
repo=... # org/repo
token=... # GitHub token with the correct permissions
name="cmd:skip-release-notes"
desc="It is not necessary to update release notes for this PR"
color="930F79"

# Using cURL
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $token" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-d '{"name":"'"$name"'","description":"'"$desc"'","color":"'"$color"'"}' \
"https://api.github.com/repos/$repo/labels"

# Using the gh tool (no need for a token if you already have it configured)
gh api -X POST \
-f name="$name" -f description="$desc" -f color="$color" \
"repos/$repo/labels"
```

## New Features

- Add support for linting code examples found in *docstrings*.

A new module `frequenz.repo.config.pytest.examples` is added with an utility function to be able to easily collect and lint code examples in *docstrings*.

There is also a new optional dependency `extra-lint-examples` to easily pull the dependencies needed to do this linting. Please have a look at the documentation in the `frequenz.repo.config` package for more details.

### Cookiecutter template

- Add a new GitHub workflow to check that release notes were updated.

This workflow will check PRs to see if a change was done in the `src/` directory, and if so, it will fail if the `RELEASE_NOTES.md` wasn't also updated.

Users can override this by assigning the label `cmd:skip-release-notes` to the PR for changes that don't really need a release notes update.

- Add `MANIFEST.in` file.

This makes sure that we don't ship useless files when building the distribution package and that we include all the relevant files too, like generated *.pyi files for API repositories.

- Add an `.editorconfig` file to ensure a common basic editor configuration for different file types.

- Add a `pytest` hook to collect and lint code examples found in *docstrings* using `pylint`.

Examples found in code *docstrings* in the `src/` directory will now be collected and checked using `pylint`. This is done via the file `src/conftest.py`, which hooks into `pytest`, so to only check the examples you can run `pylint src`.

!!! info

There is a bug in the library used to extract the examples that prevents from collecting examples from `__init__.py` files. See https://github.com/frequenz-floss/frequenz-repo-config-python/issues/113 for more details.

## Bug Fixes

- The distribution package doesn't include tests and other useless files anymore.

- nox

* When discovering path *extra paths*, now paths will not be added if they are also *source paths*, as we don't want any duplicates.

* Fix copying of `Config` and `CommandOptions` objects.

### Cookiecutter template

- Now the CI workflow will checkout the submodules.

- Fix adding of an empty keyword.

- Don't distribute development files in the source distribution.
- Fix outdated version number in the migrating and upgrading documentation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Fix outdated version number in the migrating and upgrading documentation.
- Fix outdated version number in migrating and upgrading documentation.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
requires = [
"setuptools == 67.7.2",
"setuptools_scm[toml] == 7.1.0",
"frequenz-repo-config[{{cookiecutter.type}}] == 0.5.0",
"frequenz-repo-config[{{cookiecutter.type}}] == 0.5.1",
]
build-backend = "setuptools.build_meta"

Expand Down Expand Up @@ -70,7 +70,7 @@ dev-mkdocs = [
"mkdocs-material == 9.1.16",
"mkdocs-section-index == 0.3.5",
"mkdocstrings[python] == 0.22.0",
"frequenz-repo-config[{{cookiecutter.type}}] == 0.5.0",
"frequenz-repo-config[{{cookiecutter.type}}] == 0.5.1",
]
dev-mypy = [
"mypy == 1.2.0",
Expand All @@ -79,7 +79,7 @@ dev-mypy = [
]
dev-noxfile = [
"nox == 2023.4.22",
"frequenz-repo-config[{{cookiecutter.type}}] == 0.5.0",
"frequenz-repo-config[{{cookiecutter.type}}] == 0.5.1",
]
dev-pylint = [
"pylint == 2.17.3",
Expand All @@ -88,7 +88,7 @@ dev-pylint = [
]
dev-pytest = [
"pytest == 7.3.1",
"frequenz-repo-config[extra-lint-examples] == 0.5.0",
"frequenz-repo-config[extra-lint-examples] == 0.5.1",
{%- if cookiecutter.type != "api" %}
"pytest-mock == 3.10.0",
"pytest-asyncio == 0.21.0",
Expand Down
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Then simply run [Cookiecutter] where you want to create the new project:

```sh
cookiecutter gh:frequenz-floss/frequenz-repo-config-python \
--directory=cookiecutter --checkout v0.5.0
--directory=cookiecutter --checkout v0.5.1
```

This command will prompt you for the project type, name, and other
Expand Down Expand Up @@ -238,7 +238,7 @@ the files in your existing project by using `rsync` or similar tools:
```sh
cd /tmp
cookiecutter gh:frequenz-floss/frequenz-repo-config-python \
--directory=cookiecutter --checkout v0.4.0
--directory=cookiecutter --checkout v0.5.1
rsync -vr --exclude=.git/ new-project/ /path/to/existing/project
cd /path/to/existing/project
git diff
Expand Down Expand Up @@ -283,7 +283,7 @@ git commit -a # commit all changes
cd ..
cookiecutter gh:frequenz-floss/frequenz-repo-config-python \
--directory=cookiecutter \
--checkout v0.4.0 \
--checkout v0.5.1 \
--overwrite-if-exists \
--replay \
--replay-file project-directory/.cookiecutter-replay.json
Expand Down
4 changes: 2 additions & 2 deletions src/frequenz/repo/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
# ...
dev-pytest = [
# ...
"frequenz-repo-config[extra-lint-examples] == 0.5.0",
"frequenz-repo-config[extra-lint-examples] == 0.5.1",
]
# ...
[[tool.mypy.overrides]]
Expand Down Expand Up @@ -357,7 +357,7 @@
requires = [
"setuptools >= 67.3.2, < 68",
"setuptools_scm[toml] >= 7.1.0, < 8",
"frequenz-repo-config[api] >= 0.5.0, < 0.6.0",
"frequenz-repo-config[api] >= 0.5.1, < 0.6.0",
]
build-backend = "setuptools.build_meta"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
requires = [
"setuptools == 67.7.2",
"setuptools_scm[toml] == 7.1.0",
"frequenz-repo-config[actor] == 0.5.0",
"frequenz-repo-config[actor] == 0.5.1",
]
build-backend = "setuptools.build_meta"

Expand Down Expand Up @@ -52,7 +52,7 @@ dev-mkdocs = [
"mkdocs-material == 9.1.16",
"mkdocs-section-index == 0.3.5",
"mkdocstrings[python] == 0.22.0",
"frequenz-repo-config[actor] == 0.5.0",
"frequenz-repo-config[actor] == 0.5.1",
]
dev-mypy = [
"mypy == 1.2.0",
Expand All @@ -61,7 +61,7 @@ dev-mypy = [
]
dev-noxfile = [
"nox == 2023.4.22",
"frequenz-repo-config[actor] == 0.5.0",
"frequenz-repo-config[actor] == 0.5.1",
]
dev-pylint = [
"pylint == 2.17.3",
Expand All @@ -70,7 +70,7 @@ dev-pylint = [
]
dev-pytest = [
"pytest == 7.3.1",
"frequenz-repo-config[extra-lint-examples] == 0.5.0",
"frequenz-repo-config[extra-lint-examples] == 0.5.1",
"pytest-mock == 3.10.0",
"pytest-asyncio == 0.21.0",
"async-solipsism == 0.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
requires = [
"setuptools == 67.7.2",
"setuptools_scm[toml] == 7.1.0",
"frequenz-repo-config[api] == 0.5.0",
"frequenz-repo-config[api] == 0.5.1",
]
build-backend = "setuptools.build_meta"

Expand Down Expand Up @@ -50,7 +50,7 @@ dev-mkdocs = [
"mkdocs-material == 9.1.16",
"mkdocs-section-index == 0.3.5",
"mkdocstrings[python] == 0.22.0",
"frequenz-repo-config[api] == 0.5.0",
"frequenz-repo-config[api] == 0.5.1",
]
dev-mypy = [
"mypy == 1.2.0",
Expand All @@ -59,7 +59,7 @@ dev-mypy = [
]
dev-noxfile = [
"nox == 2023.4.22",
"frequenz-repo-config[api] == 0.5.0",
"frequenz-repo-config[api] == 0.5.1",
]
dev-pylint = [
"pylint == 2.17.3",
Expand All @@ -68,7 +68,7 @@ dev-pylint = [
]
dev-pytest = [
"pytest == 7.3.1",
"frequenz-repo-config[extra-lint-examples] == 0.5.0",
"frequenz-repo-config[extra-lint-examples] == 0.5.1",
]
dev = [
"frequenz-api-test[dev-mkdocs,dev-docstrings,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
requires = [
"setuptools == 67.7.2",
"setuptools_scm[toml] == 7.1.0",
"frequenz-repo-config[app] == 0.5.0",
"frequenz-repo-config[app] == 0.5.1",
]
build-backend = "setuptools.build_meta"

Expand Down Expand Up @@ -51,7 +51,7 @@ dev-mkdocs = [
"mkdocs-material == 9.1.16",
"mkdocs-section-index == 0.3.5",
"mkdocstrings[python] == 0.22.0",
"frequenz-repo-config[app] == 0.5.0",
"frequenz-repo-config[app] == 0.5.1",
]
dev-mypy = [
"mypy == 1.2.0",
Expand All @@ -60,7 +60,7 @@ dev-mypy = [
]
dev-noxfile = [
"nox == 2023.4.22",
"frequenz-repo-config[app] == 0.5.0",
"frequenz-repo-config[app] == 0.5.1",
]
dev-pylint = [
"pylint == 2.17.3",
Expand All @@ -69,7 +69,7 @@ dev-pylint = [
]
dev-pytest = [
"pytest == 7.3.1",
"frequenz-repo-config[extra-lint-examples] == 0.5.0",
"frequenz-repo-config[extra-lint-examples] == 0.5.1",
"pytest-mock == 3.10.0",
"pytest-asyncio == 0.21.0",
"async-solipsism == 0.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
requires = [
"setuptools == 67.7.2",
"setuptools_scm[toml] == 7.1.0",
"frequenz-repo-config[lib] == 0.5.0",
"frequenz-repo-config[lib] == 0.5.1",
]
build-backend = "setuptools.build_meta"

Expand Down Expand Up @@ -48,7 +48,7 @@ dev-mkdocs = [
"mkdocs-material == 9.1.16",
"mkdocs-section-index == 0.3.5",
"mkdocstrings[python] == 0.22.0",
"frequenz-repo-config[lib] == 0.5.0",
"frequenz-repo-config[lib] == 0.5.1",
]
dev-mypy = [
"mypy == 1.2.0",
Expand All @@ -57,7 +57,7 @@ dev-mypy = [
]
dev-noxfile = [
"nox == 2023.4.22",
"frequenz-repo-config[lib] == 0.5.0",
"frequenz-repo-config[lib] == 0.5.1",
]
dev-pylint = [
"pylint == 2.17.3",
Expand All @@ -66,7 +66,7 @@ dev-pylint = [
]
dev-pytest = [
"pytest == 7.3.1",
"frequenz-repo-config[extra-lint-examples] == 0.5.0",
"frequenz-repo-config[extra-lint-examples] == 0.5.1",
"pytest-mock == 3.10.0",
"pytest-asyncio == 0.21.0",
"async-solipsism == 0.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
requires = [
"setuptools == 67.7.2",
"setuptools_scm[toml] == 7.1.0",
"frequenz-repo-config[model] == 0.5.0",
"frequenz-repo-config[model] == 0.5.1",
]
build-backend = "setuptools.build_meta"

Expand Down Expand Up @@ -52,7 +52,7 @@ dev-mkdocs = [
"mkdocs-material == 9.1.16",
"mkdocs-section-index == 0.3.5",
"mkdocstrings[python] == 0.22.0",
"frequenz-repo-config[model] == 0.5.0",
"frequenz-repo-config[model] == 0.5.1",
]
dev-mypy = [
"mypy == 1.2.0",
Expand All @@ -61,7 +61,7 @@ dev-mypy = [
]
dev-noxfile = [
"nox == 2023.4.22",
"frequenz-repo-config[model] == 0.5.0",
"frequenz-repo-config[model] == 0.5.1",
]
dev-pylint = [
"pylint == 2.17.3",
Expand All @@ -70,7 +70,7 @@ dev-pylint = [
]
dev-pytest = [
"pytest == 7.3.1",
"frequenz-repo-config[extra-lint-examples] == 0.5.0",
"frequenz-repo-config[extra-lint-examples] == 0.5.1",
"pytest-mock == 3.10.0",
"pytest-asyncio == 0.21.0",
"async-solipsism == 0.5",
Expand Down