diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a565484..ea7995c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,20 @@ This project uses [*towncrier*](https://towncrier.readthedocs.io/) and the chang +## [1.14.0](https://github.com/opsmill/infrahub-sdk-python/tree/v1.14.0) - 2025-08-26 + +### Added + +- Added `infrahubctl repository init` command to allow the initialization of an Infrahub repository using [infrahub-template](https://github.com/opsmill/infrahub-template). ([#466](https://github.com/opsmill/infrahub-sdk-python/issues/466)) +- add support for NumberPool attributes in generated protocols + +### Fixed + +- Fix value lookup using a flat notation like `foo__bar__value` with relationships of cardinality one ([#6882](https://github.com/opsmill/infrahub-sdk-python/issues/6882)) +- Create a new batch while fetching relationships instead of using the reusing the same one. +- Update internal calls to `count` to include the branch parameter so that the query is performed on the correct branch +- Update offset in process_page() which was causing a race condition in rare case. ([#514](https://github.com/opsmill/infrahub-sdk-python/pull/514)) + ## [1.13.5](https://github.com/opsmill/infrahub-sdk-python/tree/v1.13.5) - 2025-07-23 ### Fixed diff --git a/changelog/+add_numberpool_support_protocols.added.md b/changelog/+add_numberpool_support_protocols.added.md deleted file mode 100644 index aef27a24..00000000 --- a/changelog/+add_numberpool_support_protocols.added.md +++ /dev/null @@ -1 +0,0 @@ -add support for NumberPool attributes in generated protocols diff --git a/changelog/+batch.fixed.md b/changelog/+batch.fixed.md deleted file mode 100644 index 635d6b62..00000000 --- a/changelog/+batch.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Create a new batch while fetching relationships instead of using the reusing the same one. \ No newline at end of file diff --git a/changelog/+branch-in-count.fixed.md b/changelog/+branch-in-count.fixed.md deleted file mode 100644 index b4227386..00000000 --- a/changelog/+branch-in-count.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Update internal calls to `count` to include the branch parameter so that the query is performed on the correct branch \ No newline at end of file diff --git a/changelog/466.added.md b/changelog/466.added.md deleted file mode 100644 index 49d639ef..00000000 --- a/changelog/466.added.md +++ /dev/null @@ -1 +0,0 @@ -Added `infrahubctl repository init` command to allow the initialization of an Infrahub repository using [infrahub-template](https://github.com/opsmill/infrahub-template). \ No newline at end of file diff --git a/changelog/6882.fixed.md b/changelog/6882.fixed.md deleted file mode 100644 index c0c8cebc..00000000 --- a/changelog/6882.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fix value lookup using a flat notation like `foo__bar__value` with relationships of cardinality one \ No newline at end of file diff --git a/infrahub_sdk/client.py b/infrahub_sdk/client.py index 16c1c73a..4a6ad81b 100644 --- a/infrahub_sdk/client.py +++ b/infrahub_sdk/client.py @@ -790,7 +790,7 @@ async def filters( async def process_page(page_offset: int, page_number: int) -> tuple[dict, ProcessRelationsNode]: """Process a single page of results.""" query_data = await InfrahubNode(client=self, schema=schema, branch=branch).generate_query_data( - offset=offset or page_offset, + offset=page_offset if offset is None else offset, limit=limit or pagination_size, filters=filters, include=include, @@ -1954,7 +1954,7 @@ def filters( def process_page(page_offset: int, page_number: int) -> tuple[dict, ProcessRelationsNodeSync]: """Process a single page of results.""" query_data = InfrahubNodeSync(client=self, schema=schema, branch=branch).generate_query_data( - offset=offset or page_offset, + offset=page_offset if offset is None else offset, limit=limit or pagination_size, filters=filters, include=include, diff --git a/infrahub_sdk/node/node.py b/infrahub_sdk/node/node.py index 242281b5..4eb1d0d3 100644 --- a/infrahub_sdk/node/node.py +++ b/infrahub_sdk/node/node.py @@ -1,7 +1,7 @@ from __future__ import annotations from collections.abc import Iterable -from copy import copy +from copy import copy, deepcopy from typing import TYPE_CHECKING, Any from ..constants import InfrahubClientMode @@ -397,7 +397,7 @@ def generate_query_data_init( "edges": {"node": {"id": None, "hfid": None, "display_label": None, "__typename": None}}, } - data["@filters"] = filters or {} + data["@filters"] = deepcopy(filters) if filters is not None else {} if order: data["@filters"]["order"] = order diff --git a/poetry.lock b/poetry.lock index b3a5cbfc..1be50f8e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -224,15 +224,15 @@ markers = {main = "extra == \"ctl\" or extra == \"all\" or sys_platform == \"win [[package]] name = "copier" -version = "9.8.0" +version = "9.9.1" description = "A library for rendering project templates." optional = true python-versions = ">=3.9" groups = ["main"] markers = "extra == \"ctl\" or extra == \"all\"" files = [ - {file = "copier-9.8.0-py3-none-any.whl", hash = "sha256:ca0bee47f198b66cec926c4f1a3aa77f11ee0102624369c10e42ca9058c0a891"}, - {file = "copier-9.8.0.tar.gz", hash = "sha256:343ac1eb65e678aa355690d7f19869ef07cabf837f511a87ed452443c085ec58"}, + {file = "copier-9.9.1-py3-none-any.whl", hash = "sha256:9439280baca00194933b04885f1376b17e3287c2324053666fbe9a7a0aceaa44"}, + {file = "copier-9.9.1.tar.gz", hash = "sha256:244bdf3ec5eb460dbe45ef22b825e9897b0bcc9d94ca96dad3ced3d786cfeab7"}, ] [package.dependencies] diff --git a/pyproject.toml b/pyproject.toml index 17c0ccd3..c51c7ae1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "infrahub-sdk" -version = "1.13.5" +version = "1.14.0" description = "Python Client to interact with Infrahub" authors = ["OpsMill "] readme = "README.md"