Skip to content

Avoid Git executable check during package import - #639

Draft
Mirochill wants to merge 2 commits into
BradenM:masterfrom
Mirochill:fix-619-lazy-git-import
Draft

Avoid Git executable check during package import#639
Mirochill wants to merge 2 commits into
BradenM:masterfrom
Mirochill:fix-619-lazy-git-import

Conversation

@Mirochill

@Mirochill Mirochill commented May 26, 2026

Copy link
Copy Markdown

Fixes #619.

Summary

  • delay importing GitPython's Repo until a VCS dependency is actually fetched
  • keep PyPI/local dependency handling importable when Git is not installed or not on PATH
  • add a regression that imports micropy.packages.source_package with a broken git module

Validation

  • git diff --check
  • Not run locally: project tests, lint, build, install, import runtime, or Git/GitPython execution.
  • Remote: pre-commit.ci passed.
  • Remote: GitHub Actions are blocked before project tests or analysis. CodeQL and the Ubuntu/Windows Test MicropyCli jobs fail during setup with Poetry reporting pyproject.toml changed significantly since poetry.lock was last generated; macOS-12 Test MicropyCli jobs are still queued.

@BradenM
BradenM force-pushed the fix-619-lazy-git-import branch from bdc0449 to 82bff3a Compare June 20, 2026 18:13
@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.79%. Comparing base (49c7f75) to head (82bff3a).
⚠️ Report is 32 commits behind head on master.

Files with missing lines Patch % Lines
micropy/packages/source_package.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #639      +/-   ##
==========================================
+ Coverage   91.36%   91.79%   +0.43%     
==========================================
  Files          50       52       +2     
  Lines        2756     2828      +72     
==========================================
+ Hits         2518     2596      +78     
+ Misses        238      232       -6     
Flag Coverage Δ
os-macos-latest 91.58% <50.00%> (?)
os-ubuntu-latest 91.76% <50.00%> (?)
os-windows-latest 91.21% <50.00%> (-0.15%) ⬇️
py-3.10 91.75% <50.00%> (+2.57%) ⬆️
py-3.11 91.61% <50.00%> (+2.43%) ⬆️
py-3.9 91.75% <50.00%> (+0.43%) ⬆️
unittests 91.79% <50.00%> (+0.43%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

Comment on lines -99 to +98
self._repo: Optional[Repo] = None
self._repo: Optional[Any] = None

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preserve type hints:

if TYPE_CHECKING:
  from git import Repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ImportError: Bad git executable.

2 participants