long2ice / meilisync

Realtime sync data from MySQL/PostgreSQL/MongoDB to Meilisearch
https://github.com/long2ice/meilisync
Apache License 2.0
247 stars 37 forks source link

Module instrospection seems to break EXE build with pyinstaller #38

Open markusthegeek opened 9 months ago

markusthegeek commented 9 months ago

I successfully built a one file executable on Windows using Python 3.12 an pyinstaller, however I am getting an error that the value "file" is not valid for progress type. I think the same error happens for source type "mongo" as well.

Is it possible that the way these classes are found via introspection here is too complex for pyinstaller?

Would be great to be able to package both the Meilisearch executable and your great sync tool along with a C++ based end user app that uses MongoDB :-D

def _discover(module: ModuleType, t: Type):
    ret = {}
    for m in pkgutil.iter_modules(module.__path__):
        mod = importlib.import_module(f"{module.__name__}.{m.name}")
        for _, member in inspect.getmembers(mod, inspect.isclass):
            if issubclass(member, t) and member is not t:
                ret[member.type] = member
    return ret