scientific-python / lazy-loader

Populate library namespace without incurring immediate import costs
BSD 3-Clause "New" or "Revised" License
118 stars 19 forks source link

Fix extension substitution to work with `*.pyc` files #39

Closed Czaki closed 1 year ago

Czaki commented 1 year ago

This PR is the first to solve a problem mentioned in #38.

It is possible that call

__getattr__, __lazy_dir__, _ = lazy.attach_stub(__name__, __file__)

Will provide the file name with .pyc extension so the lazy loader tries to open .pyci file, which does not exist.

Czaki commented 1 year ago

@stefanv What should I do to have this reviewed/merged?

stefanv commented 1 year ago

This looks fine; happy to merge if the tests pass.

Czaki commented 1 year ago

Only linter fails on clone from gitlab. Should I fix it?

stefanv commented 1 year ago

No worries, I got it. Thank you!

Czaki commented 1 year ago

@stefanv is there a plan to release this? I could add a second PR with documentation how to handle with pyinstaller packages that are using this package if it is required/nice.