Open twiecki opened 1 month ago
I don't think it makes sense to go out of our way to make a standard python lib import optional. It's an anti-pattern to import things inside functions.
I agree it's an anti-pattern, but I think it certainly makes sense here because with a pretty simple change we enable PyMC in the browser. So I think the added tech debt is worth it. We can also make it optional if we're running on pyodide.
We can also make it optional if we're running on pyodide.
How does that look like?
if 'pyodide' in sys.modules:...
On Wed, Oct 2, 2024, 18:23 Ricardo Vieira @.***> wrote:
We can also make it optional if we're running on pyodide.
How does that look like?
— Reply to this email directly, view it on GitHub https://github.com/pymc-devs/pymc/issues/7519#issuecomment-2388300700, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFETGC4KO56WKJ7IOHONKDZZPCQ3AVCNFSM6AAAAABPHH3TUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBYGMYDANZQGA . You are receiving this because you authored the thread.Message ID: @.***>
That's even uglier
So what do we do?
Local import or nothing. Should an issue be open with pyodide as well?
OK, I don't mind which way. What issue would that be?
OK, I don't mind which way. What issue would that be?
Shouldn't pyodide support the python standard library?
Shouldn't pyodide support the python standard library?
I don't think it's an oversight, they just haven't figured out multiprocessing yet.
Looking at this from the PyData NYC sprint. I don't really see how we could unblock this given that multiprocessing
is used in various other modules in PyMC
. Would we make the import local to all of the modules that use it??
Where else is it being used? I guess that'd be the only way then, depends in how many modules we use it.
Description
We almost have PyMC working natively under pyodide. But upon import we get an error importing multiprocessing which isn't included in pyodide:
If we made that optional, it will work out of the box.