Skip to main content

- courtesy of pycon us 2026 steering council presentation

NO

... unless

please don't use this

no seriously. I do not need another joke package of mine to be deemed "critical" to pypi 1

ok how do I use it

  1. pip install future-lazy-imports
  2. add # -*- coding: future-lazy-imports -*- to the top of your file (second line if you have a shebang)
  3. use lazy import ... and lazy from ... as normal!
# -*- coding: future-lazy-imports -*-
lazy from asyncio import run

async def hello():
    print('hello hello world!')

def main():
    run(hello())  # lazily imported!

if __name__ == '__main__':
    raise SystemExit(main())
$ time python3 t.py
hello hello world!

real    0m0.064s
user    0m0.061s
sys 0m0.007s
$ time python3  -c 'import t'

real    0m0.027s
user    0m0.023s
sys 0m0.005s

wow!

problems

this doesn't actually implement the PEP, notably __lazy_imports__ doesn't work also this adds a little bit of overhead to every function (since we don't have the freedom to add code to LOAD_GLOBAL) and I'm pretty sure lambda doesn't work ¯\_(ツ)_/¯

sometimes stacktraces point to the wrong line number (if your function starts with a block statement)

see also please don't use this

  1. with almost a million downloads per month and 45M+ total ↩

Metadata

Release files for future-lazy-imports 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for future-lazy-imports 1.0.1
File Size Uploaded Provenance Actions
future_lazy_imports-1.0.1.tar.gz 5.3 kB Without provenance Details for future_lazy_imports-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for future-lazy-imports 1.0.1
File Interpreter ABI Platform Actions
future_lazy_imports-1.0.1-py3-none-any.whl Python 3 none any Details for future_lazy_imports-1.0.1-py3-none-any.whl

Total release size: 10.9 kB

Release files / future_lazy_imports-1.0.1.tar.gz

Download URL future_lazy_imports-1.0.1.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d466ba7d65a83aa7b02fcd2b99617ecd821c94d99698dc359d5958efee469363
BLAKE2b-256 checksum
How to use checksums
400d3cdbba14a5cb95c0d3e647ffc2550b7e274d8ea7ff0f49fd488caaf0d03c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / future_lazy_imports-1.0.1-py3-none-any.whl

Download URL future_lazy_imports-1.0.1-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
57a8c8691467db2a39e14126a5e034c32357910fcab9b5c2f039f694aa8143f4
BLAKE2b-256 checksum
How to use checksums
ebf21083a4166e6dc642831f942e37851d9561b19fdd3c71c7e20ee6654c0381
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Security for future-lazy-imports 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page