Skip to content

Replace lazy-imports library with stdlib PEP 562 __getattr__ - #80

Merged
evnchn merged 1 commit into
feature/lazy-importsfrom
feature/lazy-imports-pep562
Feb 12, 2026
Merged

evnchn merged 1 commit into
feature/lazy-importsfrom
feature/lazy-imports-pep562

Conversation

@evnchn

@evnchn evnchn commented Feb 12, 2026

Copy link
Copy Markdown
Owner

Summary

Test plan

  • Smoke test: ui.label, ui.clipboard, double-access all work
  • ruff check nicegui/ui.py passes (static __all__ for tooling compatibility)
  • 97 targeted tests pass (clipboard, element, label, button, page, mermaid, echart)
  • Full CI suite

🤖 Generated with Claude Code

Address review feedback on PR zauberzeug#5303:
- Use `_LAZY_IMPORTS` dict + module-level `__getattr__` instead of
  the third-party `lazy-imports` library
- Revert clipboard.py to module-level functions (no breaking API change)
- Remove `lazy-imports` dependency from pyproject.toml
- Keep static `__all__` for ruff/IDE compatibility

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@evnchn
evnchn changed the base branch from main to feature/lazy-imports February 12, 2026 03:11
@evnchn

evnchn commented Feb 12, 2026

Copy link
Copy Markdown
Owner Author

@falkoschindler since all tests pass, please review this when you have time

@falkoschindler

Copy link
Copy Markdown

@evnchn Let's merge and review the result in PR zauberzeug#5303.

@evnchn
evnchn marked this pull request as ready for review February 12, 2026 12:32
@evnchn
evnchn merged commit 57488f8 into feature/lazy-imports Feb 12, 2026
12 of 14 checks passed
@evnchn
evnchn deleted the feature/lazy-imports-pep562 branch February 12, 2026 12:32
falkoschindler added a commit that referenced this pull request Mar 12, 2026
### Motivation

This PR addresses multiple Dependabot security alerts by bumping
vulnerable dependencies to their patched versions:

- [#67](https://github.com/zauberzeug/nicegui/security/dependabot/67) -
`lodash-es` for vanilla-jsoneditor (json_editor element)
- [#68](https://github.com/zauberzeug/nicegui/security/dependabot/68) -
`fonttools` for matplotlib
- [#72](https://github.com/zauberzeug/nicegui/security/dependabot/72) -
`aiohttp` ≥3.13.3
- [#80](https://github.com/zauberzeug/nicegui/security/dependabot/80) -
`urllib3` ≥2.6.3
- [#83](https://github.com/zauberzeug/nicegui/security/dependabot/83) -
`orjson` ≥3.11.5

### Implementation

- Updated pyproject.toml with new minimum versions for `aiohttp`,
`orjson`, `urllib3`, and added `fonttools` to the matplotlib extra
- Pinned `lodash-es` ^4.17.23 in package.json for two elements to
override vulnerable transitive dependencies
- Regenerated package-lock.json files and uv.lock (`npm run build`
didn't change anything in the generated bundles)

### Progress

- [x] I chose a meaningful title that completes the sentence: "If
applied, this PR will..."
- [x] The implementation is complete.
- [x] This is not a security issue in NiceGUI itself, but updating
dependencies with already-public CVEs.
- [x] Pytests are not necessary.
- [x] Documentation is not necessary.
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