selectolax
selectolax copied to clipboard
Add pyinstaller hooks?
Hi, it seems that selectolax doesn't work with pyinstaller due to it's Cython codes.
Projects that use hybrid ( python + other language ) approach has to include hooks to allow the projects to be built properly.
For example
If i somehow add selectolax into hidden_import, i get this error
PyInstaller\hooks\rthooks\pyi_rth_pkgres.py:36: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
Traceback (most recent call last):
File "cli.py", line 2, in <module>
File "builder\staff.py", line 2, in <module>
File "selectolax\__init__.py", line 10, in <module>
ImportError: cannot import name 'modest' from partially initialized module 'selectolax' (most likely due to a circular import) (C:\Users\baseplate-admin\AppData\Local\Temp\_MEI235082\selectolax\__init__.pyc)
[30172] Failed to execute script 'cli' due to unhandled exception!
On inspection of the build dir, it seems that pyc files are not build included
Good idea. Are you familiar with hooks?
Good idea. Are you familiar with hooks?
Unfortunately i am not very familiar with hooks.
But the maintainer of pyinstaller replied in this discussion on how this can be added.
https://github.com/orgs/pyinstaller/discussions/8703#discussioncomment-10220874
from PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files("selectolax")
Adding this file to selectolax/_pyinstaller/hook-selectolax.py did the trick
Added it