From d6d185a0ad466ccc3400c468ba2d135acd081593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Tue, 17 Nov 2026 22:10:02 -0800 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9A=A1=20perf(import):=20defer=20server?= =?UTF-8?q?=20helpers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-config.yaml | 6 ++++++ src/devpi_process/__init__.py | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index def1d01..9af8e1a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,6 +39,12 @@ repos: - id: ruff-check priority: 3 args: ["--fix", "--unsafe-fixes", "--exit-non-zero-on-fix"] + - repo: https://github.com/henryiii/flake8-lazy + rev: 7f268b3b3aaf7feca756ca610e37971382976365 # frozen: v0.11.0 + hooks: + - id: flake8-lazy + priority: 2 + files: ^src/ - repo: https://github.com/gaborbernat/simplint-pre-commit rev: "d14a8917a5f578a176baf72ab9ee76314558769f" # frozen: v0.12.3 hooks: diff --git a/src/devpi_process/__init__.py b/src/devpi_process/__init__.py index 7bc74ac..b0f820b 100644 --- a/src/devpi_process/__init__.py +++ b/src/devpi_process/__init__.py @@ -2,6 +2,19 @@ from __future__ import annotations +__lazy_modules__ = [ + "contextlib", + "logging", + "pathlib", + "secrets", + "socket", + "string", + "subprocess", + "sysconfig", + "threading", + f"{__spec__.parent}._version", # ty: ignore[missing-union-attribute] # imported modules have a spec +] + import secrets import socket import string From b67d44dd1dd347b395e4aabcf10f7c0b07862881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Wed, 18 Nov 2026 10:28:36 -0800 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9D=20docs(changelog):=20note=20la?= =?UTF-8?q?zy=20imports?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.d/330.performance.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/330.performance.md diff --git a/changelog.d/330.performance.md b/changelog.d/330.performance.md new file mode 100644 index 0000000..7910fe2 --- /dev/null +++ b/changelog.d/330.performance.md @@ -0,0 +1 @@ +Defer server helper imports on Python 3.15 until a server needs them.