lazy-fix
Check and fix Python imports into PEP 810 lazy imports.
PEP 810 adds a lazy soft keyword to Python 3.15: lazy import json and
lazy from pathlib import Path defer the import until the name is first
used. lazy-fix is a LibCST-based check/fix
CLI that finds eligible module-level imports and rewrites them to that
syntax.
Install
uv add --dev lazy-fix
Usage
lazy-fix check . # report non-lazy imports, exit 1 if any are found
lazy-fix fix . # rewrite them in place
lazy-fix fix . --diff # preview the changes without writing
Recurses by default, considers .py files only, and skips dot-prefixed
paths and anything .gitignore excludes. Which modules are eligible is
configured via [tool.lazy-fix] in pyproject.toml or a standalone
lazy-fix.toml — see the docs.
On projects whose requires-python doesn't allow 3.15 yet, fix inserts a
__lazy_modules__ marker list instead of the lazy import syntax itself —
PEP 810's own documented forward-compatibility mechanism.
Documentation
https://herogold.github.io/lazy-fix/
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lazy_fix-0.1.0.tar.gz.
File metadata
- Download URL: lazy_fix-0.1.0.tar.gz
- Upload date:
- Size: 51.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bda6632f3247f7256da2b1a2e5e7d78f6e07fcf55886dee6983e764d2c3095d1
|
|
| MD5 |
55861ee6805788e3f6bfd208b6af73a0
|
|
| BLAKE2b-256 |
f3df1376d440fdbf6ee90e21774ed96122b280f9cd9c6bd29954b8917c1e22c8
|
File details
Details for the file lazy_fix-0.1.0-py3-none-any.whl.
File metadata
- Download URL: lazy_fix-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7401d8b3bdb2e9651e57c6e4f6a073812bcc7fe239e8f4340f98e47ccf0f2621
|
|
| MD5 |
651340080fd42b1cff84723f32dcb2ec
|
|
| BLAKE2b-256 |
4bbcf0d9ad9c721a019f1717bdb6ea4af5ee0fa05736b7e5579b7f691d8aa823
|