-
Notifications
You must be signed in to change notification settings - Fork 7
Remove copier and provide workaround for 'infrahubctl repository init' #684
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
WalkthroughThe changes remove the Copier dependency from the project and replace the repository initialization functionality with static guidance text. The Pre-merge checks✅ Passed checks (3 passed)
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 |
Deploying infrahub-sdk-python with
|
| Latest commit: |
d1d7ada
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://65096c5d.infrahub-sdk-python.pages.dev |
| Branch Preview URL: | https://pog-remove-copier.infrahub-sdk-python.pages.dev |
d8c7aab to
814de11
Compare
814de11 to
d1d7ada
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## stable #684 +/- ##
==========================================
- Coverage 76.26% 75.83% -0.43%
==========================================
Files 113 113
Lines 10205 9644 -561
Branches 1677 1471 -206
==========================================
- Hits 7783 7314 -469
+ Misses 1897 1835 -62
+ Partials 525 495 -30
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 files with indirect coverage changes 🚀 New features to boost your workflow:
|
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
🧹 Nitpick comments (3)
docs/docs/infrahubctl/infrahubctl-repository.mdx (1)
51-63: Update documentation to reflect the command's new behavior.The documentation still describes the command as "Initialize a new Infrahub repository" but doesn't explain that the command now provides guidance text with instructions for manual initialization using the copier tool, rather than performing initialization itself. Users reading this may expect the command to initialize a repository directly.
Consider adding a brief description after line 53 that explains:
- The command provides instructions for repository initialization
- The actual initialization requires running the copier tool manually
- Why this change was made (license restrictions)
Apply this diff to clarify the command's behavior:
## `infrahubctl repository init` -Initialize a new Infrahub repository. +Get instructions for initializing a new Infrahub repository. + +This command provides guidance on how to manually initialize a repository using the copier tool, +which is not included in the SDK due to license restrictions. **Usage**:tests/unit/ctl/test_repository_app.py (1)
325-329: Consider verifying the exit code.The test validates that the expected guidance text is present in the output, but doesn't verify that the command exits successfully.
Apply this diff to add the exit code check:
def test_repo_init(self) -> None: """Test the repository init command.""" output = runner.invoke(app, ["repository", "init"]) + assert output.exit_code == 0 raw = strip_color(output.stdout) assert "uv tool run --from 'copier' copier copy https://github.com/opsmill/infrahub-template" in rawinfrahub_sdk/ctl/repository.py (1)
211-213: Optional: Consider clarifying the placeholder.The guidance text is clear, but you might want to add a note that
<project-name>should be replaced with the user's desired project name. This would make it even more explicit for users less familiar with CLI conventions.Apply this diff to add clarification:
console.print("The copier tool is not included in the Infrahub SDK CLI due to license restrictions,") - console.print("please run the following command to create a new Infrahub repository project:\n") + console.print("please run the following command (replace <project-name> with your desired project name):\n") console.print("uv tool run --from 'copier' copier copy https://github.com/opsmill/infrahub-template <project-name>")
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (5)
changelog/+470be9b4.removed.md(1 hunks)docs/docs/infrahubctl/infrahubctl-repository.mdx(1 hunks)infrahub_sdk/ctl/repository.py(1 hunks)pyproject.toml(0 hunks)tests/unit/ctl/test_repository_app.py(1 hunks)
💤 Files with no reviewable changes (1)
- pyproject.toml
🧰 Additional context used
📓 Path-based instructions (5)
docs/**/*.mdx
📄 CodeRabbit inference engine (CLAUDE.md)
Follow the Diataxis framework for documentation with four types: Tutorials (learning-oriented), How-to guides (task-oriented), Explanation (understanding-oriented), and Reference (information-oriented)
Files:
docs/docs/infrahubctl/infrahubctl-repository.mdx
docs/**/*.{md,mdx}
📄 CodeRabbit inference engine (CLAUDE.md)
docs/**/*.{md,mdx}: Use professional but approachable tone, concise and direct language, and consistent document structure patterns following Diataxis categories in documentation
In documentation code examples: use proper language tags, include both async and sync examples using Tabs component where applicable, provide realistic examples, add validation steps, and use callouts for warnings and tips
Use domain-relevant Infrahub terminology (playbooks, branches, schemas, commits) consistently with Infrahub's data model and UI naming conventions in documentation
Validate documentation accuracy against the latest Infrahub version and follow markdown style as defined in.markdownlint.yamland Vale styles
Files:
docs/docs/infrahubctl/infrahubctl-repository.mdx
infrahub_sdk/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
infrahub_sdk/**/*.py: UseInfrahubClient(async) andInfrahubClientSync(sync) providing identical interfaces following the dual client pattern
Implement all operations following the dual async/sync pattern whereInfrahubClientprovides async methods andInfrahubClientSyncprovides sync equivalents
Files:
infrahub_sdk/ctl/repository.py
infrahub_sdk/ctl/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Implement CLI commands using Typer for schema management, transformations, checks, branch operations, and object management in
infrahub_sdk/ctl/
Files:
infrahub_sdk/ctl/repository.py
tests/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
tests/**/*.py: Use the custom pytest plugin (infrahub_sdk.pytest_plugin) providing fixtures for Infrahub clients, configuration, and support for testing checks, transforms, and queries
Organize unit tests intests/unit/for isolated component testing and integration tests intests/integration/for testing against real Infrahub instances
Files:
tests/unit/ctl/test_repository_app.py
🧠 Learnings (6)
📚 Learning: 2025-12-01T19:42:19.012Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T19:42:19.012Z
Learning: Applies to docs/**/*.{md,mdx} : Use domain-relevant Infrahub terminology (playbooks, branches, schemas, commits) consistently with Infrahub's data model and UI naming conventions in documentation
Applied to files:
docs/docs/infrahubctl/infrahubctl-repository.mdx
📚 Learning: 2025-12-01T19:42:19.012Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T19:42:19.012Z
Learning: Applies to infrahub_sdk/ctl/**/*.py : Implement CLI commands using Typer for schema management, transformations, checks, branch operations, and object management in `infrahub_sdk/ctl/`
Applied to files:
infrahub_sdk/ctl/repository.pytests/unit/ctl/test_repository_app.py
📚 Learning: 2025-12-01T19:42:19.012Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T19:42:19.012Z
Learning: Applies to tests/**/*.py : Use the custom pytest plugin (`infrahub_sdk.pytest_plugin`) providing fixtures for Infrahub clients, configuration, and support for testing checks, transforms, and queries
Applied to files:
tests/unit/ctl/test_repository_app.py
📚 Learning: 2025-12-01T19:42:19.012Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T19:42:19.012Z
Learning: Run unit tests using `uv run pytest --cov infrahub_sdk tests/unit/`
Applied to files:
tests/unit/ctl/test_repository_app.py
📚 Learning: 2025-12-01T19:42:19.012Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T19:42:19.012Z
Learning: Applies to tests/**/*.py : Organize unit tests in `tests/unit/` for isolated component testing and integration tests in `tests/integration/` for testing against real Infrahub instances
Applied to files:
tests/unit/ctl/test_repository_app.py
📚 Learning: 2025-12-01T19:42:19.012Z
Learnt from: CR
Repo: opsmill/infrahub-sdk-python PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T19:42:19.012Z
Learning: Applies to infrahub_sdk/**/*.py : Use `InfrahubClient` (async) and `InfrahubClientSync` (sync) providing identical interfaces following the dual client pattern
Applied to files:
tests/unit/ctl/test_repository_app.py
🧬 Code graph analysis (2)
infrahub_sdk/ctl/repository.py (1)
infrahub_sdk/testing/repository.py (1)
init(60-76)
tests/unit/ctl/test_repository_app.py (2)
infrahub_sdk/async_typer.py (1)
runner(18-19)tests/helpers/utils.py (1)
strip_color(45-47)
⏰ 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)
changelog/+470be9b4.removed.md (1)
1-1: LGTM!The changelog entry is clear and appropriately documents the removal of the copier dependency and its impact on the
infrahub repository initcommand.infrahub_sdk/ctl/repository.py (1)
207-213: LGTM! Clean implementation of guidance-only behavior.The simplified
init()function appropriately prints clear guidance text explaining the license restriction and provides users with the exact command to initialize a repository manually. The use ofuv tool runis a good choice for modern Python tooling.
Remove
copieras a dependency due to licence restrictions.Summary by CodeRabbit
Release Notes
Chores
Changes
infrahubctl repository initcommand: DIRECTORY argument is no longer required; command now provides initialization guidance instead of automatic repository setup.✏️ Tip: You can customize this high-level summary in your review settings.