-
Notifications
You must be signed in to change notification settings - Fork 6
document INFRAHUB_PROXY #500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughAdds CLAUDE.md developer guide, rewrites the Python SDK client guide to document authentication, proxy configuration (INFRAHUB_PROXY / INFRAHUB_PROXY_MOUNTS), branching and usage for async/sync clients, bumps docs Docusaurus dependencies, and reorders Vale sentence-case exceptions (adds one new exception). Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Possibly related PRs
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Deploying infrahub-sdk-python with
|
| Latest commit: |
d2762e2
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://cab22a8d.infrahub-sdk-python.pages.dev |
| Branch Preview URL: | https://pmc-20250818-proxy-docs.infrahub-sdk-python.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🔭 Outside diff range comments (3)
docs/docs/python-sdk/guides/client.mdx (3)
61-79: Fix Tabs: only one TabItem should be default and remove incorrect awaits in async token examples
- Docusaurus Tabs allow a single default per group; currently both Async and Sync have default.
- The client constructor should not be awaited; use await on client methods instead.
Apply this diff:
<TabItem value="Async" default> @@ - from infrahub_sdk import Config, InfrahubClient - client = await InfrahubClient(config=Config(api_token="token")) - client = await InfrahubClient() # token is read from the INFRAHUB_API_TOKEN environment variable + from infrahub_sdk import Config, InfrahubClient + client = InfrahubClient(config=Config(api_token="token")) + client = InfrahubClient() # token is read from the INFRAHUB_API_TOKEN environment variable @@ - <TabItem value="Sync" default> + <TabItem value="Sync">
86-104: JWT examples: remove awaits and fix wording to “environment variables” and “credentials”
- Constructors shouldn’t be awaited.
- For username/password, refer to “credentials” and pluralize “variables.”
Apply this diff:
<TabItem value="Async" default> @@ - from infrahub_sdk import Config, InfrahubClient - client = await InfrahubClient(config=Config(username="admin", password="infrahub")) - client = await InfrahubClient() # token is read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variable + from infrahub_sdk import Config, InfrahubClient + client = InfrahubClient(config=Config(username="admin", password="infrahub")) + client = InfrahubClient() # credentials are read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variables @@ - <TabItem value="Sync" default> + <TabItem value="Sync"> @@ - client = InfrahubClientSync(config=Config(username="admin", password="infrahub")) - client = InfrahubClientSync() # token is read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variable + client = InfrahubClientSync(config=Config(username="admin", password="infrahub")) + client = InfrahubClientSync() # credentials are read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variables
115-133: Tabs default duplication and unnecessary await in GraphQL debugging example
- Keep only one default TabItem.
- Do not await the client constructor.
Apply this diff:
<TabItem value="Async" default> @@ - config = Config(echo_graphql_queries=True) - client = await InfrahubClient(config=config) + config = Config(echo_graphql_queries=True) + client = InfrahubClient(config=config) @@ - <TabItem value="Sync" default> + <TabItem value="Sync">
🧹 Nitpick comments (7)
docs/docs/python-sdk/guides/client.mdx (4)
7-7: Remove duplicate H1; frontmatter title already renders as page titleThe explicit H1 duplicates the frontmatter title and will render two titles.
Apply this diff:
-# How to create and configure an Infrahub client
141-142: Use “configuration” instead of “config” to satisfy Vale styleThis addresses the Vale error about preferring “configuration” over “config.”
Apply this diff:
-Use `INFRAHUB_PROXY` environment variable or the `proxy` config parameter to set a single proxy for all HTTP and HTTPS requests: +Use the `INFRAHUB_PROXY` environment variable or the `proxy` configuration option to set a single proxy for all HTTP and HTTPS requests:
242-284: Validation snippets: remove unused imports and duplicate default on Sync TabItem
- Clean up unused Config imports in both Async/Sync blocks.
- Only one TabItem should be default.
Apply this diff:
- <TabItem value="Async" default> + <TabItem value="Async" default> @@ - from infrahub_sdk import InfrahubClient, Config + from infrahub_sdk import InfrahubClient @@ - <TabItem value="Sync" default> + <TabItem value="Sync"> @@ - from infrahub_sdk import InfrahubClientSync, Config + from infrahub_sdk import InfrahubClientSync
139-170: Optional: adjust heading to satisfy Vale’s sentence-case rule if it still flagsVale warned about sentence case for “Separate proxies for HTTP and HTTPS.” If the warning persists, rephrase to an imperative heading which often passes stricter rules.
Apply this diff:
-### Separate proxies for HTTP and HTTPS +### Use separate proxies for HTTP and HTTPSCLAUDE.md (3)
82-87: Tone down “CRITICAL” note; keep it directive but less shoutyReduce intensity while preserving the directive, which also tends to play nicer with doc style linters.
Apply this diff:
-# CRITICAL: Use validate() method, NOT check() +# Important: Use validate() (not check()) class MyCheck(InfrahubCheck): - def validate(self, data): # Must be validate(), not check() + def validate(self, data): # Must be validate(), not check() # validation logic pass
161-166: Avoid pinning tool versions in prose; reference the config insteadRuff’s version evolves; pointing to pyproject avoids drift between docs and code.
Apply this diff:
-- **Ruff**: Comprehensive linting and formatting (0.11.0) +- **Ruff**: Comprehensive linting and formatting (as configured in pyproject.toml)
139-156: Nice contributor ops section; consider linking from CONTRIBUTING.mdThis is a helpful guide. Add a link from CONTRIBUTING.md (or create one if missing) so contributors can discover it.
I can open a follow-up PR wiring this into CONTRIBUTING and the docs sidebar if you want.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
docs/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (3)
CLAUDE.md(1 hunks)docs/docs/python-sdk/guides/client.mdx(5 hunks)docs/package.json(2 hunks)
🧰 Additional context used
🪛 LanguageTool
CLAUDE.md
[uncategorized] ~72-~72: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...Nodes load attributes and relationships on demand - Batch Operations: Support for bul...
(EN_COMPOUND_ADJECTIVE_INTERNAL)
[grammar] ~91-~91: There might be a mistake here.
Context: ... ### Async/Sync Pattern All operations follow dual implementation pattern: ```python...
(QB_NEW_EN)
[grammar] ~108-~108: There might be a mistake here.
Context: ...INFRAHUB_PROXY_MOUNTS_HTTPS (separate) - Mutual exclusivity validation between pr...
(QB_NEW_EN)
[grammar] ~117-~117: There might be a mistake here.
Context: ...s for Infrahub clients and configuration - Support for testing checks, transforms, ...
(QB_NEW_EN)
[grammar] ~118-~118: There might be a mistake here.
Context: ... testing checks, transforms, and queries - Integration with infrahub-testcontainers...
(QB_NEW_EN)
[grammar] ~143-~143: There might be a mistake here.
Context: ...ed**: React/Node.js documentation system - Auto-generation: CLI docs and config r...
(QB_NEW_EN)
[grammar] ~144-~144: There might be a mistake here.
Context: ...fig reference generated via invoke tasks - Multi-format: Guides (task-oriented) a...
(QB_NEW_EN)
[grammar] ~161-~161: There might be a mistake here.
Context: ...ehensive linting and formatting (0.11.0) - mypy: Type checking with strict config...
(QB_NEW_EN)
[grammar] ~162-~162: There might be a mistake here.
Context: ... Type checking with strict configuration - yamllint: YAML file validation - **mar...
(QB_NEW_EN)
[grammar] ~163-~163: There might be a mistake here.
Context: ...ion - yamllint: YAML file validation - markdownlint: Documentation consistenc...
(QB_NEW_EN)
[grammar] ~164-~164: There might be a mistake here.
Context: ...arkdownlint**: Documentation consistency - Vale: Documentation style checking ##...
(QB_NEW_EN)
[grammar] ~171-~171: There might be a mistake here.
Context: ... Multi-version Python testing (3.9-3.13) 2. Comprehensive linting pipeline 3. Docume...
(QB_NEW_EN)
[grammar] ~172-~172: There might be a mistake here.
Context: ...-3.13) 2. Comprehensive linting pipeline 3. Documentation generation and validation ...
(QB_NEW_EN)
[grammar] ~173-~173: There might be a mistake here.
Context: ... Documentation generation and validation 4. Integration testing with Infrahub contai...
(QB_NEW_EN)
[grammar] ~174-~174: There might be a mistake here.
Context: ...gration testing with Infrahub containers 5. Coverage reporting ## Key Configuration...
(QB_NEW_EN)
[grammar] ~179-~179: There might be a mistake here.
Context: ...tool configurations (ruff, mypy, pytest) - tasks.py: Invoke task definitions for ...
(QB_NEW_EN)
[grammar] ~180-~180: There might be a mistake here.
Context: ...sk definitions for development workflows - .github/workflows/ci.yml: Comprehensiv...
(QB_NEW_EN)
[grammar] ~181-~181: There might be a mistake here.
Context: ...s/ci.yml**: Comprehensive CI/CD pipeline - docs/package.json: Documentation build...
(QB_NEW_EN)
[grammar] ~188-~188: There might be a mistake here.
Context: ....0.0): Configuration and data validation - httpx: Async/sync HTTP client with pro...
(QB_NEW_EN)
[grammar] ~189-~189: There might be a mistake here.
Context: ...sync/sync HTTP client with proxy support - graphql-core: GraphQL query building a...
(QB_NEW_EN)
[grammar] ~190-~190: There might be a mistake here.
Context: ...re**: GraphQL query building and parsing - ujson: Fast JSON serialization ### Op...
(QB_NEW_EN)
[grammar] ~195-~195: There might be a mistake here.
Context: ... CLI functionality (typer, rich, jinja2) - tests extra: Testing framework extensi...
(QB_NEW_EN)
[grammar] ~196-~196: There might be a mistake here.
Context: ...ts extra**: Testing framework extensions - all extra: Complete development enviro...
(QB_NEW_EN)
[grammar] ~207-~207: There might be a mistake here.
Context: ...nted): Step-by-step learning experiences - How-to guides (task-oriented): Problem...
(QB_NEW_EN)
[grammar] ~208-~208: There might be a mistake here.
Context: ...-oriented): Problem-solving instructions - Explanation (understanding-oriented): ...
(QB_NEW_EN)
[grammar] ~209-~209: There might be a mistake here.
Context: ...: Clarification and discussion of topics - Reference (information-oriented): Tech...
(QB_NEW_EN)
[grammar] ~285-~285: There might be a mistake here.
Context: ...itional imperatives: "If you want X, do Y" - Address users directly: "Configure...", ...
(QB_NEW_EN)
[grammar] ~286-~286: There might be a mistake here.
Context: ..."Configure...", "Create...", "Deploy..." - Focus on practical tasks without digress...
(QB_NEW_EN)
[grammar] ~300-~300: There might be a mistake here.
Context: ...uced - Use domain-relevant language from user perspective (playbooks, branches, ...
(QB_NEW_EN)
[grammar] ~302-~302: There might be a mistake here.
Context: ...ing conventions - Validate accuracy against latest Infrahub version - **Follow mark...
(QB_NEW_EN)
[grammar] ~308-~308: There might be a mistake here.
Context: ...sync and sync examples where applicable using Tabs component - Provide realistic exam...
(QB_NEW_EN)
docs/docs/python-sdk/guides/client.mdx
[grammar] ~4-~4: There might be a mistake here.
Context: ...ient --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; #...
(QB_NEW_EN)
[grammar] ~15-~15: There might be a mistake here.
Context: ...## Prerequisites - Python 3.9 or higher - Infrahub SDK installed (`pip install inf...
(QB_NEW_EN)
[grammar] ~16-~16: There might be a mistake here.
Context: ...rahub-sdkorpoetry add infrahub-sdk`) - Access to an Infrahub instance (local or...
(QB_NEW_EN)
[grammar] ~17-~17: There might be a mistake here.
Context: ...o an Infrahub instance (local or remote) - Valid credentials (API token or username...
(QB_NEW_EN)
[grammar] ~83-~83: There might be a mistake here.
Context: ...okens) For interactive authentication, use username and password. The SDK automati...
(QB_NEW_EN)
🪛 GitHub Actions: CI
docs/docs/python-sdk/guides/client.mdx
[error] 141-141: Vale: Use 'configuration' instead of Infrahub.swap 'config'.
[warning] 172-172: Vale: 'Separate proxies for HTTP and HTTPS' should use sentence case.
🔇 Additional comments (3)
docs/package.json (1)
18-20: Lockfile & CI Node version confirmed
- docs/package-lock.json is present under
docs/- CI (
.github/workflows/ci.yml) usesactions/setup-node@v4withnode-version: 20(≥18)No further action needed; approving.
docs/docs/python-sdk/guides/client.mdx (2)
202-204: Good: clear mutual exclusivity note for proxy settingsThis warning aligns with the SDK’s behavior and prevents misconfiguration.
56-59: Environment variable and config names verifiedThe documented environment variables (INFRAHUB_API_TOKEN, INFRAHUB_USERNAME, INFRAHUB_PASSWORD, INFRAHUB_PROXY, INFRAHUB_PROXY_MOUNTS_HTTP, INFRAHUB_PROXY_MOUNTS_HTTPS) and Config options (api_token, username, password, proxy, proxy_mounts) exactly match the SDK implementation. No changes needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (3)
docs/docs/python-sdk/guides/client.mdx (3)
65-67: Async examples: remove await on InfrahubClient constructorConstructors aren’t awaitable. Only async client methods (e.g., get) should be awaited.
Apply these changes:
- client = await InfrahubClient(config=Config(api_token="token")) - client = await InfrahubClient() # token is read from the INFRAHUB_API_TOKEN environment variable + client = InfrahubClient(config=Config(api_token="token")) + client = InfrahubClient() # token is read from the INFRAHUB_API_TOKEN environment variable @@ - client = await InfrahubClient(config=Config(username="admin", password="infrahub")) - client = await InfrahubClient() # token is read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variable + client = InfrahubClient(config=Config(username="admin", password="infrahub")) + client = InfrahubClient() # credentials are read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variables @@ - client = await InfrahubClient(config=config) + client = InfrahubClient(config=config) @@ - client = await InfrahubClient(config=config) + client = InfrahubClient(config=config) @@ - # export INFRAHUB_PROXY=http://proxy.example.com:8080 - client = await InfrahubClient() + # export INFRAHUB_PROXY=http://proxy.example.com:8080 + client = InfrahubClient() @@ - # Proxy configuration is read from environment variables - client = await InfrahubClient() + # Proxy configuration is read from environment variables + client = InfrahubClient()Also applies to: 90-92, 120-120, 149-149, 153-153, 187-187
70-70: Tabs: remove duplicate default attribute from Sync tabsOnly one TabItem per Tabs group should be default. Keep Async as default and remove from Sync.
- <TabItem value="Sync" default> + <TabItem value="Sync">Also applies to: 95-95, 124-124, 157-157, 223-223, 263-263
172-201: Proxy mounts: add programmatic example and fix async constructor usageProvide a Config-based example for separate HTTP/HTTPS proxies alongside the env-var option, and do not await constructors.
### Separate proxies for HTTP and HTTPS @@ -Use `INFRAHUB_PROXY_MOUNTS_HTTP` and `INFRAHUB_PROXY_MOUNTS_HTTPS` environment variables to configure different proxies for HTTP and HTTPS requests: +Use either programmatic configuration or environment variables to configure different proxies for HTTP and HTTPS requests: @@ -<Tabs groupId="async-sync"> - <TabItem value="Async" default> - - ```python - from infrahub_sdk import InfrahubClient - # Proxy configuration is read from environment variables - client = await InfrahubClient() - ``` - - </TabItem> - <TabItem value="Sync" default> - - ```python - from infrahub_sdk import InfrahubClientSync - # Proxy configuration is read from environment variables - client = InfrahubClientSync() - ``` - - </TabItem> -</Tabs> +<Tabs groupId="async-sync"> + <TabItem value="Async" default> + + ```python + from infrahub_sdk import Config, InfrahubClient + # Programmatic configuration + config = Config(proxy_mounts={ + "http": "http://http-proxy.example.com:8080", + "https": "http://https-proxy.example.com:8080", + }) + client = InfrahubClient(config=config) + + # Or using environment variables + # export INFRAHUB_PROXY_MOUNTS_HTTP=http://http-proxy.example.com:8080 + # export INFRAHUB_PROXY_MOUNTS_HTTPS=http://https-proxy.example.com:8080 + client = InfrahubClient() + ``` + + </TabItem> + <TabItem value="Sync"> + + ```python + from infrahub_sdk import Config, InfrahubClientSync + # Programmatic configuration + config = Config(proxy_mounts={ + "http": "http://http-proxy.example.com:8080", + "https": "http://https-proxy.example.com:8080", + }) + client = InfrahubClientSync(config=config) + + # Or using environment variables + # export INFRAHUB_PROXY_MOUNTS_HTTP=http://http-proxy.example.com:8080 + # export INFRAHUB_PROXY_MOUNTS_HTTPS=http://https-proxy.example.com:8080 + client = InfrahubClientSync() + ``` + + </TabItem> +</Tabs>
🧹 Nitpick comments (2)
docs/docs/python-sdk/guides/client.mdx (2)
91-91: Pluralize “environment variable” when referencing two variablesTighten wording for correctness.
- client = await InfrahubClient() # token is read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variable + client = InfrahubClient() # credentials are read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variables @@ - client = InfrahubClientSync() # token is read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variable + client = InfrahubClientSync() # credentials are read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variablesAlso applies to: 100-101
245-246: Remove unused Config import in validation snippetsConfig isn’t used in these examples.
- from infrahub_sdk import InfrahubClient, Config + from infrahub_sdk import InfrahubClient @@ - from infrahub_sdk import InfrahubClientSync, Config + from infrahub_sdk import InfrahubClientSyncAlso applies to: 266-267
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
.vale/styles/Infrahub/sentence-case.yml(3 hunks)docs/docs/python-sdk/guides/client.mdx(5 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/docs/python-sdk/guides/client.mdx
[grammar] ~4-~4: There might be a mistake here.
Context: ...ient --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; #...
(QB_NEW_EN)
[grammar] ~15-~15: There might be a mistake here.
Context: ...## Prerequisites - Python 3.9 or higher - Infrahub SDK installed (`pip install inf...
(QB_NEW_EN)
[grammar] ~16-~16: There might be a mistake here.
Context: ...rahub-sdkorpoetry add infrahub-sdk`) - Access to an Infrahub instance (local or...
(QB_NEW_EN)
[grammar] ~17-~17: There might be a mistake here.
Context: ...o an Infrahub instance (local or remote) - Valid credentials (API token or username...
(QB_NEW_EN)
[grammar] ~83-~83: There might be a mistake here.
Context: ...okens) For interactive authentication, use username and password. The SDK automati...
(QB_NEW_EN)
⏰ 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). (1)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (2)
.vale/styles/Infrahub/sentence-case.yml (1)
42-42: Vale exception added for proxy heading — LGTMAdding "Separate proxies for HTTP and HTTPS" to exceptions correctly suppresses the sentence-case warning for the new docs section. The reordering of nearby entries is harmless. No further action needed.
Also applies to: 68-68
docs/docs/python-sdk/guides/client.mdx (1)
139-171: Env var support and mutual exclusivity are correctly reflected in the docsAll three behaviors line up with the SDK implementation:
- Single-proxy via
INFRAHUB_PROXY(Pydanticenv_prefix="INFRAHUB_"→ fieldproxy; docs reference in docs/python-sdk/reference/config.mdx).- Protocol-specific proxies via
INFRAHUB_PROXY_MOUNTS_HTTP/INFRAHUB_PROXY_MOUNTS_HTTPS(seevalidation_aliasin infrahub_sdk/config.py lines 23/29).- Mutual exclusivity enforced in infrahub_sdk/config.py lines 119–121 (
ValueErrorif bothproxyandproxy_mountsare set) and documented with the warning in docs/python-sdk/guides/client.mdx lines 201–204.No changes required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (7)
docs/docs/python-sdk/guides/client.mdx (7)
70-76: Tabs: remove duplicate default on Sync TabItem (API tokens section)Only one TabItem per Tabs group should be default. The Async tab is already default.
Apply this diff:
- <TabItem value="Sync" default> + <TabItem value="Sync">
95-101: Tabs: remove duplicate default on Sync TabItem (Username/Password section)Only one TabItem per Tabs group should be default. The Async tab is already default.
Apply this diff:
- <TabItem value="Sync" default> + <TabItem value="Sync">
124-133: Tabs: remove duplicate default on Sync TabItem (Client options section)Only one TabItem per Tabs group should be default. The Async tab is already default.
Apply this diff:
- <TabItem value="Sync" default> + <TabItem value="Sync">
157-168: Tabs: remove duplicate default on Sync TabItem (Single proxy section)Only one TabItem per Tabs group should be default. The Async tab is already default.
Apply this diff:
- <TabItem value="Sync" default> + <TabItem value="Sync">
191-198: Tabs: remove duplicate default on Sync TabItem (Separate proxies section)Only one TabItem per Tabs group should be default. The Async tab is already default.
Apply this diff:
- <TabItem value="Sync" default> + <TabItem value="Sync">
223-235: Tabs: remove duplicate default on Sync TabItem (Default branch section)Only one TabItem per Tabs group should be default. The Async tab is already default.
Apply this diff:
- <TabItem value="Sync" default> + <TabItem value="Sync">
263-281: Tabs: remove duplicate default on Sync TabItem (Validation section)Only one TabItem per Tabs group should be default. The Async tab is already default.
Apply this diff:
- <TabItem value="Sync" default> + <TabItem value="Sync">
🧹 Nitpick comments (3)
docs/docs/python-sdk/guides/client.mdx (3)
91-92: Clarify environment-variable wording for username/passwordUse “credentials … environment variables” (plural) rather than “token … environment variable”.
Apply this diff:
- client = InfrahubClient() # token is read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variable + client = InfrahubClient() # credentials are read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variables @@ - client = InfrahubClientSync() # token is read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variable + client = InfrahubClientSync() # credentials are read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variablesPlease also verify that the exact env var names are INFRAHUB_USERNAME and INFRAHUB_PASSWORD as implemented by the SDK.
Also applies to: 100-101
181-201: Add programmatic proxy_mounts examples alongside env-varsSince you document INFRAHUB_PROXY_MOUNTS_{HTTP,HTTPS}, also show how to configure the same via Config(proxy_mounts={...}) for parity with the single-proxy examples.
Apply this diff:
<Tabs groupId="async-sync"> - <TabItem value="Async" default> - - ```python - from infrahub_sdk import InfrahubClient - # Proxy configuration is read from environment variables - client = InfrahubClient() - ``` + <TabItem value="Async" default> + + ```python + from infrahub_sdk import Config, InfrahubClient + # Programmatic configuration + config = Config(proxy_mounts={ + "http": "http://http-proxy.example.com:8080", + "https": "http://https-proxy.example.com:8080", + }) + client = InfrahubClient(config=config) + + # Or using environment variables + # export INFRAHUB_PROXY_MOUNTS_HTTP=http://http-proxy.example.com:8080 + # export INFRAHUB_PROXY_MOUNTS_HTTPS=http://https-proxy.example.com:8080 + client = InfrahubClient() + ``` @@ - <TabItem value="Sync" default> - - ```python - from infrahub_sdk import InfrahubClientSync - # Proxy configuration is read from environment variables - client = InfrahubClientSync() - ``` + <TabItem value="Sync"> + + ```python + from infrahub_sdk import Config, InfrahubClientSync + # Programmatic configuration + config = Config(proxy_mounts={ + "http": "http://http-proxy.example.com:8080", + "https": "http://https-proxy.example.com:8080", + }) + client = InfrahubClientSync(config=config) + + # Or using environment variables + # export INFRAHUB_PROXY_MOUNTS_HTTP=http://http-proxy.example.com:8080 + # export INFRAHUB_PROXY_MOUNTS_HTTPS=http://https-proxy.example.com:8080 + client = InfrahubClientSync() + ```Note: Please confirm that Config(proxy_mounts={...}) is supported and the keys are precisely "http"/"https". --- `202-205`: **Clarify behavior when both proxy and proxy_mounts are provided** You warn they’re mutually exclusive. Consider stating what happens if both are set (e.g., explicit error vs. one taking precedence) to avoid ambiguity. Would you like me to draft a short note reflecting the SDK’s actual behavior (e.g., “the client raises a ValueError if both are configured”) once you confirm? </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used: CodeRabbit UI** **Review profile: CHILL** **Plan: Pro** **💡 Knowledge Base configuration:** - MCP integration is disabled by default for public repositories - Jira integration is disabled by default for public repositories - Linear integration is disabled by default for public repositories You can enable these sources in your CodeRabbit configuration. <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 88c53cef2838285b0007041944c1fb6a2ad4ad1e and 0f7de7443b595b5f8e87022ac6fd7b73760e969b. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `docs/docs/python-sdk/guides/client.mdx` (5 hunks) </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>🪛 LanguageTool</summary> <details> <summary>docs/docs/python-sdk/guides/client.mdx</summary> [grammar] ~4-~4: There might be a mistake here. Context: ...ient --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; #... (QB_NEW_EN) --- [grammar] ~15-~15: There might be a mistake here. Context: ...## Prerequisites - Python 3.9 or higher - Infrahub SDK installed (`pip install inf... (QB_NEW_EN) --- [grammar] ~16-~16: There might be a mistake here. Context: ...rahub-sdk` or `poetry add infrahub-sdk`) - Access to an Infrahub instance (local or... (QB_NEW_EN) --- [grammar] ~17-~17: There might be a mistake here. Context: ...o an Infrahub instance (local or remote) - Valid credentials (API token or username... (QB_NEW_EN) --- [grammar] ~83-~83: There might be a mistake here. Context: ...okens) For interactive authentication, use username and password. The SDK automati... (QB_NEW_EN) </details> </details> </details> <details> <summary>⏰ 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). (1)</summary> * GitHub Check: Cloudflare Pages </details> <details> <summary>🔇 Additional comments (1)</summary><blockquote> <details> <summary>docs/docs/python-sdk/guides/client.mdx (1)</summary> `146-154`: **LGTM: Async single-proxy example (no constructor await, correct env var)** Solid example: constructor isn’t awaited and INFRAHUB_PROXY is correctly demonstrated. </details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (2)
docs/docs/python-sdk/guides/client.mdx (2)
172-201: Add programmatic proxy_mounts example (mirror single-proxy section)To fully document INFRAHUB_PROXY_MOUNTS usage (and parity with the single-proxy example), include a Config-based example showing
proxy_mounts. Also ensure only one TabItem has default (currently OK).Apply this diff to enrich both Async and Sync examples:
<Tabs groupId="async-sync"> - <TabItem value="Async" default> + <TabItem value="Async" default> ```python - from infrahub_sdk import InfrahubClient - # Proxy configuration is read from environment variables - client = InfrahubClient() + from infrahub_sdk import Config, InfrahubClient + # Programmatic configuration + config = Config(proxy_mounts={ + "http": "http://http-proxy.example.com:8080", + "https": "http://https-proxy.example.com:8080", + }) + client = InfrahubClient(config=config) + + # Or using environment variables + # export INFRAHUB_PROXY_MOUNTS_HTTP=http://http-proxy.example.com:8080 + # export INFRAHUB_PROXY_MOUNTS_HTTPS=http://https-proxy.example.com:8080 + client = InfrahubClient()@@
- from infrahub_sdk import InfrahubClientSync
Proxy configuration is read from environment variables
- client = InfrahubClientSync()
- from infrahub_sdk import Config, InfrahubClientSync
Programmatic configuration
- config = Config(proxy_mounts={
"http": "http://http-proxy.example.com:8080","https": "http://https-proxy.example.com:8080",- })
- client = InfrahubClientSync(config=config)
Or using environment variables
export INFRAHUB_PROXY_MOUNTS_HTTP=http://http-proxy.example.com:8080
export INFRAHUB_PROXY_MOUNTS_HTTPS=http://https-proxy.example.com:8080
- client = InfrahubClientSync()
--- `245-260`: **Fix top-level await in “Validation” async example** Running `await test_connection()` at the top level will fail in a regular Python script. Use `asyncio.run(...)`. Apply this diff: ```diff - from infrahub_sdk import InfrahubClient, Config + from infrahub_sdk import InfrahubClient, Config + import asyncio @@ - # Run the test - await test_connection() + # Run the test + asyncio.run(test_connection())
🧹 Nitpick comments (2)
docs/docs/python-sdk/guides/client.mdx (2)
90-92: Grammar: refer to multiple environment variables and credentialsUse plural and clarify that credentials are read (not “token”) for the username/password path.
Apply this diff:
- client = InfrahubClient() # token is read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variable + client = InfrahubClient() # credentials are read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variables- client = InfrahubClientSync() # token is read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variable + client = InfrahubClientSync() # credentials are read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variablesAlso applies to: 98-101
213-221: Async snippet: avoid implicit top-level awaits in Step 5The snippet uses
awaitwithout showing an event loop. Either note it’s inside an async context or wrap withasyncio.run(...)for copy-pasteability.Apply this diff:
- from infrahub_sdk import InfrahubClient, Config - config = Config(default_branch="other-branch") - client_other_branch = InfrahubClient(config=config) - - tag_other_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED") - tag_main_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED", branch="main") + from infrahub_sdk import InfrahubClient, Config + import asyncio + + async def main(): + config = Config(default_branch="other-branch") + client_other_branch = InfrahubClient(config=config) + tag_other_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED") + tag_main_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED", branch="main") + + asyncio.run(main())
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
docs/docs/python-sdk/guides/client.mdx(6 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/docs/python-sdk/guides/client.mdx
[grammar] ~4-~4: There might be a mistake here.
Context: ...ient --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; #...
(QB_NEW_EN)
[grammar] ~15-~15: There might be a mistake here.
Context: ...## Prerequisites - Python 3.9 or higher - Infrahub SDK installed (`pip install inf...
(QB_NEW_EN)
[grammar] ~16-~16: There might be a mistake here.
Context: ...rahub-sdkorpoetry add infrahub-sdk`) - Access to an Infrahub instance (local or...
(QB_NEW_EN)
[grammar] ~17-~17: There might be a mistake here.
Context: ...o an Infrahub instance (local or remote) - Valid credentials (API token or username...
(QB_NEW_EN)
[grammar] ~83-~83: There might be a mistake here.
Context: ...okens) For interactive authentication, use username and password. The SDK automati...
(QB_NEW_EN)
🔇 Additional comments (2)
docs/docs/python-sdk/guides/client.mdx (2)
202-204: Good call-out on mutual exclusivity between proxy and proxy_mountsThe warning prevents ambiguous configurations and aligns with typical proxy semantics.
172-179: Environment variable names andConfig(proxy_mounts=…)verifiedI confirmed in
infrahub_sdk/config.pythat the HTTP and HTTPS mounts use the exact environment variables:
- Line 23:
validation_alias="INFRAHUB_PROXY_MOUNTS_HTTP"- Line 29:
validation_alias="INFRAHUB_PROXY_MOUNTS_HTTPS"The
Configmodel indeed exposes aproxy_mounts: ProxyMountsConfigfield (line 71), and the client code (e.g.infrahub_sdk/client.pylines 1014–1018) correctly checksself.config.proxy_mounts.is_set.No changes to the guide snippet are necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Nitpick comments (2)
docs/docs/python-sdk/guides/client.mdx (2)
247-253: Make the async default-branch example runnable (avoid top-level await)For consistency with the Validation section and typical Python usage, avoid top-level awaits by wrapping in an async function and using asyncio.run.
Apply this diff:
- from infrahub_sdk import InfrahubClient, Config + from infrahub_sdk import InfrahubClient, Config + import asyncio @@ - client_other_branch = InfrahubClient(config=config) - - tag_other_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED") - tag_main_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED", branch="main") + client_other_branch = InfrahubClient(config=config) + + async def main(): + tag_other_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED") + tag_main_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED", branch="main") + + asyncio.run(main())
278-281: Remove unused import in async validation sampleConfig isn’t used in this snippet.
Apply this diff:
- from infrahub_sdk import InfrahubClient, Config + from infrahub_sdk import InfrahubClient import asyncio
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
docs/docs/python-sdk/guides/client.mdx(6 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/docs/python-sdk/guides/client.mdx
[grammar] ~4-~4: There might be a mistake here.
Context: ...ient --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; #...
(QB_NEW_EN)
[grammar] ~15-~15: There might be a mistake here.
Context: ...## Prerequisites - Python 3.9 or higher - Infrahub SDK installed (`pip install inf...
(QB_NEW_EN)
[grammar] ~16-~16: There might be a mistake here.
Context: ...rahub-sdkorpoetry add infrahub-sdk`) - Access to an Infrahub instance (local or...
(QB_NEW_EN)
[grammar] ~17-~17: There might be a mistake here.
Context: ...o an Infrahub instance (local or remote) - Valid credentials (API token or username...
(QB_NEW_EN)
[grammar] ~83-~83: There might be a mistake here.
Context: ...okens) For interactive authentication, use username and password. The SDK automati...
(QB_NEW_EN)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
docs/docs/python-sdk/guides/client.mdx (1)
90-92: Clarify wording: use “credentials” and plural “variables” (not “token … variable”)Adjust comments to avoid implying a single “token” and fix singular “variable.”
- client = InfrahubClient() # token is read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variable + client = InfrahubClient() # credentials are read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variables- client = InfrahubClientSync() # token is read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variable + client = InfrahubClientSync() # credentials are read from the INFRAHUB_USERNAME and INFRAHUB_PASSWORD environment variablesAlso applies to: 99-101
🧹 Nitpick comments (3)
docs/docs/python-sdk/guides/client.mdx (3)
172-201: Add programmatic proxy_mounts examples (parity with single-proxy section)For completeness and parity, include Config(proxy_mounts={...}) examples alongside the env-var approach in both Async and Sync tabs.
<Tabs groupId="async-sync"> <TabItem value="Async" default> - ```python - from infrahub_sdk import InfrahubClient - # Proxy configuration is read from environment variables - client = InfrahubClient() - ``` + ```python + from infrahub_sdk import Config, InfrahubClient + # Programmatic configuration + config = Config(proxy_mounts={ + "http": "http://http-proxy.example.com:8080", + "https": "http://https-proxy.example.com:8080", + }) + client = InfrahubClient(config=config) + + # Or using environment variables + # export INFRAHUB_PROXY_MOUNTS_HTTP=http://http-proxy.example.com:8080 + # export INFRAHUB_PROXY_MOUNTS_HTTPS=http://https-proxy.example.com:8080 + client = InfrahubClient() + ``` </TabItem> <TabItem value="Sync"> - ```python - from infrahub_sdk import InfrahubClientSync - # Proxy configuration is read from environment variables - client = InfrahubClientSync() - ``` + ```python + from infrahub_sdk import Config, InfrahubClientSync + # Programmatic configuration + config = Config(proxy_mounts={ + "http": "http://http-proxy.example.com:8080", + "https": "http://https-proxy.example.com:8080", + }) + client = InfrahubClientSync(config=config) + + # Or using environment variables + # export INFRAHUB_PROXY_MOUNTS_HTTP=http://http-proxy.example.com:8080 + # export INFRAHUB_PROXY_MOUNTS_HTTPS=http://https-proxy.example.com:8080 + client = InfrahubClientSync() + ``` </TabItem> </Tabs>
213-221: Avoid top-level await in Step 5 async exampleWrap in an async function and call via asyncio.run for a copy-pastable snippet.
- from infrahub_sdk import InfrahubClient, Config - config = Config(default_branch="other-branch") - client_other_branch = InfrahubClient(config=config) - - tag_other_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED") - tag_main_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED", branch="main") + from infrahub_sdk import InfrahubClient, Config + import asyncio + + async def main(): + config = Config(default_branch="other-branch") + client_other_branch = InfrahubClient(config=config) + tag_other_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED") + tag_main_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED", branch="main") + + asyncio.run(main())
244-261: Remove unused Config imports in Validation examplesConfig isn’t used in either block; trimming imports keeps examples minimal.
- from infrahub_sdk import InfrahubClient, Config + from infrahub_sdk import InfrahubClient- from infrahub_sdk import InfrahubClientSync, Config + from infrahub_sdk import InfrahubClientSyncAlso applies to: 266-281
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
docs/docs/python-sdk/guides/client.mdx(6 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/docs/python-sdk/guides/client.mdx
[grammar] ~4-~4: There might be a mistake here.
Context: ...ient --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; #...
(QB_NEW_EN)
[grammar] ~15-~15: There might be a mistake here.
Context: ...## Prerequisites - Python 3.9 or higher - Infrahub SDK installed (`pip install inf...
(QB_NEW_EN)
[grammar] ~16-~16: There might be a mistake here.
Context: ...rahub-sdkorpoetry add infrahub-sdk`) - Access to an Infrahub instance (local or...
(QB_NEW_EN)
[grammar] ~17-~17: There might be a mistake here.
Context: ...o an Infrahub instance (local or remote) - Valid credentials (API token or username...
(QB_NEW_EN)
[grammar] ~83-~83: There might be a mistake here.
Context: ...okens) For interactive authentication, use username and password. The SDK automati...
(QB_NEW_EN)
🔇 Additional comments (3)
docs/docs/python-sdk/guides/client.mdx (3)
139-171: Single-proxy examples look correct (programmatic + env var) and tabs are well-formedConfig(proxy=...) and INFRAHUB_PROXY usage are consistent, code fences are closed, and only one TabItem is default.
58-76: API token examples look consistent and correctProgrammatic Config(api_token=...) and INFRAHUB_API_TOKEN usage are accurate. No awaits on constructors.
20-50: Client creation examples are clear and correctAsync and sync instantiation with address look good and match SDK expectations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
🧹 Nitpick comments (4)
docs/docs/python-sdk/guides/client.mdx (4)
92-97: Pluralize “environment variable(s)” where multiple vars are exportedThese sentences export two variables; use “variables” (plural).
Apply this diff:
- We need to export the address and API token as an environment variable: + Export the address and API token as environment variables: @@ - We need to export the address and API token as an environment variable: + Export the address and API token as environment variables:Also applies to: 121-126
213-223: Avoid top-level await in Step 3 snippets; wrap in coroutine and runThese examples won’t run as-is in a standard script. Wrap calls in an async function and run with asyncio to make the samples copy-pasteable.
Apply this diff:
- from infrahub_sdk import InfrahubClient, Config - config = Config(address="http://localhost:8000", api_token="token", default_branch="other-branch") - client_other_branch = InfrahubClient(config=config) - - tag_other_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED") - tag_main_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED", branch="main") + import asyncio + from infrahub_sdk import InfrahubClient, Config + + async def main(): + config = Config(address="http://localhost:8000", api_token="token", default_branch="other-branch") + client_other_branch = InfrahubClient(config=config) + tag_other_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED") + tag_main_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED", branch="main") + + asyncio.run(main()) @@ - from infrahub_sdk import InfrahubClient - client_other_branch = InfrahubClient() - - tag_other_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED") - tag_main_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED", branch="main") + import asyncio + from infrahub_sdk import InfrahubClient + + async def main(): + client_other_branch = InfrahubClient() + tag_other_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED") + tag_main_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED", branch="main") + + asyncio.run(main())Also applies to: 234-240
401-425: Add programmatic examples for proxy_mounts to mirror single-proxy sectionFor parity, show how to set
proxy_mountsvia configuration alongside the ENV examples.Apply this diff:
In some network environments, you might need to route HTTP and HTTPS traffic through different proxy servers. Use the `INFRAHUB_PROXY_MOUNTS_HTTP` and `INFRAHUB_PROXY_MOUNTS_HTTPS` environment variables for this purpose: ```bash export INFRAHUB_PROXY_MOUNTS_HTTP=http://http-proxy.example.com:8080 export INFRAHUB_PROXY_MOUNTS_HTTPS=http://https-proxy.example.com:8080
- from infrahub_sdk import InfrahubClient
Proxy configuration is read from environment variables
- client = InfrahubClient()
- from infrahub_sdk import Config, InfrahubClient
Programmatic configuration
- config = Config(proxy_mounts={
"http": "http://http-proxy.example.com:8080","https": "http://https-proxy.example.com:8080",- })
- client = InfrahubClient(config=config)
Or using environment variables
export INFRAHUB_PROXY_MOUNTS_HTTP=http://http-proxy.example.com:8080
export INFRAHUB_PROXY_MOUNTS_HTTPS=http://https-proxy.example.com:8080
- client = InfrahubClient()
@@
- from infrahub_sdk import InfrahubClientSync
Proxy configuration is read from environment variables
- client = InfrahubClientSync()
- from infrahub_sdk import Config, InfrahubClientSync
Programmatic configuration
- config = Config(proxy_mounts={
"http": "http://http-proxy.example.com:8080","https": "http://https-proxy.example.com:8080",- })
- client = InfrahubClientSync(config=config)
Or using environment variables
export INFRAHUB_PROXY_MOUNTS_HTTP=http://http-proxy.example.com:8080
export INFRAHUB_PROXY_MOUNTS_HTTPS=http://https-proxy.example.com:8080
- client = InfrahubClientSync()
--- `339-356`: **Silence Vale in this debug-logging example to avoid false positives** Avoids style/spelling checks on code identifiers inside this fenced block. Apply this diff: ```diff - ```python + <!-- vale off --> + ```python from infrahub_sdk import Config, InfrahubClient config = Config(echo_graphql_queries=True) client = InfrahubClient(config=config)
@@
from infrahub_sdk import InfrahubClient client = InfrahubClient() # debug flag state is read from the INFRAHUB_ECHO_GRAPHQL_QUERIES environment variables</blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used: CodeRabbit UI** **Review profile: CHILL** **Plan: Pro** **💡 Knowledge Base configuration:** - MCP integration is disabled by default for public repositories - Jira integration is disabled by default for public repositories - Linear integration is disabled by default for public repositories You can enable these sources in your CodeRabbit configuration. <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 42c601f05176f92aed3fc3e6cbe458713e5b8515 and 37ee6051a402e3fa077f4ffdf2dd0d9d0244a352. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `docs/docs/python-sdk/guides/client.mdx` (1 hunks) </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>🪛 LanguageTool</summary> <details> <summary>docs/docs/python-sdk/guides/client.mdx</summary> [grammar] ~4-~4: There might be a mistake here. Context: ...ient --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; #... (QB_NEW_EN) --- [grammar] ~19-~19: There might be a mistake here. Context: ...## Prerequisites - Python 3.9 or higher - Infrahub SDK installed (`pip install inf... (QB_NEW_EN) --- [grammar] ~20-~20: There might be a mistake here. Context: ...rahub-sdk` or `poetry add infrahub-sdk`) - Access to an Infrahub instance (local or... (QB_NEW_EN) --- [grammar] ~21-~21: There might be a mistake here. Context: ...o an Infrahub instance (local or remote) - Valid credentials (API token or username... (QB_NEW_EN) --- [grammar] ~27-~27: There might be a mistake here. Context: ...best fits your application architecture: - **Asynchronous client** (`InfrahubClient`)... (QB_NEW_EN) --- [grammar] ~28-~28: There might be a mistake here. Context: ...ns using Python's `async`/`await` syntax - **Synchronous client** (`InfrahubClientSyn... (QB_NEW_EN) --- [grammar] ~29-~29: There might be a mistake here. Context: ...itional synchronous workflows or scripts ::: <Tabs groupId="async-sync"> <TabIte... (QB_NEW_EN) --- [grammar] ~63-~63: There might be a mistake here. Context: ...password. :::info Configuration Methods You can configure the client in two ways... (QB_NEW_EN) --- [grammar] ~64-~64: There might be a mistake here. Context: ...ou can configure the client in two ways: 1. **Environment variables**: Ideal for sensi... (QB_NEW_EN) --- [grammar] ~140-~140: There might be a mistake here. Context: ...ssword For interactive authentication, use username and password. The SDK automati... (QB_NEW_EN) --- [grammar] ~259-~259: There might be a mistake here. Context: ...ello_world.py ``` :::danger File Naming Avoid naming your script `test.py` as th... (QB_NEW_EN) --- [grammar] ~260-~260: There might be a mistake here. Context: ...ng modules and the SDK's internal tests. ::: 2. Add the following code to `hello... (QB_NEW_EN) --- [grammar] ~273-~273: There might be a mistake here. Context: ...rahubClient async def hello_world(): client = InfrahubClient(config=Config(ad... (QB_NEW_EN) </details> </details> <details> <summary>🪛 Gitleaks (8.27.2)</summary> <details> <summary>docs/docs/python-sdk/guides/client.mdx</summary> 315-315: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key) </details> </details> <details> <summary>🪛 GitHub Check: markdown-lint</summary> <details> <summary>docs/docs/python-sdk/guides/client.mdx</summary> [failure] 285-285: Fenced code blocks should be surrounded by blank lines docs/docs/python-sdk/guides/client.mdx:285 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md031.md --- [failure] 283-283: Multiple consecutive blank lines docs/docs/python-sdk/guides/client.mdx:283 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md012.md --- [failure] 276-276: Code block style docs/docs/python-sdk/guides/client.mdx:276 MD046/code-block-style Code block style [Expected: fenced; Actual: indented] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md046.md --- [failure] 272-272: Multiple consecutive blank lines docs/docs/python-sdk/guides/client.mdx:272 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md012.md --- [failure] 177-177: Code block style docs/docs/python-sdk/guides/client.mdx:177 MD046/code-block-style Code block style [Expected: fenced; Actual: indented] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md046.md --- [failure] 147-147: Code block style docs/docs/python-sdk/guides/client.mdx:147 MD046/code-block-style Code block style [Expected: fenced; Actual: indented] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md046.md --- [failure] 111-111: Code block style docs/docs/python-sdk/guides/client.mdx:111 MD046/code-block-style Code block style [Expected: fenced; Actual: indented] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md046.md --- [failure] 82-82: Code block style docs/docs/python-sdk/guides/client.mdx:82 MD046/code-block-style Code block style [Expected: fenced; Actual: indented] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md046.md --- [failure] 65-65: Lists should be surrounded by blank lines docs/docs/python-sdk/guides/client.mdx:65 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "1. **Environment variables**: ..."] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md032.md --- [failure] 28-28: Lists should be surrounded by blank lines docs/docs/python-sdk/guides/client.mdx:28 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "- **Asynchronous client** (`In..."] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md032.md </details> </details> <details> <summary>🪛 GitHub Actions: CI</summary> <details> <summary>docs/docs/python-sdk/guides/client.mdx</summary> [error] 80-80: Vale: Infrahub.swap: Use 'configuration' instead of 'Config'. --- [warning] 249-249: Vale: Infrahub.sentence-case: 'Hello World example' should use sentence case. --- [warning] 251-251: Vale: Infrahub.simple-easy: Remove simple and avoid words that minimize the effort level required. --- [error] 260-260: Vale: Infrahub.spelling: Did you really mean 'SDK's'? --- [error] 270-270: Vale: Infrahub.spelling: Did you really mean 'infrahub_sdk'? --- [error] 274-274: Vale: Infrahub.swap: Use 'configuration' instead of 'config'. </details> </details> </details> <details> <summary>🔇 Additional comments (3)</summary><blockquote> <details> <summary>docs/docs/python-sdk/guides/client.mdx (3)</summary> `371-379`: **Single-proxy samples look correct and aligned with ENV usage** Good use of `proxy` and `INFRAHUB_PROXY` with consistent async/sync examples. Also applies to: 384-392 --- `427-429`: **Good: explicit error when both `proxy` and `proxy_mounts` are set** Clear mutual-exclusivity guidance, including the `ValueError` detail. --- `32-57`: **General MDX structure LGTM** Tabs/TabItem usage is consistent; headings and proxy sections are well structured. Also applies to: 360-366, 397-400 </details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
♻️ Duplicate comments (2)
docs/docs/python-sdk/guides/client.mdx (2)
83-85: Use “Configuration” (not “Config”) in non-code labels and prose to satisfy Vale.Update TabItem labels/values and nearby prose. Keep the class name
Configin code.-<TabItem value="Config" default> +<TabItem value="Configuration" default> @@ -We can set the address and API token directly in the `Config` object: +You can set the address and API token directly via a configuration object (`Config`):-<TabItem value="Config" default> +<TabItem value="Configuration" default> @@ -We can set the address and API token directly in the `Config` object: +You can set the address and API token directly via a configuration object (`Config`):-<TabItem value="Config" default> +<TabItem value="Configuration" default> @@ -We can set the address, username and password directly in the `Config` object: +You can set the address, username, and password directly via a configuration object (`Config`):-<TabItem value="Config" default> +<TabItem value="Configuration" default> @@ -We can set the address, username and password directly in the `Config` object: +You can set the address, username, and password directly via a configuration object (`Config`):-<TabItem value="Config" default> +<TabItem value="Configuration" default>- <TabItem value="Config" default> + <TabItem value="Configuration" default>Also applies to: 112-116, 148-152, 178-182, 217-218, 341-341
319-320: Do not commit token-like values (Gitleaks). Replace with a placeholder.The hard-coded value looks like a real API key and is flagged by Gitleaks. Replace it with a placeholder.
-export INFRAHUB_API_TOKEN="06438eb2-8019-4776-878c-0941b1f1d1ec" # This is the default token +export INFRAHUB_API_TOKEN="<YOUR_API_TOKEN>"
🧹 Nitpick comments (3)
docs/docs/python-sdk/guides/client.mdx (3)
95-95: Pluralize “environment variables.”Two variables are exported in each section; the prose should be plural.
-We need to export the address and API token as an environment variable: +We need to export the address and API token as environment variables:Also applies to: 124-124
358-359: Grammar: “environment variable” (singular).Only one variable is referenced here.
- client = InfrahubClient() # debug flag state is read from the INFRAHUB_ECHO_GRAPHQL_QUERIES environment variables + client = InfrahubClient() # debug flag state is read from the INFRAHUB_ECHO_GRAPHQL_QUERIES environment variable
368-433: Consider adding programmatic examples for proxy_mounts (nice to have).You document INFRAHUB_PROXY_MOUNTS_* via env vars, but some users may prefer explicit configuration in code. Consider adding a short programmatic example (mirrored for Sync) alongside the env-var version:
from infrahub_sdk import Config, InfrahubClient config = Config(proxy_mounts={ "http": "http://http-proxy.example.com:8080", "https": "http://https-proxy.example.com:8080", }) client = InfrahubClient(config=config)Note: Keep the mutual-exclusivity warning as-is.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
docs/docs/python-sdk/guides/client.mdx(1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/docs/python-sdk/guides/client.mdx
[grammar] ~4-~4: There might be a mistake here.
Context: ...ient --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; #...
(QB_NEW_EN)
[grammar] ~19-~19: There might be a mistake here.
Context: ...## Prerequisites - Python 3.9 or higher - Infrahub SDK installed (`pip install inf...
(QB_NEW_EN)
[grammar] ~20-~20: There might be a mistake here.
Context: ...rahub-sdkorpoetry add infrahub-sdk`) - Access to an Infrahub instance (local or...
(QB_NEW_EN)
[grammar] ~21-~21: There might be a mistake here.
Context: ...o an Infrahub instance (local or remote) - Valid credentials (API token or username...
(QB_NEW_EN)
[grammar] ~65-~65: There might be a mistake here.
Context: ...password. :::info Configuration Methods You can configure the client in two ways...
(QB_NEW_EN)
[grammar] ~143-~143: There might be a mistake here.
Context: ...ssword For interactive authentication, use username and password. The SDK automati...
(QB_NEW_EN)
[style] ~160-~160: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...Item> We need to export the address, username and passwo...
(REP_NEED_TO_VB)
[style] ~190-~190: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...Item> We need to export the address, username and passwo...
(REP_NEED_TO_VB)
[grammar] ~262-~262: There might be a mistake here.
Context: ...ello_world.py ``` :::danger File Naming Avoid naming your script test.py as th...
(QB_NEW_EN)
[grammar] ~263-~263: There might be a mistake here.
Context: ...ng modules and the SDK's internal tests. ::: 2. Add the following code to `hello...
(QB_NEW_EN)
🪛 Gitleaks (8.27.2)
docs/docs/python-sdk/guides/client.mdx
319-319: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
🪛 GitHub Actions: CI
docs/docs/python-sdk/guides/client.mdx
[warning] 252-252: Vale: Infrahub.sentence-case: 'Hello World example' should use sentence-case. Command: ./vale $(find ./docs -type f ( -name ".mdx" -o -name ".md" ) )
[warning] 254-254: Vale: Infrahub.simple-easy: Remove simple and avoid words that minimize the effort level required. Command: ./vale $(find ./docs -type f ( -name ".mdx" -o -name ".md" ) )
[error] 263-263: Vale: Infrahub.spelling: Did you really mean 'SDK's'? Command: ./vale $(find ./docs -type f ( -name ".mdx" -o -name ".md" ) )
⏰ 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). (1)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (1)
docs/docs/python-sdk/guides/client.mdx (1)
74-74: Standardize the configuration reference link (extensionless preferred).Links mix extension and extensionless paths:
- Line 74: ../reference/config.mdx
- Line 446: ../reference/config
Recommend using extensionless consistently to match Docusaurus routing.
-[SDK configuration reference](../reference/config.mdx) +[SDK configuration reference](../reference/config)If your docs build expects explicit extensions, flip the suggestion: make both use ../reference/config.mdx.
Also applies to: 446-446
| ```python | ||
| from infrahub_sdk import InfrahubClient | ||
| client = InfrahubClient(address="http://localhost:8000") | ||
|
|
||
| # Connect to local Infrahub instance | ||
| client = InfrahubClient() | ||
| ``` | ||
|
|
||
| ## Synchronous Python | ||
| </TabItem> | ||
| <TabItem value="Sync"> | ||
|
|
||
| The `InfrahubClientSync` class provides the synchronous version. | ||
| Create an `InfrahubClientSync` for traditional synchronous code: | ||
|
|
||
| ```python | ||
| from infrahub_sdk import InfrahubClientSync | ||
| client = InfrahubClientSync(address="http://localhost:8000") | ||
|
|
||
| # Connect to local Infrahub instance | ||
| client = InfrahubClientSync() | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Verify default address behavior in Step 1 example.
The quick-start client creation doesn’t specify address or credentials. If the SDK does not default to http://localhost:8000, this may confuse readers.
Run this script to confirm the default address in the SDK:
If there’s no localhost default, consider adding address in the snippet or a note that the client reads INFRAHUB_ADDRESS from the environment.
🏁 Script executed:
#!/bin/bash
# Locate Config defaults for `address` in the SDK
rg -n -C3 -S 'class\s+Config\b|address\s*=' --type py
rg -n -C2 -S 'INFRAHUB_ADDRESS' --type pyLength of output: 25403
Include explicit local address in quick-start example
By default, InfrahubClient() does not assume http://localhost:8000. To prevent confusion, update the snippet in docs/docs/python-sdk/guides/client.mdx (lines 39–56) to either pass the address directly or document the environment-variable fallback:
- Replace:
- client = InfrahubClient() + client = InfrahubClient(address="http://localhost:8000")
- And similarly for the sync client:
- client = InfrahubClientSync() + client = InfrahubClientSync(address="http://localhost:8000")
- Optionally, add a note above the snippet:
By default, the client reads the
INFRAHUB_ADDRESSenv var. To point at a local instance, setexport INFRAHUB_ADDRESS=http://localhost:8000
🤖 Prompt for AI Agents
In docs/docs/python-sdk/guides/client.mdx around lines 39 to 56, the quick-start
examples currently instantiate InfrahubClient() and InfrahubClientSync() without
an explicit address which may mislead users; update the two code snippets to
pass the local address explicitly (e.g.,
InfrahubClient(address="http://localhost:8000") and
InfrahubClientSync(address="http://localhost:8000")) and add a short one-line
note above the snippets stating that the client reads INFRAHUB_ADDRESS from the
environment if not provided, with an example export command to point to a local
instance.
| ```python | ||
| from infrahub_sdk import InfrahubClient, Config | ||
| config = Config(address="http://localhost:8000", api_token="token", default_branch="other-branch") | ||
| client_other_branch = InfrahubClient(config=config) | ||
|
|
||
| tag_other_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED") | ||
| tag_main_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED", branch="main") | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix top-level await in examples (wrap with asyncio.run).
These snippets use await at module scope and will fail in a regular Python script. Wrap in an async function and call via asyncio.run.
-```python
-from infrahub_sdk import InfrahubClient, Config
-config = Config(address="http://localhost:8000", api_token="token", default_branch="other-branch")
-client_other_branch = InfrahubClient(config=config)
-
-tag_other_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED")
-tag_main_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED", branch="main")
-```
+```python
+import asyncio
+from infrahub_sdk import InfrahubClient, Config
+
+async def main():
+ config = Config(address="http://localhost:8000", api_token="token", default_branch="other-branch")
+ client_other_branch = InfrahubClient(config=config)
+ tag_other_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED")
+ tag_main_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED", branch="main")
+
+asyncio.run(main())
+```-```python
-from infrahub_sdk import InfrahubClient
-client_other_branch = InfrahubClient()
-
-tag_other_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED")
-tag_main_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED", branch="main")
-```
+```python
+import asyncio
+from infrahub_sdk import InfrahubClient
+
+async def main():
+ client_other_branch = InfrahubClient()
+ tag_other_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED")
+ tag_main_branch = await client_other_branch.get(kind="BuiltinTag", name__value="RED", branch="main")
+
+asyncio.run(main())
+```Also applies to: 237-244
🤖 Prompt for AI Agents
In docs/docs/python-sdk/guides/client.mdx around lines 219-226 (and also apply
same change to 237-244), the example uses top-level await which will fail in a
regular Python script; wrap the awaits inside an async def main() and call it
using asyncio.run(main()), and add a top-level import asyncio; do this for both
example blocks so the client creation and await calls execute inside the async
function and the script runs correctly.
Resolves #14
Summary by CodeRabbit
Documentation
Chores
Style