Conversation
Merge develop into infrahub-develop
Merge develop into infrahub-develop
Merge develop into infrahub-develop
Merge stable into develop
Merge develop into infrahub-develop
Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 4 to 7. - [Release notes](https://github.com/astral-sh/setup-uv/releases) - [Commits](astral-sh/setup-uv@v4...v7) --- updated-dependencies: - dependency-name: astral-sh/setup-uv dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v5...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [DavidAnson/markdownlint-cli2-action](https://github.com/davidanson/markdownlint-cli2-action) from 21 to 22. - [Release notes](https://github.com/davidanson/markdownlint-cli2-action/releases) - [Commits](DavidAnson/markdownlint-cli2-action@v21...v22) --- updated-dependencies: - dependency-name: DavidAnson/markdownlint-cli2-action dependency-version: '22' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](actions/cache@v4...v5) --- updated-dependencies: - dependency-name: actions/cache dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Fatih Acar <fatih@opsmill.com>
Signed-off-by: Fatih Acar <fatih@opsmill.com>
Signed-off-by: Fatih Acar <fatih@opsmill.com>
Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 4 to 7. - [Release notes](https://github.com/astral-sh/setup-uv/releases) - [Commits](astral-sh/setup-uv@v4...v7) --- updated-dependencies: - dependency-name: astral-sh/setup-uv dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v5...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [DavidAnson/markdownlint-cli2-action](https://github.com/davidanson/markdownlint-cli2-action) from 21 to 22. - [Release notes](https://github.com/davidanson/markdownlint-cli2-action/releases) - [Commits](DavidAnson/markdownlint-cli2-action@v21...v22) --- updated-dependencies: - dependency-name: DavidAnson/markdownlint-cli2-action dependency-version: '22' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](actions/cache@v4...v5) --- updated-dependencies: - dependency-name: actions/cache dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Fatih Acar <fatih@opsmill.com>
Signed-off-by: Fatih Acar <fatih@opsmill.com>
Signed-off-by: Fatih Acar <fatih@opsmill.com>
Remove deprecated 'background_execution' param from client.branch.create()
Merge stable into develop
Merge develop into infrahub-develop
Add ability to query for node metadata
Upgrade ty and cleanup rules
Use pathlib instead of os for Path operations
Fix unsupported operator on MainSchemaTypes
Upgrade ty=0.0.8
Fix test annotations on unit tests
Merge stable into develop
…20251230b Merge 'develop' into 'infrahub-develop' with resolved conflicts
Fixes #187 This PR rewrites integration tests that were previously disabled. These tests are now based on the `TestInfrahubDockerClient`. Some tests are marked as `XFAIL` for now as they either highlight issues or require a different version of Infrahub server.
Add ability to order results by metadata created_at or updated_at
Merge stable into develop
Merge develop into infrahub-develop
* Add docs for metadata and ordering * Add relationship metadata * Remove test file
Deploying infrahub-sdk-python with
|
| Latest commit: |
2017aa9
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://6351e494.infrahub-sdk-python.pages.dev |
| Branch Preview URL: | https://wvd-20260108-prep-release-1.infrahub-sdk-python.pages.dev |
WalkthroughThis pull request increments the SDK to version 1.18.0, introducing node and relationship metadata query support with new 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## stable #739 +/- ##
==========================================
+ Coverage 76.87% 80.31% +3.44%
==========================================
Files 113 115 +2
Lines 9776 9883 +107
Branches 1499 1520 +21
==========================================
+ Hits 7515 7938 +423
+ Misses 1754 1417 -337
- Partials 507 528 +21
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 10 files with indirect coverage changes 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
tests/unit/sdk/test_node.py (1)
1876-1882: UseInfrahubNodeSyncfortag_bluein the sync branchIn
test_update_input_data_empty_relationship, the sync path creates:
location = InfrahubNodeSync(...)tag_blue = InfrahubNode(...)(async variant)Given all other tests pair sync nodes with sync peers, this looks unintentional and makes the sync branch slightly inconsistent. It’s probably working because both share a base type, but it’s clearer (and safer for future refactors) to use the sync node type for
tag_bluehere as well.Suggested adjustment
- else: - location = InfrahubNodeSync(client=client, schema=location_schema, data=location_data) - tag_blue = InfrahubNode(client=client, schema=tag_schema, data=tag_blue_data) + else: + location = InfrahubNodeSync(client=client, schema=location_schema, data=location_data) + tag_blue = InfrahubNodeSync(client=client, schema=tag_schema, data=tag_blue_data)docs/docs/python-sdk/guides/query_data.mdx (2)
9-14: Inconsistent count: states "3 ways" but lists 4 methods.The text says "We can query data in 3 ways" but actually lists 4 bullet points.
📝 Suggested fix
-We can query data in 3 ways using the SDK: +We can query data in 4 ways using the SDK:
109-111: Missingawaitin async example.The async example for the
filtersmethod is missing theawaitkeyword.📝 Suggested fix
- tags = client.filters(kind="BuiltinTag", name__values=["RED", "BLUE"]) + tags = await client.filters(kind="BuiltinTag", name__values=["RED", "BLUE"])
🤖 Fix all issues with AI agents
In @.github/workflows/ci.yml:
- Line 89: The CI lint job currently runs the command "run: uv sync --all-groups
--all-extras" which installs unnecessary dependency groups; update the
python-lint job to only sync the lint group by changing that command to use "uv
sync --group lint" (or "uv sync --group lint --group types" only if you later
add mypy), so the job installs just ruff, yamllint, ty and their required extras
instead of all optional/test groups.
🧹 Nitpick comments (9)
tests/unit/ctl/test_transform_app.py (1)
21-23: Remove redundantPath()wrapper.The expression
Path(Path(__file__).resolve())contains a redundant outerPath()call since.resolve()already returns aPathobject.♻️ Simplified path construction
-FIXTURE_BASE_DIR = Path( - Path(Path(__file__).resolve()).parent / ".." / ".." / "fixtures" / "integration" / "test_infrahubctl" -) +FIXTURE_BASE_DIR = Path(__file__).resolve().parent / ".." / ".." / "fixtures" / "integration" / "test_infrahubctl"Alternatively, for even better readability, you could use
.parentmultiple times instead of".."strings:-FIXTURE_BASE_DIR = Path( - Path(Path(__file__).resolve()).parent / ".." / ".." / "fixtures" / "integration" / "test_infrahubctl" -) +FIXTURE_BASE_DIR = Path(__file__).resolve().parent.parent.parent / "fixtures" / "integration" / "test_infrahubctl"tests/unit/ctl/test_render_app.py (1)
16-16: Remove redundantPath()wrapper.The expression
Path(Path(Path(__file__).resolve()).parent / ...)contains a redundant outerPath()call since.resolve()already returns aPathobject, and the subsequent operations maintain thePathtype.♻️ Simplified path construction
-FIXTURE_BASE_DIR = Path(Path(Path(__file__).resolve()).parent / ".." / ".." / "fixtures" / "repos") +FIXTURE_BASE_DIR = Path(__file__).resolve().parent / ".." / ".." / "fixtures" / "repos"Alternatively, for even better readability, you could use
.parentmultiple times:-FIXTURE_BASE_DIR = Path(Path(Path(__file__).resolve()).parent / ".." / ".." / "fixtures" / "repos") +FIXTURE_BASE_DIR = Path(__file__).resolve().parent.parent.parent / "fixtures" / "repos"tests/unit/sdk/test_group_context.py (1)
2-8: BroadenCallabletypes used for return-annotation transformersImporting
Callableand typingstd_group_schemaasNodeSchemaAPIis a good improvement. Fortest_validate_method_signature, though,replace_sync_return_annotation/replace_async_return_annotationare currently typed asCallable[[str], str]but are invoked withinspect.Signature.return_annotation, which may be arbitrary types (orinspect._empty), not juststr. Consider relaxing these to something likeCallable[[object], object]orCallable[[Any], Any]to reflect actual usage and avoid misleading type information.Also applies to: 21-26, 72-80
infrahub_sdk/client.py (1)
785-805: Asyncfiltersdocstring return type is slightly misleadingWhile the new
include_metadataparameter and behavior are correct, thefiltersdocstring still says:Returns:
list[InfrahubNodeSync]for the async client. That should ideally mention
InfrahubNode/ the async schema type instead to match the actual return type. Purely a documentation nit, but easy to fix alongside these signature changes.Also applies to: 805-827
infrahub_sdk/branch.py (1)
63-81: Consider fixing missing'?'ingenerate_diff_data_urlUnrelated to the new
wait_until_completionwork, but while you’re here:generate_diff_data_urlcurrently returnsurl + urlencode(url_params), which will produce paths like/api/diff/databranch=...instead of/api/diff/data?branch=.... That’s very likely incorrect for the diff-data API.Suggest adjusting this to insert a
"?"before the encoded params (or useurllib.parse.urlencodewith proper joining) in a follow-up change.tests/integration/test_export_import.py (2)
106-135: Consider making tests independent to improve reliability.The tests
test_step01_export_no_schemaandtest_step02_import_no_schemaappear to have an execution order dependency, where step02 relies on the files exported by step01. While this may work in practice, test execution order is not guaranteed by pytest, which could lead to flaky tests.Consider refactoring to make tests independent by:
- Using fixtures to set up the required export files for each test
- Or explicitly documenting the execution order requirement with pytest plugins like
pytest-orderThe same pattern appears in later tests (step03-step05) and in the
TestSchemaExportImportManyRelationshipsclass.
101-104: Consider using fixture teardown for cleanup.The
reset_export_directorymethod is called manually within test bodies. While this works, using pytest fixture teardown (withyieldand cleanup after) would ensure cleanup happens even if tests fail and would make the cleanup pattern more explicit.Example fixture pattern
@pytest.fixture(scope="class") def export_directory(self, temporary_directory: Path) -> Generator[Path, None, None]: yield temporary_directory # Cleanup after tests for file in temporary_directory.iterdir(): if file.is_file(): file.unlink()Also applies to: 135-135, 182-182, 265-268, 327-327
infrahub_sdk/graphql/renderers.py (1)
58-86: Consider refactoring to reduce code duplication.The handling for
Order(lines 58-67),BaseModel(lines 68-77), anddict(lines 78-86) follows nearly identical logic, with only minor variations:
Orderusesmodel_dump(exclude_none=True)BaseModelusesmodel_dump()withoutexclude_nonedictdirectly iterates over itemsWhile the current ordering is correct (Order before BaseModel to handle it specifically), consider extracting the common key-value iteration pattern into a helper function to reduce duplication.
Additionally, it would be helpful to document why
Orderspecifically requiresexclude_none=Truewhile otherBaseModelinstances do not.Example refactor
def _render_dict_as_graphql(data: dict, convert_enum: bool = False) -> str: return ( "{ " + ", ".join( f"{key}: {convert_to_graphql_as_string(value=val, convert_enum=convert_enum)}" for key, val in data.items() ) + " }" ) # Then use it: if isinstance(value, Order): # exclude_none=True for Order to omit optional fields in GraphQL queries return _render_dict_as_graphql(value.model_dump(exclude_none=True), convert_enum) if isinstance(value, BaseModel): return _render_dict_as_graphql(value.model_dump(), convert_enum) if isinstance(value, dict): return _render_dict_as_graphql(value, convert_enum)tests/integration/test_schema.py (1)
1-1: Unused import.
Anyis imported but not used in this file.♻️ Suggested fix
-from typing import Any
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (57)
.github/workflows/ci.ymlCHANGELOG.mdchangelog/+1b40f022.housekeeping.mdchangelog/630.fixed.mddocs/docs/python-sdk/guides/query_data.mdxinfrahub_sdk/branch.pyinfrahub_sdk/checks.pyinfrahub_sdk/client.pyinfrahub_sdk/enums.pyinfrahub_sdk/graphql/renderers.pyinfrahub_sdk/node/attribute.pyinfrahub_sdk/node/constants.pyinfrahub_sdk/node/metadata.pyinfrahub_sdk/node/node.pyinfrahub_sdk/node/property.pyinfrahub_sdk/node/related_node.pyinfrahub_sdk/node/relationship.pyinfrahub_sdk/operation.pyinfrahub_sdk/types.pypyproject.tomltests/conftest.pytests/fixtures/integration/test_infrahubctl/tags_transform/tags_transform.pytests/fixtures/repos/ctl_integration/transforms/animal_person.pytests/fixtures/repos/ctl_integration/transforms/converted.pytests/helpers/utils.pytests/integration/conftest.pytests/integration/test_convert_object_type.pytests/integration/test_export_import.pytests/integration/test_infrahub_client.pytests/integration/test_infrahub_client_sync.pytests/integration/test_infrahubctl.pytests/integration/test_node.pytests/integration/test_object_store.pytests/integration/test_repository.pytests/integration/test_schema.pytests/unit/ctl/test_branch_app.pytests/unit/ctl/test_branch_report.pytests/unit/ctl/test_cli.pytests/unit/ctl/test_graphql_app.pytests/unit/ctl/test_render_app.pytests/unit/ctl/test_repository_app.pytests/unit/ctl/test_transform_app.pytests/unit/pytest_plugin/test_plugin.pytests/unit/sdk/checks/test_checks.pytests/unit/sdk/conftest.pytests/unit/sdk/graphql/test_renderer.pytests/unit/sdk/test_batch.pytests/unit/sdk/test_branch.pytests/unit/sdk/test_group_context.pytests/unit/sdk/test_node.pytests/unit/sdk/test_protocols_generator.pytests/unit/sdk/test_query_analyzer.pytests/unit/sdk/test_repository.pytests/unit/sdk/test_schema_sorter.pytests/unit/sdk/test_store_branch.pytests/unit/sdk/test_timestamp.pytests/unit/sdk/test_utils.py
💤 Files with no reviewable changes (2)
- changelog/+1b40f022.housekeeping.md
- changelog/630.fixed.md
🧰 Additional context used
📓 Path-based instructions (9)
**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
**/*.py: Use type hints on all function signatures
Never mix async/sync inappropriately
Never bypass type checking without justification
Files:
infrahub_sdk/enums.pytests/fixtures/repos/ctl_integration/transforms/animal_person.pytests/unit/sdk/conftest.pytests/integration/test_export_import.pytests/conftest.pytests/fixtures/repos/ctl_integration/transforms/converted.pytests/unit/sdk/test_batch.pytests/integration/test_convert_object_type.pytests/unit/sdk/test_group_context.pytests/unit/ctl/test_cli.pyinfrahub_sdk/graphql/renderers.pytests/unit/ctl/test_graphql_app.pytests/integration/conftest.pytests/unit/ctl/test_transform_app.pytests/unit/sdk/test_timestamp.pytests/unit/sdk/test_protocols_generator.pyinfrahub_sdk/node/constants.pytests/unit/sdk/test_utils.pyinfrahub_sdk/node/property.pytests/integration/test_node.pyinfrahub_sdk/node/related_node.pytests/unit/sdk/test_query_analyzer.pyinfrahub_sdk/checks.pyinfrahub_sdk/node/metadata.pytests/fixtures/integration/test_infrahubctl/tags_transform/tags_transform.pytests/unit/sdk/checks/test_checks.pytests/unit/sdk/test_schema_sorter.pytests/unit/sdk/test_branch.pytests/integration/test_infrahubctl.pyinfrahub_sdk/branch.pytests/integration/test_repository.pytests/helpers/utils.pytests/unit/sdk/graphql/test_renderer.pyinfrahub_sdk/node/node.pytests/unit/sdk/test_repository.pytests/unit/ctl/test_render_app.pytests/unit/sdk/test_store_branch.pytests/integration/test_infrahub_client_sync.pytests/integration/test_object_store.pyinfrahub_sdk/node/relationship.pytests/integration/test_schema.pytests/unit/ctl/test_branch_app.pytests/unit/ctl/test_repository_app.pyinfrahub_sdk/operation.pytests/unit/ctl/test_branch_report.pyinfrahub_sdk/client.pyinfrahub_sdk/types.pytests/integration/test_infrahub_client.pytests/unit/sdk/test_node.pyinfrahub_sdk/node/attribute.pytests/unit/pytest_plugin/test_plugin.py
infrahub_sdk/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
Follow async/sync dual pattern for new features in the Python SDK
Files:
infrahub_sdk/enums.pyinfrahub_sdk/graphql/renderers.pyinfrahub_sdk/node/constants.pyinfrahub_sdk/node/property.pyinfrahub_sdk/node/related_node.pyinfrahub_sdk/checks.pyinfrahub_sdk/node/metadata.pyinfrahub_sdk/branch.pyinfrahub_sdk/node/node.pyinfrahub_sdk/node/relationship.pyinfrahub_sdk/operation.pyinfrahub_sdk/client.pyinfrahub_sdk/types.pyinfrahub_sdk/node/attribute.py
tests/**/*.py
📄 CodeRabbit inference engine (tests/AGENTS.md)
tests/**/*.py: Usehttpx_mockfixture for HTTP mocking in tests instead of making real HTTP requests
Do not add@pytest.mark.asynciodecorator to async test functions (async auto-mode is globally enabled)
Files:
tests/fixtures/repos/ctl_integration/transforms/animal_person.pytests/unit/sdk/conftest.pytests/integration/test_export_import.pytests/conftest.pytests/fixtures/repos/ctl_integration/transforms/converted.pytests/unit/sdk/test_batch.pytests/integration/test_convert_object_type.pytests/unit/sdk/test_group_context.pytests/unit/ctl/test_cli.pytests/unit/ctl/test_graphql_app.pytests/integration/conftest.pytests/unit/ctl/test_transform_app.pytests/unit/sdk/test_timestamp.pytests/unit/sdk/test_protocols_generator.pytests/unit/sdk/test_utils.pytests/integration/test_node.pytests/unit/sdk/test_query_analyzer.pytests/fixtures/integration/test_infrahubctl/tags_transform/tags_transform.pytests/unit/sdk/checks/test_checks.pytests/unit/sdk/test_schema_sorter.pytests/unit/sdk/test_branch.pytests/integration/test_infrahubctl.pytests/integration/test_repository.pytests/helpers/utils.pytests/unit/sdk/graphql/test_renderer.pytests/unit/sdk/test_repository.pytests/unit/ctl/test_render_app.pytests/unit/sdk/test_store_branch.pytests/integration/test_infrahub_client_sync.pytests/integration/test_object_store.pytests/integration/test_schema.pytests/unit/ctl/test_branch_app.pytests/unit/ctl/test_repository_app.pytests/unit/ctl/test_branch_report.pytests/integration/test_infrahub_client.pytests/unit/sdk/test_node.pytests/unit/pytest_plugin/test_plugin.py
tests/unit/**/*.py
📄 CodeRabbit inference engine (tests/AGENTS.md)
Unit tests must be fast, mocked, and have no external dependencies
Files:
tests/unit/sdk/conftest.pytests/unit/sdk/test_batch.pytests/unit/sdk/test_group_context.pytests/unit/ctl/test_cli.pytests/unit/ctl/test_graphql_app.pytests/unit/ctl/test_transform_app.pytests/unit/sdk/test_timestamp.pytests/unit/sdk/test_protocols_generator.pytests/unit/sdk/test_utils.pytests/unit/sdk/test_query_analyzer.pytests/unit/sdk/checks/test_checks.pytests/unit/sdk/test_schema_sorter.pytests/unit/sdk/test_branch.pytests/unit/sdk/graphql/test_renderer.pytests/unit/sdk/test_repository.pytests/unit/ctl/test_render_app.pytests/unit/sdk/test_store_branch.pytests/unit/ctl/test_branch_app.pytests/unit/ctl/test_repository_app.pytests/unit/ctl/test_branch_report.pytests/unit/sdk/test_node.pytests/unit/pytest_plugin/test_plugin.py
tests/integration/**/*.py
📄 CodeRabbit inference engine (tests/AGENTS.md)
tests/integration/**/*.py: Integration tests should use testcontainers to interact with real Infrahub instances
Clean up resources in integration tests
Files:
tests/integration/test_export_import.pytests/integration/test_convert_object_type.pytests/integration/conftest.pytests/integration/test_node.pytests/integration/test_infrahubctl.pytests/integration/test_repository.pytests/integration/test_infrahub_client_sync.pytests/integration/test_object_store.pytests/integration/test_schema.pytests/integration/test_infrahub_client.py
**/*.{md,mdx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{md,mdx}: Usetextlanguage for directory structure code blocks in markdown documentation
Add blank lines before and after lists in markdown documentation
Always specify language in fenced code blocks in markdown documentation
Files:
docs/docs/python-sdk/guides/query_data.mdxCHANGELOG.md
docs/docs/**/*.mdx
📄 CodeRabbit inference engine (docs/AGENTS.md)
docs/docs/**/*.mdx: Create MDX files in appropriate directory within docs structure (guides, topics, or reference)
Add frontmatter withtitlefield to MDX documentation files
Use callouts (:::warning, :::note, etc.) for important notes and information in documentation
Files:
docs/docs/python-sdk/guides/query_data.mdx
docs/docs/python-sdk/{guides,topics}/**/*.mdx
📄 CodeRabbit inference engine (docs/AGENTS.md)
docs/docs/python-sdk/{guides,topics}/**/*.mdx: Use Tabs component from '@theme/Tabs' for async/sync examples in documentation
Include both async/sync examples using Tabs in documentation
Files:
docs/docs/python-sdk/guides/query_data.mdx
infrahub_sdk/client.py
📄 CodeRabbit inference engine (AGENTS.md)
Always provide both async and sync versions of client implementations in InfrahubClient
Files:
infrahub_sdk/client.py
🧠 Learnings (13)
📚 Learning: 2025-12-10T17:13:08.136Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:08.136Z
Learning: Run `uv run invoke format lint` before committing Python code
Applied to files:
.github/workflows/ci.yml
📚 Learning: 2025-12-10T17:13:37.990Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: tests/AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:37.990Z
Learning: Applies to tests/**/*.py : Use `httpx_mock` fixture for HTTP mocking in tests instead of making real HTTP requests
Applied to files:
tests/unit/sdk/conftest.pytests/unit/ctl/test_cli.pytests/unit/sdk/test_protocols_generator.pytests/unit/sdk/checks/test_checks.pytests/unit/sdk/test_schema_sorter.pytests/unit/ctl/test_render_app.pytests/unit/ctl/test_branch_app.pytests/unit/ctl/test_repository_app.pytests/unit/ctl/test_branch_report.pytests/unit/sdk/test_node.py
📚 Learning: 2025-12-10T17:13:29.593Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: infrahub_sdk/pytest_plugin/AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:29.593Z
Learning: Applies to infrahub_sdk/pytest_plugin/**/infrahub_sdk/pytest_plugin/loader.py : Register new test items in `ITEMS_MAPPING` in `infrahub_sdk/pytest_plugin/loader.py`
Applied to files:
tests/conftest.pytests/unit/pytest_plugin/test_plugin.py
📚 Learning: 2025-12-10T17:13:29.593Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: infrahub_sdk/pytest_plugin/AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:29.593Z
Learning: Applies to infrahub_sdk/pytest_plugin/**/infrahub_sdk/pytest_plugin/items/*.py : Inherit from `InfrahubItem` base class when creating new test item classes in `infrahub_sdk/pytest_plugin/items/`
Applied to files:
tests/conftest.pytests/integration/test_convert_object_type.pytests/unit/sdk/checks/test_checks.py
📚 Learning: 2025-12-10T17:13:08.136Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:08.136Z
Learning: Applies to infrahub_sdk/client.py : Always provide both async and sync versions of client implementations in InfrahubClient
Applied to files:
tests/integration/test_convert_object_type.pypyproject.tomltests/unit/sdk/checks/test_checks.pytests/unit/sdk/test_branch.pyinfrahub_sdk/client.pytests/unit/sdk/test_node.py
📚 Learning: 2025-12-10T17:13:37.990Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: tests/AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:37.990Z
Learning: Applies to tests/integration/**/*.py : Integration tests should use testcontainers to interact with real Infrahub instances
Applied to files:
tests/integration/test_convert_object_type.pytests/unit/ctl/test_transform_app.pytests/unit/sdk/checks/test_checks.pytests/integration/test_infrahub_client_sync.pytests/integration/test_infrahub_client.py
📚 Learning: 2025-12-10T17:13:29.593Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: infrahub_sdk/pytest_plugin/AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:29.593Z
Learning: Applies to infrahub_sdk/pytest_plugin/**/*.yaml : Use YAML test format with required fields: `infrahub_tests`, `resource`, `resource_name`, `tests` array containing `name`, `spec.kind`, `input`, and `output`
Applied to files:
tests/integration/test_convert_object_type.pytests/unit/sdk/checks/test_checks.pytests/integration/test_infrahubctl.pytests/unit/pytest_plugin/test_plugin.py
📚 Learning: 2025-12-10T17:13:21.977Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: infrahub_sdk/ctl/AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:21.977Z
Learning: Applies to infrahub_sdk/ctl/**/*.py : Do not instantiate InfrahubClient directly; always use initialize_client() or initialize_client_sync() helper functions
Applied to files:
tests/integration/test_convert_object_type.py
📚 Learning: 2025-12-10T17:13:08.136Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:08.136Z
Learning: Applies to **/*.py : Never bypass type checking without justification
Applied to files:
pyproject.toml
📚 Learning: 2025-11-25T13:23:15.190Z
Learnt from: wvandeun
Repo: opsmill/infrahub-sdk-python PR: 637
File: infrahub_sdk/operation.py:74-76
Timestamp: 2025-11-25T13:23:15.190Z
Learning: In infrahub_sdk/operation.py, the recursive=True parameter in _process_relationships is a temporary workaround to access Proposed Changes data. This will be replaced with proper object-level metadata implementation in version 1.7.
Applied to files:
infrahub_sdk/node/related_node.pyinfrahub_sdk/node/relationship.py
📚 Learning: 2025-12-10T17:13:08.136Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:08.136Z
Learning: Applies to infrahub_sdk/**/*.py : Follow async/sync dual pattern for new features in the Python SDK
Applied to files:
tests/unit/sdk/checks/test_checks.pytests/unit/sdk/test_branch.pyinfrahub_sdk/client.py
📚 Learning: 2025-12-10T17:13:08.136Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-10T17:13:08.136Z
Learning: Applies to **/*.py : Use type hints on all function signatures
Applied to files:
tests/unit/sdk/test_branch.py
📚 Learning: 2025-11-25T13:29:23.062Z
Learnt from: wvandeun
Repo: opsmill/infrahub-sdk-python PR: 637
File: infrahub_sdk/ctl/branch.py:290-290
Timestamp: 2025-11-25T13:29:23.062Z
Learning: In infrahub_sdk/ctl/branch.py, the report command uses pc.created_by.updated_at to display "Created at" for proposed changes as a workaround because the SDK doesn't have easy access to the creation time of the proposed change. This will be replaced with proper object-level metadata implementation in version 1.7 of Infrahub.
Applied to files:
infrahub_sdk/branch.py
🧬 Code graph analysis (31)
infrahub_sdk/enums.py (1)
infrahub_sdk/protocols_base.py (1)
Enum(110-111)
tests/fixtures/repos/ctl_integration/transforms/animal_person.py (3)
tests/fixtures/integration/test_infrahubctl/tags_transform/tags_transform.py (1)
transform(10-15)tests/fixtures/repos/ctl_integration/transforms/converted.py (1)
transform(10-18)infrahub_sdk/transforms.py (1)
transform(53-54)
tests/integration/test_export_import.py (5)
infrahub_sdk/transfer/exceptions.py (1)
TransferFileNotFoundError(7-7)infrahub_sdk/transfer/exporter/json.py (2)
LineDelimitedJSONExporter(24-169)export(101-169)infrahub_sdk/transfer/importer/json.py (2)
LineDelimitedJSONImporter(27-200)import_data(54-99)infrahub_sdk/transfer/schema_sorter.py (1)
InfrahubSchemaTopologicalSorter(13-33)tests/unit/sdk/conftest.py (1)
client(32-33)
tests/fixtures/repos/ctl_integration/transforms/converted.py (3)
tests/fixtures/integration/test_infrahubctl/tags_transform/tags_transform.py (1)
transform(10-15)tests/fixtures/repos/ctl_integration/transforms/animal_person.py (1)
transform(9-16)infrahub_sdk/transforms.py (1)
transform(53-54)
tests/unit/sdk/test_batch.py (1)
tests/unit/sdk/conftest.py (2)
mock_query_mutation_location_create_failed(2152-2169)mock_schema_query_01(1815-1822)
tests/integration/test_convert_object_type.py (3)
infrahub_sdk/client.py (4)
convert_object_type(1732-1762)convert_object_type(3153-3183)InfrahubClient(318-1762)InfrahubClientSync(1765-3183)infrahub_sdk/convert_object_type.py (2)
ConversionFieldInput(43-61)ConversionFieldValue(21-40)infrahub_sdk/testing/docker.py (1)
TestInfrahubDockerClient(36-47)
tests/unit/ctl/test_cli.py (2)
tests/unit/sdk/conftest.py (2)
mock_query_infrahub_version(2173-2175)mock_query_infrahub_user(2179-2182)infrahub_sdk/async_typer.py (1)
runner(18-19)
infrahub_sdk/graphql/renderers.py (1)
infrahub_sdk/types.py (1)
Order(84-88)
tests/unit/sdk/test_protocols_generator.py (1)
tests/unit/sdk/conftest.py (2)
client(32-33)mock_schema_query_05(1843-1850)
tests/unit/sdk/test_utils.py (2)
infrahub_sdk/utils.py (1)
is_valid_url(215-227)tests/unit/sdk/conftest.py (2)
query_01(2186-2209)query_02(2213-2254)
infrahub_sdk/node/property.py (2)
infrahub_sdk/node/related_node.py (3)
id(92-95)display_label(120-123)typename(126-129)infrahub_sdk/protocols_base.py (3)
id(15-15)display_label(30-30)typename(33-33)
tests/integration/test_node.py (2)
infrahub_sdk/exceptions.py (1)
UninitializedError(158-159)infrahub_sdk/protocols.py (1)
IpamNamespace(587-588)
infrahub_sdk/node/related_node.py (3)
infrahub_sdk/node/metadata.py (4)
NodeMetadata(6-41)RelationshipMetadata(44-69)_generate_query_data(34-41)_generate_query_data(64-69)infrahub_sdk/node/relationship.py (2)
is_from_profile(61-66)_generate_query_data(76-112)infrahub_sdk/node/attribute.py (1)
_generate_query_data(112-128)
tests/unit/sdk/test_query_analyzer.py (1)
tests/unit/sdk/conftest.py (2)
query_01(2186-2209)bad_query_01(2375-2395)
infrahub_sdk/node/metadata.py (3)
infrahub_sdk/node/property.py (1)
NodeProperty(4-27)infrahub_sdk/node/attribute.py (1)
_generate_query_data(112-128)infrahub_sdk/node/relationship.py (1)
_generate_query_data(76-112)
tests/fixtures/integration/test_infrahubctl/tags_transform/tags_transform.py (3)
infrahub_sdk/transforms.py (1)
InfrahubTransform(17-81)tests/fixtures/repos/ctl_integration/transforms/animal_person.py (1)
transform(9-16)tests/fixtures/repos/ctl_integration/transforms/converted.py (1)
transform(10-18)
tests/unit/sdk/test_schema_sorter.py (2)
infrahub_sdk/transfer/schema_sorter.py (1)
InfrahubSchemaTopologicalSorter(13-33)tests/unit/sdk/conftest.py (1)
mock_schema_query_01(1815-1822)
tests/unit/sdk/test_branch.py (1)
tests/unit/sdk/conftest.py (3)
BothClients(25-28)clients(42-46)mock_branches_list_query(1429-1465)
tests/unit/sdk/graphql/test_renderer.py (2)
infrahub_sdk/graphql/renderers.py (2)
render_input_block(177-237)render_query_block(108-174)tests/unit/sdk/graphql/conftest.py (4)
query_data_no_filter(18-25)query_data_alias(29-36)query_data_fragment(40-49)input_data_01(94-103)
infrahub_sdk/node/node.py (4)
infrahub_sdk/node/metadata.py (3)
NodeMetadata(6-41)_generate_query_data(34-41)_generate_query_data(64-69)infrahub_sdk/node/related_node.py (3)
_generate_query_data(174-210)get(247-257)get(294-304)infrahub_sdk/node/attribute.py (1)
_generate_query_data(112-128)infrahub_sdk/node/relationship.py (1)
_generate_query_data(76-112)
tests/unit/sdk/test_repository.py (1)
infrahub_sdk/repository.py (2)
GitRepoManager(9-32)active_branch(31-32)
tests/unit/sdk/test_store_branch.py (2)
infrahub_sdk/schema/main.py (1)
NodeSchemaAPI(312-314)tests/unit/sdk/conftest.py (2)
schema_with_hfid(226-287)location_schema(148-180)
tests/integration/test_infrahub_client_sync.py (3)
infrahub_sdk/constants.py (1)
InfrahubClientMode(4-7)infrahub_sdk/exceptions.py (1)
URLNotFoundError(148-151)infrahub_sdk/types.py (1)
Order(84-88)
tests/integration/test_object_store.py (2)
infrahub_sdk/testing/docker.py (1)
TestInfrahubDockerClient(36-47)infrahub_sdk/client.py (1)
InfrahubClient(318-1762)
infrahub_sdk/node/relationship.py (3)
infrahub_sdk/node/metadata.py (4)
NodeMetadata(6-41)RelationshipMetadata(44-69)_generate_query_data(34-41)_generate_query_data(64-69)infrahub_sdk/node/related_node.py (2)
is_from_profile(138-142)_generate_query_data(174-210)infrahub_sdk/protocols_base.py (1)
_generate_query_data(40-40)
tests/unit/ctl/test_branch_app.py (3)
tests/unit/sdk/conftest.py (1)
mock_branches_list_query(1429-1465)infrahub_sdk/async_typer.py (1)
runner(18-19)tests/unit/ctl/conftest.py (2)
authentication_error_payload(68-77)mock_branch_create_error(81-99)
tests/unit/ctl/test_repository_app.py (1)
tests/unit/ctl/conftest.py (1)
mock_repositories_list(135-171)
infrahub_sdk/types.py (1)
infrahub_sdk/enums.py (1)
OrderDirection(4-6)
tests/integration/test_infrahub_client.py (3)
infrahub_sdk/constants.py (1)
InfrahubClientMode(4-7)infrahub_sdk/exceptions.py (1)
URLNotFoundError(148-151)infrahub_sdk/types.py (1)
Order(84-88)
tests/unit/sdk/test_node.py (4)
infrahub_sdk/node/relationship.py (4)
RelationshipManager(115-235)RelationshipManagerBase(22-112)is_from_profile(61-66)_generate_query_data(76-112)infrahub_sdk/node/metadata.py (4)
NodeMetadata(6-41)RelationshipMetadata(44-69)_generate_query_data(34-41)_generate_query_data(64-69)infrahub_sdk/node/property.py (1)
NodeProperty(4-27)infrahub_sdk/node/related_node.py (11)
RelatedNode(213-257)RelatedNodeSync(260-304)get(247-257)get(294-304)kind(132-135)RelatedNodeBase(17-210)is_from_profile(138-142)id(92-95)display_label(120-123)get_relationship_metadata(144-146)_generate_query_data(174-210)
infrahub_sdk/node/attribute.py (3)
infrahub_sdk/node/property.py (1)
NodeProperty(4-27)infrahub_sdk/node/metadata.py (2)
_generate_query_data(34-41)_generate_query_data(64-69)infrahub_sdk/node/relationship.py (1)
_generate_query_data(76-112)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: unit-tests (3.12)
- GitHub Check: unit-tests (3.11)
- GitHub Check: unit-tests (3.13)
- GitHub Check: documentation
- GitHub Check: unit-tests (3.14)
- GitHub Check: unit-tests (3.10)
- GitHub Check: Cloudflare Pages
| version: "${{ needs.prepare-environment.outputs.UV_VERSION }}" | ||
| - name: Install dependencies | ||
| run: uv sync --group lint | ||
| run: uv sync --all-groups --all-extras |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# Find and examine the pyproject.toml file
fd pyproject.tomlRepository: opsmill/infrahub-sdk-python
Length of output: 85
🏁 Script executed:
# Check the structure of dependency groups
cat pyproject.toml | head -100Repository: opsmill/infrahub-sdk-python
Length of output: 2458
🏁 Script executed:
# Look for dependency groups in pyproject.toml
rg '\[dependency-groups\]|\[project.optional-dependencies\]|\[\[tool.uv\]\]|group.*=' pyproject.toml -A 5Repository: opsmill/infrahub-sdk-python
Length of output: 579
🏁 Script executed:
# Check what's actually in the lint group
rg 'group.*lint|lint.*=' pyproject.toml -B 2 -A 10Repository: opsmill/infrahub-sdk-python
Length of output: 539
🏁 Script executed:
# Check current linting tool configuration
rg '\[tool.ruff\]' pyproject.toml -A 30Repository: opsmill/infrahub-sdk-python
Length of output: 627
🏁 Script executed:
# View the CI workflow file around line 89
cat -n .github/workflows/ci.yml | sed -n '80,100p'Repository: opsmill/infrahub-sdk-python
Length of output: 876
🏁 Script executed:
# Check if there are any comments in the workflow explaining this change
rg 'uv sync' .github/workflows/ci.yml -B 2 -A 2Repository: opsmill/infrahub-sdk-python
Length of output: 1247
🏁 Script executed:
# See the full lint job context
rg 'name:.*[Ll]int|jobs:' .github/workflows/ci.yml -A 30 | head -60Repository: opsmill/infrahub-sdk-python
Length of output: 2185
Use only necessary dependency groups in the lint job.
The change from uv sync --group lint to uv sync --all-groups --all-extras is unnecessary. The python-lint job only runs ruff, yamllint, and ty (all from the lint group). It does not run mypy or use type stubs, test dependencies, or other optional groups.
Revert to uv sync --group lint for this job. If you added --all-groups --all-extras as a catch-all, consider using the minimal necessary groups instead: --group lint suffices for linting, or --group lint --group types only if mypy is added to this job later.
🤖 Prompt for AI Agents
In @.github/workflows/ci.yml at line 89, The CI lint job currently runs the
command "run: uv sync --all-groups --all-extras" which installs unnecessary
dependency groups; update the python-lint job to only sync the lint group by
changing that command to use "uv sync --group lint" (or "uv sync --group lint
--group types" only if you later add mypy), so the job installs just ruff,
yamllint, ty and their required extras instead of all optional/test groups.
Summary by CodeRabbit
Release 1.18.0
New Features
created_atandupdated_atfields.Bug Fixes
Removed
background_executionparameter from branch creation.Documentation
✏️ Tip: You can customize this high-level summary in your review settings.