Skip to content

refactor(utilities): rename utilities.lazy to utilities.importlib (#2747) - #2748

Merged
JarryShaw merged 1 commit into
mainfrom
refactor/2747-utilities-importlib
Nov 3, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
refactor/2747-utilities-importlib

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • refactor — changes neither behaviour nor performance

Description of your pull request and other information

Renames pcapkit.utilities.lazy to pcapkit.utilities.importlib, as the owner asked, following the pcapkit.utilities.pickle precedent. lazy_exports keeps its name.

  • git mv of the module and of its docs page. Every import in the pcapkit.const packages, the utilities index and toctree, const-vendor-pairing.rst and the tests now use the new path.
  • The old path was never released, so it gets no shim, no re-export and no versionchanged note. pcapkit.utilities.lazy no longer imports.
  • The stdlib is not shadowed: after import pcapkit, sys.modules['importlib'] is still the stdlib module, and that is what the new module's own import importlib binds.
  • mypy is clean and pylint rates it 10.00. A clean-venv docs build has zero warnings.

Closes #2747

)

The owner asked to rename the module holding `lazy_exports`. `importlib`
follows the stdlib-domain naming `pcapkit.utilities.pickle` set (#2722);
`imp` was passed over as the name of the stdlib module Python 3.12 removed.

`lazy_exports` keeps its name. Every `pcapkit.const` package imports it
from the new path, and the API page (renamed with its toctree entry), the
const-vendor pairing convention and the tests follow. The old path never
shipped, so it gets no re-export, no shim and no deprecation note.

The module's own `import importlib` is absolute, so it still binds the
standard library module, and `sys.modules['importlib']` is unchanged after
`import pcapkit`.
@JarryShaw JarryShaw added refactor Restructuring for its own sake — neither a fix nor a new capability (refactor: prefix) review: running A cross-review is in flight against the current head - no verdict yet labels Nov 3, 2026
@github-actions github-actions Bot added this to the PyPCAPKit v1.6 milestone Nov 3, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Nov 3, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

GOOD TO GO at a805555f7, from a Sonnet review.

  • Complete: no reference to utilities.lazy remains outside the changelog, which chore(docs): centralise changelog entries for unreleased versions #2483 renames later. No workflow, package-data or conf.py entry names the old module.
  • The stdlib is not shadowed. After import pcapkit, sys.modules['importlib'] is the stdlib, and import_module, reload, util and metadata all work. No relative import binds our module.
  • Behaviour is unchanged. tests/utilities, tests/const, and the doc-claim, re-export, public-API, boundary and underline tests pass, and a probe gives the same output on head and base.
  • Project tests, Lint and deploy-pages pass.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Coverage: 94.44% (unit tier, Python 3.15, a805555f7, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 20918 175 2908 156 98.57%
pcapkit/corekit 2866 76 918 37 96.80%
pcapkit/dumpkit 286 3 102 3 98.45%
pcapkit/foundation 3505 27 1216 32 98.75%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 22653 150 5878 124 99.03%
pcapkit/toolkit 961 26 342 8 96.62%
pcapkit/utilities 559 7 150 5 98.31%
pcapkit/vendor 5590 2286 1280 214 55.75%

Per-file detail: the coverage-html artifact of this run.

@JarryShaw
JarryShaw merged commit f45c82b into main Nov 3, 2026
67 checks passed
@JarryShaw
JarryShaw deleted the refactor/2747-utilities-importlib branch November 3, 2026 19:58
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Nov 3, 2026
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Nov 3, 2026
JarryShaw added a commit that referenced this pull request Nov 3, 2026
- Fixed: a layer rebuilt by from_data reports its payload's messages once,
  where 1.5.x logged them twice, and IPv4 and the frame-end layers record a
  cut as their own short read (#2738), a new entry; old values measured
  against v1.5.1.
- Folded into unreleased entries (#2738): a standalone IGMPv3 Report sized
  by its record count, into the IGMP entry; the recorded cuts' TRUNCATED
  status, TSO IPv4 and ICMPv4 included, into the checksum entry; ListField's
  count, into its zero-fill entry; the quiet rebuilt payload, into the
  conventions entry.
- #2748: pcapkit.utilities.lazy becomes pcapkit.utilities.importlib in the
  lazy-import and conventions entries; the old name appears nowhere.
- No entry for the direct-pushed 21ec0a6, which has no pull request or
  issue to cite.
- CHANGELOG.md regenerated; util/changelog_md.py --check passes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Restructuring for its own sake — neither a fix nor a new capability (refactor: prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

refactor(utilities): rename utilities.lazy to utilities.importlib

1 participant