fix(ctl): import pyarrow lazily in the JSON importer - #1160
Merged
Conversation
pyarrow was imported at module top-level in the line-delimited JSON importer, which is reached from ctl.cli_commands at CLI startup. That forced every infrahubctl command to require pyarrow (the 'ctl' extra), so a slim install without it — e.g. the Infrahub server image — could not run even `infrahubctl schema load`. Import pyarrow lazily inside LineDelimitedJSONImporter.import_data, the only code path that uses it, and raise a clear install hint if it is missing. Now only `infrahubctl object load` needs the 'ctl' extra. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fatih-acar
pushed a commit
to opsmill/infrahub
that referenced
this pull request
Jul 10, 2026
Points the python_sdk submodule at the SDK fix that imports pyarrow lazily (opsmill/infrahub-sdk-python#1160). Without it, removing pyarrow from the image (see the object-transfer extra) broke every infrahubctl command at startup, not just `object load` — which failed the e2e data-loading step. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Deploying infrahub-sdk-python with
|
| Latest commit: |
e31a1da
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://49cadc7f.infrahub-sdk-python.pages.dev |
| Branch Preview URL: | https://fac-lazy-pyarrow-import.infrahub-sdk-python.pages.dev |
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## infrahub-develop #1160 +/- ##
====================================================
- Coverage 82.35% 82.34% -0.01%
====================================================
Files 138 138
Lines 12065 12070 +5
Branches 1805 1805
====================================================
+ Hits 9936 9939 +3
- Misses 1573 1575 +2
Partials 556 556
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 4 files with indirect coverage changes 🚀 New features to boost your workflow:
|
ajtmccarty
approved these changes
Jul 10, 2026
fatih-acar
pushed a commit
to opsmill/infrahub
that referenced
this pull request
Jul 10, 2026
Points the python_sdk submodule at the merged SDK fix that imports pyarrow lazily (opsmill/infrahub-sdk-python#1160, on infrahub-develop). Without it, removing pyarrow from the image (see the object-transfer extra) broke every infrahubctl command at startup, not just `object load` — which failed the e2e data-loading step. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fatih-acar
pushed a commit
to opsmill/infrahub
that referenced
this pull request
Jul 13, 2026
Points the python_sdk submodule at the merged SDK fix that imports pyarrow lazily (opsmill/infrahub-sdk-python#1160, on infrahub-develop). Without it, removing pyarrow from the image (see the object-transfer extra) broke every infrahubctl command at startup, not just `object load` — which failed the e2e data-loading step. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fatih-acar
pushed a commit
to opsmill/infrahub
that referenced
this pull request
Jul 13, 2026
Points the python_sdk submodule at the merged SDK fix that imports pyarrow lazily (opsmill/infrahub-sdk-python#1160, on infrahub-develop). Without it, removing pyarrow from the image (see the object-transfer extra) broke every infrahubctl command at startup, not just `object load` — which failed the e2e data-loading step. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
pyarrowwas imported at module top-level in the line-delimited JSON importer (infrahub_sdk/transfer/importer/json.py). That module is reached fromctl.cli_commandsatinfrahubctlstartup, so everyinfrahubctlcommand requiredpyarrow(thectlextra) to be importable — evenschema load,menu load, andrun, which don't touch pyarrow at all.This breaks slim installs that intentionally omit the heavy
pyarrowdependency (e.g. the Infrahub server container image), whereinfrahubctl schema loadfails at startup withModule pyarrow is not available.What changed
pyarrow.jsonlazily insideLineDelimitedJSONImporter.import_data— the only code path that uses it — instead of at module top-level.ModuleNotFoundError(pointing at thectlextra) if pyarrow is missing whenobject loadactually runs.Only
infrahubctl object loadnow requires thectlextra; all otherinfrahubctlcommands work withoutpyarrow.How to test
🤖 Generated with Claude Code
Summary by cubic
Lazy-load
pyarrowin the line-delimited JSON importer so onlyinfrahubctl object loadrequires thectlextra; all otherinfrahubctlcommands run withoutpyarrow. Fixes startup failures on slim installs (e.g., server image) wherepyarrowisn’t installed.pyarrow.jsonimport intoLineDelimitedJSONImporter.import_data.ModuleNotFoundErrorwith install hints:pip install 'infrahub-sdk[ctl]'oruv sync --extra ctl.Written for commit e31a1da. Summary will update on new commits.