Skip to content

fix: preserve plugin dependency extras during precheck - #10656

Draft
Plastic-time wants to merge 1 commit into
AstrBotDevs:masterfrom
Plastic-time:fix/plugin-dependency-extras
Draft

Plastic-time wants to merge 1 commit into
AstrBotDevs:masterfrom
Plastic-time:fix/plugin-dependency-extras

Conversation

@Plastic-time

@Plastic-time Plastic-time commented Oct 20, 2026 •

Copy link
Copy Markdown

Plugin requirements such as demo[feature]>=1.0 can be skipped when only the base demo distribution is installed. The precheck drops extras while reducing requirements to names and versions, so the plugin loader reports that dependencies are satisfied even when the extra's dependencies are missing.

Modifications

  • Return the existing indeterminate precheck result for active requirements with extras, allowing pip to resolve and verify their transitive dependencies.

  • Keep the fast path for ordinary requirements and skip extras whose environment marker is false.

  • Add regression coverage at the classifier, install-plan, and plugin-install boundaries. No new dependencies or WebUI/API changes.

  • This is NOT a breaking change.

Verification Steps and Test Results

On base f2404c191716a64daaa422be7f3c567cace50d39, the new tests produce 4 failures and 1 pass: the plugin installer is never called for an installed base package with requested extras. After the fix:

  • python -m pytest tests/test_pip_helper_modules.py tests/test_pip_installer.py tests/test_plugin_manager.py -q: 244 passed.
  • ruff format --check .: 519 files already formatted.
  • ruff check .: all checks passed.

Also verified the actual _install_requirements_with_precheck → PipInstaller → pip path offline on Windows x64 / Python 3.12.15. Two local wheels were used: astrbot-extras-probe declares a feature extra requiring astrbot-extras-leaf; only the base wheel was initially installed. With --no-index --find-links pointed at those wheels:

Before: empty install plan → installation skipped → EXTRA_INSTALLED: MISSING
After:  plan is None → existing full-file installation → EXTRA_INSTALLED: 1.0

No live package index was used for this reproduction. The complete repository test suite and Linux/macOS runs were not executed locally. Existing audioop/jieba warnings remain. Prepared with AI assistance.

Checklist

  • The change is a focused bug fix with regression tests and executed verification above.
  • No new dependencies are introduced.
  • No WebUI instructions or screenshots require updates because there are no UI changes.

Summary by Sourcery

Ensure plugin dependency prechecks defer active requirements with extras to pip so their transitive dependencies are correctly verified and installed.

Bug Fixes:

  • Preserve plugin requirement extras during prechecks so missing extra dependencies are resolved and installed even when the base package is already present.

Enhancements:

  • Retain the fast precheck path for ordinary requirements while ignoring extras disabled by inactive environment markers.

Tests:

  • Add regression coverage for active and inactive requirement extras across requirement classification, installation planning, and plugin installation.

This branch has not been deployed

No deployments
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.

1 participant