Skip to content

Commit ac7c7a1

Browse files
authored
Fix grpc dependencies (#259)
This is a backport of #254 plus a few v0.15 specific fixes to make the CI pass in this old branch. - **Bump `frequenz-api-common` submodule to v0.6.2** - **Pin grpc related dependencies** - **Bump mkdocstrings dependencies** - **Fix `mypy` configuration** - **Stop using strict mode in `mkdocs.yml`**
2 parents 44f2c86 + 54c19c3 commit ac7c7a1

File tree

4 files changed

+35
-22
lines changed

4 files changed

+35
-22
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
# Frequenz Microgrid API Release Notes
22

3-
## Summary
4-
5-
<!-- Here goes a general summary of what this release is about -->
6-
7-
## Upgrading
8-
9-
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
10-
11-
## New Features
12-
13-
<!-- Here goes the main new features and examples or instructions on how to use them -->
14-
153
## Bug Fixes
164

17-
<!-- Here goes notable bug fixes that are worth a special mention or explanation -->
5+
- Fix a dependency issue by pinning the `grpcio` version and related libraries.

mkdocs.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ copyright: "Copyright © 2023 Frequenz Energy-as-a-Service GmbH"
99
repo_name: "frequenz-api-microgrid"
1010
repo_url: "https://github.com/frequenz-floss/frequenz-api-microgrid"
1111
edit_uri: "edit/v0.x.x/docs/"
12-
strict: true # Treat warnings as errors
1312

1413
# Build directories
1514
theme:
@@ -90,7 +89,6 @@ plugins:
9089
- mike:
9190
canonical_version: latest
9291
- mkdocstrings:
93-
custom_templates: templates
9492
default_handler: python
9593
handlers:
9694
python:
@@ -105,7 +103,7 @@ plugins:
105103
import:
106104
# See https://mkdocstrings.github.io/python/usage/#import for details
107105
- https://docs.python.org/3/objects.inv
108-
- https://frequenz-floss.github.io/frequenz-api-common/v0.5/objects.inv
106+
- https://frequenz-floss.github.io/frequenz-api-common/v0.6/objects.inv
109107
- https://grpc.github.io/grpc/python/objects.inv
110108
- https://typing-extensions.readthedocs.io/en/stable/objects.inv
111109
- search

pyproject.toml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ requires = [
66
"setuptools == 67.7.2",
77
"setuptools_scm[toml] == 7.1.0",
88
"frequenz-repo-config[api] == 0.4.0",
9+
# We need to pin the protobuf, grpcio and grpcio-tools dependencies to make
10+
# sure the code is generated using the minimum supported versions, as older
11+
# versions can't work with code that was generated with newer versions.
12+
# https://protobuf.dev/support/cross-version-runtime-guarantee/#backwards
13+
"protobuf == 4.25.3",
14+
"grpcio-tools == 1.51.1",
15+
"grpcio == 1.51.1",
916
]
1017
build-backend = "setuptools.build_meta"
1118

@@ -26,9 +33,15 @@ classifiers = [
2633
]
2734
requires-python = ">= 3.11, < 4"
2835
dependencies = [
29-
"frequenz-api-common >= 0.5.4, < 0.6",
36+
"frequenz-api-common >= 0.6.2, < 0.7",
3037
"googleapis-common-protos >= 1.56.4, < 2",
31-
"grpcio >= 1.51.1, < 2",
38+
# We can't widen beyond 6 because of protobuf cross-version runtime guarantees
39+
# https://protobuf.dev/support/cross-version-runtime-guarantee/#major
40+
"protobuf >= 4.25.3, < 6", # Do not widen beyond 6!
41+
# We couldn't find any document with a spec about the cross-version runtime
42+
# guarantee for grpcio, so unless we find one in the future, we'll assume
43+
# major version jumps are not compatible
44+
"grpcio >= 1.51.1, < 2", # Do not widen beyond 2!
3245
]
3346
dynamic = ["version"]
3447

@@ -46,14 +59,16 @@ dev-formatting = ["black == 23.3.0", "isort == 5.12.0"]
4659
dev-mkdocs = [
4760
"mike == 1.1.2",
4861
"mkdocs-gen-files == 0.5.0",
49-
"mkdocs-literate-nav == 0.6.0",
50-
"mkdocs-material == 9.1.16",
5162
"mkdocs-section-index == 0.3.5",
52-
"mkdocstrings[python] == 0.22.0",
63+
"mkdocs-literate-nav == 0.6.1",
64+
"mkdocs-material == 9.5.20",
65+
"mkdocstrings[python] == 0.26.1",
66+
"mkdocstrings-python == 1.11.1",
5367
"frequenz-repo-config[api] == 0.4.0",
5468
]
5569
dev-mypy = [
5670
"mypy == 1.2.0",
71+
"grpc-stubs == 1.53.0.5",
5772
# For checking the noxfile, docs/ script, and tests
5873
"frequenz-api-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]",
5974
]
@@ -103,6 +118,18 @@ disable = [
103118
[tool.pytest.ini_options]
104119
testpaths = ["pytests"]
105120

121+
[tool.mypy]
122+
explicit_package_bases = true
123+
namespace_packages = true
124+
# This option disables mypy cache, and it is sometimes useful to enable it if
125+
# you are getting weird intermittent error, or error in the CI but not locally
126+
# (or vice versa). In particular errors saying that type: ignore is not
127+
# used but getting the original ignored error when removing the type: ignore.
128+
# See for example: https://github.com/python/mypy/issues/2960
129+
#no_incremental = true
130+
packages = ["frequenz.api.microgrid"]
131+
strict = true
132+
106133
[tool.setuptools.package-dir]
107134
"" = "py"
108135

0 commit comments

Comments
 (0)