Skip to content

Silence Pylance missing-import warning for generated _release_info - #51

Merged
javlor merged 1 commit into
mainfrom
fix/silence-pylance-warning-missing-release_info
Oct 26, 2026
Merged

javlor merged 1 commit into
mainfrom
fix/silence-pylance-warning-missing-release_info

Conversation

@javlor

@javlor javlor commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Pylance reports Import "._release_info" could not be resolved in solarfarmer/__version__.py on a fresh checkout of main.

The warning is expected. solarfarmer/_release_info.py is created by the release workflow (release.yml) only when it builds a tagged release, and .gitignore excludes it, so it never exists in a source checkout. At runtime the import is already wrapped in
try/except ImportError, which falls back to the latest git tag date or "unreleased".

Changes

  • Add # pyright: ignore[reportMissingImports] to the import, with a comment explaining
    why the file is missing in source checkouts.

Impact

  • No runtime behavior change.
  • No CHANGELOG entry, because nothing changes for users.

Validation

  • Pylance diagnostics for __version__.py: none.
  • ruff check and ruff format --check: pass.
  • pytest tests/test_version.py: 2 passed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The change is limited to comments and a targeted diagnostic suppression, with no runtime changes or unresolved findings.

No open issues 🎉

What changed in this PR

Suppresses the expected Pylance warning for the release-generated _release_info module in source checkouts, without changing runtime behavior.

Changes:

  • Adds a targeted reportMissingImports suppression to the import.
  • Adds a comment explaining why the module is absent from source checkouts.
File Description
solarfarmer/​__version__.py Documents and suppresses the expected missing-import diagnostic while preserving the runtime fallback.

Review effort: Balanced

@javlor
javlor merged commit 8bd9d6d into main Oct 26, 2026
15 checks passed
@javlor
javlor deleted the fix/silence-pylance-warning-missing-release_info branch October 26, 2026 14:45
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.

2 participants