Skip to content

Commit

Permalink
Most of the framework and some tests for global instrumentation.
Browse files Browse the repository at this point in the history
- More work is still needed.
  • Loading branch information
Sachaa-Thanasius committed Sep 13, 2024
1 parent 7ffeeab commit 375fff2
Show file tree
Hide file tree
Showing 10 changed files with 3,931 additions and 160 deletions.
12 changes: 6 additions & 6 deletions benchmark/bench_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ def bench_regular() -> float:


def bench_defer_imports() -> float:
defer_imports.install_defer_import_hook()

with CatchTime() as ct:
import benchmark.sample_defer_imports

defer_imports.uninstall_defer_import_hook()
# with defer_imports.install_import_hook(), CatchTime() as ct:
# import benchmark.sample_defer_imports
# print(len(dir(benchmark.sample_defer_imports)))
with defer_imports.install_import_hook(is_global=True), CatchTime() as ct:
import benchmark.sample_regular
print(len(dir(benchmark.sample_regular)))
return ct.elapsed


Expand Down
1,695 changes: 1,695 additions & 0 deletions global_output.txt

Large diffs are not rendered by default.

1,696 changes: 1,696 additions & 0 deletions local_output.txt

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ defer_imports = ["src"]
[tool.coverage.run]
plugins = ["covdefaults"]
source = ["defer_imports", "tests"]
omit = ["src/defer_imports/_typing.py", "src/defer_imports/console.py"]
omit = [
"src/defer_imports/_typing.py", # Has a module-level __getattr__ that isn't invoked at runtime.
"src/defer_imports/console.py", # Has a REPL that is manually tested currently.
]

[tool.coverage.report]
fail_under = 90
Expand Down
4 changes: 2 additions & 2 deletions src/defer_imports/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
manager.
"""

from ._core import __version__, install_defer_import_hook, uninstall_defer_import_hook, until_use
from ._core import __version__, install_import_hook, until_use


__all__ = ("__version__", "install_defer_import_hook", "uninstall_defer_import_hook", "until_use")
__all__ = ("__version__", "install_import_hook", "until_use")
Loading

0 comments on commit 375fff2

Please sign in to comment.