Skip to content

Requirements generation includes type-only and tree-shaken imports #513

Description

@tinovyatkin

Problem

BundleOrchestrator::generate_requirements scans every import item in every sorted module and classifies it as third-party. It does not consume tree-shaking liveness and explicitly ignores the is_type_checking_only metadata already produced by ImportDiscoveryVisitor.

Consequently, imports under if TYPE_CHECKING: and imports referenced only by removed code are emitted into requirements.txt even though the bundle does not require them at runtime.

Impact

Generated requirements overstate runtime dependencies and can force installation of optional, platform-specific, or type-checker-only packages. The same behavior would make the planned dependency analyzer report false positives.

Import-name to distribution-name mapping is a separate concern already tracked by #141.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions