diff --git a/aio_pika/__init__.py b/aio_pika/__init__.py index c59c26a2..2b6c993c 100644 --- a/aio_pika/__init__.py +++ b/aio_pika/__init__.py @@ -18,6 +18,12 @@ __version__ = Distribution.from_name("aio-pika").version +def _py_installer_hook() -> list[str]: + from pathlib import Path + + return [str(Path(__file__).resolve().parent)] + + __all__ = ( "AMQPException", "Channel", diff --git a/aio_pika/hook-aio_pika.py b/aio_pika/hook-aio_pika.py new file mode 100644 index 00000000..5dfc4b1e --- /dev/null +++ b/aio_pika/hook-aio_pika.py @@ -0,0 +1,4 @@ +from PyInstaller.utils.hooks import copy_metadata + + +datas = copy_metadata("aio-pika") diff --git a/pyproject.toml b/pyproject.toml index fe61b520..6597aaae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,9 @@ dependencies = [ "yarl", ] +[project.entry-points.pyinstaller40] +hook-dirs = "aio_pika:_py_installer_hook" + [project.urls] Homepage = "https://github.com/mosquito/aio-pika" Source = "https://github.com/mosquito/aio-pika" @@ -108,6 +111,10 @@ files = [ "docs/source/rabbitmq-tutorial/examples/6-rpc", ] +[[tool.mypy.overrides]] +module = ["PyInstaller.*"] +ignore_missing_imports = true + [[tool.mypy.overrides]] module = ["tests.*"] check_untyped_defs = true