Skip to content

perf(protocols): import the protocol, schema and data packages lazily #2730

Closed

Description

@JarryShaw

Ruling (owner, in session): the pcapkit.protocols packages, along with their schema and data subpackages, import lazily where possible, as pcapkit.const does in the companion issue.

#2534 regroups each protocol's protocol, schema and data modules, and it moves every module these package __init__ files import. This is blocked until #2534 merges, so the two changes do not rewrite the same files at once. It then reuses the shared lazy-import helper from the const work.

  • Protocol dispatch already imports the next layer by module path, so making the packages lazy should keep dispatch working. Each registry that a package's import fills in, such as the register calls, has to keep working.
  • Measure import pcapkit before and after.

Activity

  1. added this to the PyPCAPKit v1.6 milestone on Nov 3, 2026
  2. added
    perfPull requests that improve performance (perf: subject prefix)
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    on Nov 3, 2026
  3. moved this to Blocked in PyPCAPKiton Nov 3, 2026
  4. JarryShaw commented on Nov 4, 2026

    @JarryShaw
    OwnerAuthor

    #2534 has landed (#2753), so this is unblocked. A fix is in progress on a branch off 1b4f9703e. It makes the layer-level and top-level protocol aggregation lazy through lazy_exports. Each protocol package __init__ keeps its literal imports, per the #2753 layout ruling. It measures import pcapkit first, and stops with a recommendation if the gain is negligible.

  5. added
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    on Nov 4, 2026
  6. moved this from Blocked to WIP in PyPCAPKiton Nov 4, 2026
  7. JarryShaw commented on Nov 4, 2026

    @JarryShaw
    OwnerAuthor

    The PR is #2757.

  8. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    perfPull requests that improve performance (perf: subject prefix)

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions