Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cache for _find_maturin_project_above #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/maturin_import_hook/project_importer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import contextlib
import functools
import importlib
import importlib.abc
import importlib.machinery
Expand Down Expand Up @@ -373,6 +374,7 @@ def _is_editable_installed_package(project_dir: Path, package_name: str) -> bool
return False


@functools.cache
def _find_maturin_project_above(path: Path) -> Optional[Path]:
for search_path in itertools.chain((path,), path.parents):
if is_maybe_maturin_project(search_path):
Expand Down