From b1844d0a58b62e3b69ca46305ff706fbe4f5ec88 Mon Sep 17 00:00:00 2001 From: Ivan Polomani Date: Wed, 22 Nov 2023 15:22:24 +0100 Subject: [PATCH 1/9] Remove "beta" warning for Units catalog --- cognite/client/_api/units.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cognite/client/_api/units.py b/cognite/client/_api/units.py index 7d0d3d8ba2..b5b8597f1c 100644 --- a/cognite/client/_api/units.py +++ b/cognite/client/_api/units.py @@ -26,8 +26,6 @@ def __init__( cognite_client: CogniteClient, ) -> None: super().__init__(config, api_version, cognite_client) - self._api_subversion = "beta" - self._warning = FeaturePreviewWarning(api_maturity="beta", sdk_maturity="beta", feature_name="Unit Catalogue") self.systems = UnitSystemAPI(config, api_version, cognite_client, self._warning) @overload @@ -41,7 +39,7 @@ def retrieve(self, external_id: MutableSequence[str], ignore_unknown_ids: bool = def retrieve( self, external_id: str | MutableSequence[str], ignore_unknown_ids: bool = False ) -> Unit | UnitList | None: - """`Retrieve one or more unit `_ + """`Retrieve one or more unit `_ Args: external_id (str | MutableSequence[str]): External ID or list of external IDs @@ -74,7 +72,7 @@ def retrieve( ) def list(self) -> UnitList: - """`List all supported units `_ + """`List all supported units `_ Returns: UnitList: List of units @@ -105,7 +103,7 @@ def __init__( self._api_subversion = "beta" def list(self) -> UnitSystemList: - """`List all supported unit systems `_ + """`List all supported unit systems `_ Returns: UnitSystemList: List of unit systems From 4ab3ff351fb92b990ac8bc408005cfc1598ddb2b Mon Sep 17 00:00:00 2001 From: Ivan Polomani Date: Wed, 22 Nov 2023 15:25:44 +0100 Subject: [PATCH 2/9] Update units.py --- cognite/client/_api/units.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cognite/client/_api/units.py b/cognite/client/_api/units.py index b5b8597f1c..dad3e0e83b 100644 --- a/cognite/client/_api/units.py +++ b/cognite/client/_api/units.py @@ -26,7 +26,7 @@ def __init__( cognite_client: CogniteClient, ) -> None: super().__init__(config, api_version, cognite_client) - self.systems = UnitSystemAPI(config, api_version, cognite_client, self._warning) + self.systems = UnitSystemAPI(config, api_version, cognite_client) @overload def retrieve(self, external_id: str, ignore_unknown_ids: bool = False) -> None | Unit: @@ -62,7 +62,6 @@ def retrieve( >>> res = c.units.retrieve(['temperature:deg_c', 'pressure:bar']) """ - self._warning.warn() identifier = IdentifierSequence.load(external_ids=external_id) return self._retrieve_multiple( identifiers=identifier, @@ -84,7 +83,6 @@ def list(self) -> UnitList: >>> c = CogniteClient() >>> res = c.units.list() """ - self._warning.warn() return self._list(method="GET", list_cls=UnitList, resource_cls=Unit) @@ -99,7 +97,6 @@ def __init__( warning: FeaturePreviewWarning, ) -> None: super().__init__(config, api_version, cognite_client) - self._warning = warning self._api_subversion = "beta" def list(self) -> UnitSystemList: @@ -116,5 +113,4 @@ def list(self) -> UnitSystemList: >>> res = c.units.systems.list() """ - self._warning.warn() return self._list(method="GET", list_cls=UnitSystemList, resource_cls=UnitSystem) From 1ef08d6118920753accbb82f4c055c96caf528ec Mon Sep 17 00:00:00 2001 From: Ivan Polomani Date: Wed, 22 Nov 2023 15:31:30 +0100 Subject: [PATCH 3/9] Update units.py --- cognite/client/_api/units.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cognite/client/_api/units.py b/cognite/client/_api/units.py index dad3e0e83b..357135deb8 100644 --- a/cognite/client/_api/units.py +++ b/cognite/client/_api/units.py @@ -94,7 +94,6 @@ def __init__( config: ClientConfig, api_version: str | None, cognite_client: CogniteClient, - warning: FeaturePreviewWarning, ) -> None: super().__init__(config, api_version, cognite_client) self._api_subversion = "beta" From 85f4d7845a043707f7fc8e0e6237df23ca0fdb16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20V=2E=20Treider?= Date: Thu, 23 Nov 2023 12:16:31 +0100 Subject: [PATCH 4/9] run linters --- cognite/client/_api/units.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cognite/client/_api/units.py b/cognite/client/_api/units.py index 357135deb8..43a6ddd12f 100644 --- a/cognite/client/_api/units.py +++ b/cognite/client/_api/units.py @@ -9,7 +9,6 @@ UnitSystem, UnitSystemList, ) -from cognite.client.utils._experimental import FeaturePreviewWarning from cognite.client.utils._identifier import IdentifierSequence if TYPE_CHECKING: From 405928c555d4aad9e568adda318d9d188171d38b Mon Sep 17 00:00:00 2001 From: Ivan Polomani Date: Thu, 23 Nov 2023 12:57:06 +0100 Subject: [PATCH 5/9] Remove alpha/beta warning --- .gitignore | 1 + cognite/client/_api/units.py | 12 +++++++----- docs/source/unit_catalog.rst | 8 -------- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 87131b4610..bd8203caa8 100644 --- a/.gitignore +++ b/.gitignore @@ -58,3 +58,4 @@ scripts/local_client.py playground.py scripts/tmp/ my_file.txt +.venv/ diff --git a/cognite/client/_api/units.py b/cognite/client/_api/units.py index 43a6ddd12f..1125514972 100644 --- a/cognite/client/_api/units.py +++ b/cognite/client/_api/units.py @@ -48,13 +48,14 @@ def retrieve( Unit | UnitList | None: If a single external ID is specified: the requested unit, or None if it does not exist. If several external IDs are specified: the requested units. Examples: - Retrive unit 'temperature:deg_c' + + Retrive unit 'temperature:deg_c':: >>> from cognite.client import CogniteClient >>> c = CogniteClient() >>> res = c.units.retrieve('temperature:deg_c') - Retrive units 'temperature:deg_c' and 'pressure:bar' + Retrive units 'temperature:deg_c' and 'pressure:bar':: >>> from cognite.client import CogniteClient >>> c = CogniteClient() @@ -76,7 +77,8 @@ def list(self) -> UnitList: UnitList: List of units Examples: - List all supported unit in CDF: + + List all supported unit in CDF:: >>> from cognite.client import CogniteClient >>> c = CogniteClient() @@ -95,7 +97,6 @@ def __init__( cognite_client: CogniteClient, ) -> None: super().__init__(config, api_version, cognite_client) - self._api_subversion = "beta" def list(self) -> UnitSystemList: """`List all supported unit systems `_ @@ -104,7 +105,8 @@ def list(self) -> UnitSystemList: UnitSystemList: List of unit systems Examples: - List all supported unit systems in CDF: + + List all supported unit systems in CDF:: >>> from cognite.client import CogniteClient >>> c = CogniteClient() diff --git a/docs/source/unit_catalog.rst b/docs/source/unit_catalog.rst index f60b54729a..194d5f64a1 100644 --- a/docs/source/unit_catalog.rst +++ b/docs/source/unit_catalog.rst @@ -1,14 +1,6 @@ Unit Catalog ====================== -.. warning:: - Unit Catalog is a new feature: - * The API specification is in beta. - * The SDK implementation is in alpha. - - Thus, breaking changes may occur without further notice, see :ref:`appendix-alpha-beta-features` for more information. - - Units ------------ List Units From fed64d484b4e9f3208b1f2170ec260e353aff75b Mon Sep 17 00:00:00 2001 From: Ivan Polomani Date: Thu, 23 Nov 2023 12:59:26 +0100 Subject: [PATCH 6/9] Update units.py --- cognite/client/_api/units.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cognite/client/_api/units.py b/cognite/client/_api/units.py index 1125514972..508850220a 100644 --- a/cognite/client/_api/units.py +++ b/cognite/client/_api/units.py @@ -71,7 +71,7 @@ def retrieve( ) def list(self) -> UnitList: - """`List all supported units `_ + """`List all supported units `_ Returns: UnitList: List of units From a6a262d9d48917cac00bc77d3180ef911ddffaa4 Mon Sep 17 00:00:00 2001 From: Ivan Polomani Date: Fri, 24 Nov 2023 11:55:23 +0100 Subject: [PATCH 7/9] Update the version number --- CHANGELOG.md | 4 ++++ cognite/client/_version.py | 2 +- pyproject.toml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 968274efb8..927d5b8312 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ Changes are grouped as follows - `Fixed` for any bug fixes. - `Security` in case of vulnerabilities. +## [7.4.0] - 2023-11-24 +### Added +- Unit Catalog API is now considered stable and can be accessed at `client.units`. + ## [7.3.3] - 2023-11-22 ### Fixed - Added action `Delete` in `ProjectsAcl`. diff --git a/cognite/client/_version.py b/cognite/client/_version.py index 1c585e9416..90ffdb3982 100644 --- a/cognite/client/_version.py +++ b/cognite/client/_version.py @@ -1,4 +1,4 @@ from __future__ import annotations -__version__ = "7.3.3" +__version__ = "7.4.0" __api_subversion__ = "V20220125" diff --git a/pyproject.toml b/pyproject.toml index 1e1cbc7802..9927b5fe89 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "cognite-sdk" -version = "7.3.3" +version = "7.4.0" description = "Cognite Python SDK" readme = "README.md" documentation = "https://cognite-sdk-python.readthedocs-hosted.com" From f81e9f99c6be42aec460246b3795cdff9dc84de0 Mon Sep 17 00:00:00 2001 From: Ivan Polomani Date: Mon, 27 Nov 2023 09:58:17 +0100 Subject: [PATCH 8/9] Update CHANGELOG.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: HÃ¥kon V. Treider --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 927d5b8312..2286e2c424 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,9 +17,9 @@ Changes are grouped as follows - `Fixed` for any bug fixes. - `Security` in case of vulnerabilities. -## [7.4.0] - 2023-11-24 -### Added -- Unit Catalog API is now considered stable and can be accessed at `client.units`. +## [7.4.0] - 2023-11-27 +### Changed +- Unit Catalog API is out of beta and will no longer issue warnings on usage. Access is unchanged: `client.units`. ## [7.3.3] - 2023-11-22 ### Fixed From 2795e6143cdbcc6562c0601761d0737c2ce3e091 Mon Sep 17 00:00:00 2001 From: Ivan Polomani Date: Mon, 27 Nov 2023 12:11:46 +0100 Subject: [PATCH 9/9] Remove redundant constructor --- cognite/client/_api/units.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/cognite/client/_api/units.py b/cognite/client/_api/units.py index 508850220a..15a536a64a 100644 --- a/cognite/client/_api/units.py +++ b/cognite/client/_api/units.py @@ -90,14 +90,6 @@ def list(self) -> UnitList: class UnitSystemAPI(APIClient): _RESOURCE_PATH = "/units/systems" - def __init__( - self, - config: ClientConfig, - api_version: str | None, - cognite_client: CogniteClient, - ) -> None: - super().__init__(config, api_version, cognite_client) - def list(self) -> UnitSystemList: """`List all supported unit systems `_