Skip to content

Conversation

@ogenstad
Copy link
Contributor

@ogenstad ogenstad commented Dec 8, 2025

Remove copier as a dependency due to licence restrictions.

Summary by CodeRabbit

Release Notes

  • Chores

    • Removed Copier dependency from the project.
  • Changes

    • Modified infrahubctl repository init command: 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.

@coderabbitai
Copy link

coderabbitai bot commented Dec 8, 2025

Walkthrough

The changes remove the Copier dependency from the project and replace the repository initialization functionality with static guidance text. The init command signature is simplified from accepting multiple parameters (directory, template, data, vcs_ref, trust) to taking no arguments and outputting an informational message instead. The DIRECTORY argument is removed from CLI documentation. Related tests are simplified to verify the guidance message output rather than testing actual repository initialization logic. Dependencies are removed from pyproject.toml's ctl and all groups. A changelog entry documents this removal.

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: removing the copier dependency and providing a workaround for the 'infrahubctl repository init' command, which is reflected across the modified files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the type/documentation Improvements or additions to documentation label Dec 8, 2025
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 8, 2025

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

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

View logs

@codecov
Copy link

codecov bot commented Dec 8, 2025

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     
Flag Coverage Δ
integration-tests 34.57% <25.00%> (+0.04%) ⬆️
python-3.10 49.55% <100.00%> (-1.53%) ⬇️
python-3.11 49.55% <100.00%> (-1.53%) ⬇️
python-3.12 49.53% <100.00%> (-1.53%) ⬇️
python-3.13 49.51% <100.00%> (-1.56%) ⬇️
python-filler-3.12 24.14% <0.00%> (+0.44%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
infrahub_sdk/ctl/repository.py 72.00% <100.00%> (+2.17%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ogenstad ogenstad marked this pull request as ready for review December 8, 2025 16:31
@ogenstad ogenstad requested a review from a team December 8, 2025 16:31
Copy link

@coderabbitai coderabbitai bot left a 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 raw
infrahub_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

📥 Commits

Reviewing files that changed from the base of the PR and between 5325fd4 and d1d7ada.

⛔ Files ignored due to path filters (1)
  • uv.lock is 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.yaml and Vale styles

Files:

  • docs/docs/infrahubctl/infrahubctl-repository.mdx
infrahub_sdk/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

infrahub_sdk/**/*.py: Use InfrahubClient (async) and InfrahubClientSync (sync) providing identical interfaces following the dual client pattern
Implement all operations following the dual async/sync pattern where InfrahubClient provides async methods and InfrahubClientSync provides 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 in tests/unit/ for isolated component testing and integration tests in tests/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.py
  • 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 : 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 init command.

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 of uv tool run is a good choice for modern Python tooling.

@ogenstad ogenstad merged commit 8ad1d21 into stable Dec 9, 2025
19 checks passed
@ogenstad ogenstad deleted the pog-remove-copier branch December 9, 2025 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants