Skip to content

Commit 34684db

Browse files
Add versioning to common proto files (#90)
This commit adds versioning to the common proto files. This is done by adding a v1 directory to the common directory and moving all the proto files into it. The proto packages are also renamed to include the v1 suffix. This commit also updates the imports in the test_common.py file to reflect the changes.
2 parents 2690e3c + 61bdbe3 commit 34684db

File tree

8 files changed

+20
-18
lines changed

8 files changed

+20
-18
lines changed

RELEASE_NOTES.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
## Upgrading
88

9-
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
9+
- The package names have been changed from `frequenz.api.common.<package>` to
10+
`frequenz.api.common.v1.<package>`. `v1` is the API's major version, and will
11+
be incremented for breaking changes.
1012

1113
## New Features
1214

proto/frequenz/api/common/components.proto renamed to proto/frequenz/api/common/v1/components.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
syntax = "proto3";
1010

11-
package frequenz.api.common.components;
11+
package frequenz.api.common.v1.components;
1212

1313
// Enumrated component categories.
1414
enum ComponentCategory {

proto/frequenz/api/common/location.proto renamed to proto/frequenz/api/common/v1/location.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
syntax = "proto3";
99

10-
package frequenz.api.common.location;
10+
package frequenz.api.common.v1.location;
1111

1212
// A pair of geographical co-ordinates, representing the location of a place.
1313
message Location {

proto/frequenz/api/common/metrics.proto renamed to proto/frequenz/api/common/v1/metrics.proto

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
syntax = "proto3";
1010

11-
package frequenz.api.common.metrics;
11+
package frequenz.api.common.v1.metrics;
1212

1313
// A set of lower and upper bounds for any metric.
1414
// The units of the bounds are always the same as the related metric.
@@ -114,11 +114,11 @@ message MetricAggregation {
114114
// The manufacturer's rated bounds of the metric. This may differ from
115115
// `system_bounds` as it does not take into account the current state of the
116116
// overall system.
117-
frequenz.api.common.metrics.Bounds rated_bounds = 13;
117+
frequenz.api.common.v1.metrics.Bounds rated_bounds = 13;
118118

119119
// The current bounds of the metric, as imposed by the component this metric
120120
// originates from.
121-
frequenz.api.common.metrics.Bounds component_bounds = 14;
121+
frequenz.api.common.v1.metrics.Bounds component_bounds = 14;
122122

123123
// These bounds indicate the range of values that are disallowed for the
124124
// metric.
@@ -147,7 +147,7 @@ message MetricAggregation {
147147
// ```
148148
// ---- values here are disallowed and wil be rejected
149149
// ==== vales here are allowed and will be accepted
150-
frequenz.api.common.metrics.Bounds system_exclusion_bounds = 4;
150+
frequenz.api.common.v1.metrics.Bounds system_exclusion_bounds = 4;
151151

152152
// These bounds indicate the range of values that are allowed for the metric.
153153
// If these bounds for a metric are [`lower`, `upper`], then this metric's
@@ -174,5 +174,5 @@ message MetricAggregation {
174174
// ```
175175
// ---- values here are disallowed and wil be rejected
176176
// ==== vales here are allowed and will be accepted
177-
frequenz.api.common.metrics.Bounds system_inclusion_bounds = 5;
177+
frequenz.api.common.v1.metrics.Bounds system_inclusion_bounds = 5;
178178
}

proto/frequenz/api/common/metrics/electrical.proto renamed to proto/frequenz/api/common/v1/metrics/electrical.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
syntax = "proto3";
1010

11-
package frequenz.api.common.metrics.electrical;
11+
package frequenz.api.common.v1.metrics.electrical;
1212

13-
import "frequenz/api/common/metrics.proto";
13+
import "frequenz/api/common/v1/metrics.proto";
1414

1515
// Metrics of a DC electrical connection.
1616
message DC {
File renamed without changes.

pytests/test_common.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,45 @@
77
def test_package_import() -> None:
88
"""Test that the package can be imported."""
99
# pylint: disable=import-outside-toplevel
10-
from frequenz.api import common
10+
from frequenz.api.common import v1
1111

12-
assert common is not None
12+
assert v1 is not None
1313

1414

1515
def test_module_import_components() -> None:
1616
"""Test that the modules can be imported."""
1717
# pylint: disable=import-outside-toplevel
18-
from frequenz.api.common import components_pb2
18+
from frequenz.api.common.v1 import components_pb2
1919

2020
assert components_pb2 is not None
2121

2222
# pylint: disable=import-outside-toplevel
23-
from frequenz.api.common import components_pb2_grpc
23+
from frequenz.api.common.v1 import components_pb2_grpc
2424

2525
assert components_pb2_grpc is not None
2626

2727

2828
def test_module_import_metrics() -> None:
2929
"""Test that the modules can be imported."""
3030
# pylint: disable=import-outside-toplevel
31-
from frequenz.api.common import metrics_pb2
31+
from frequenz.api.common.v1 import metrics_pb2
3232

3333
assert metrics_pb2 is not None
3434

3535
# pylint: disable=import-outside-toplevel
36-
from frequenz.api.common import metrics_pb2_grpc
36+
from frequenz.api.common.v1 import metrics_pb2_grpc
3737

3838
assert metrics_pb2_grpc is not None
3939

4040

4141
def test_module_import_metrics_electrical() -> None:
4242
"""Test that the modules can be imported."""
4343
# pylint: disable=import-outside-toplevel
44-
from frequenz.api.common.metrics import electrical_pb2
44+
from frequenz.api.common.v1.metrics import electrical_pb2
4545

4646
assert electrical_pb2 is not None
4747

4848
# pylint: disable=import-outside-toplevel
49-
from frequenz.api.common.metrics import electrical_pb2_grpc
49+
from frequenz.api.common.v1.metrics import electrical_pb2_grpc
5050

5151
assert electrical_pb2_grpc is not None

0 commit comments

Comments
 (0)