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/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. 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