Skip to content

Revamped pyodide support #1203

Description

@kylebarron

Need to be able to turn off thread creation in the ThreadPoolExecutor

import sys
from concurrent.futures import Executor, Future

class SynchronousExecutor(Executor):
    """Executes immediately on the calling thread."""
    def submit(self, fn, /, *args, **kwargs):
        future = Future()
        try:
            future.set_result(fn(*args, **kwargs))
        except BaseException as exc:
            future.set_exception(exc)
        return future

def make_executor(max_workers=None):
    if sys.platform == "emscripten":
        return SynchronousExecutor()
    from concurrent.futures import ThreadPoolExecutor
    return ThreadPoolExecutor(max_workers=max_workers)

Dependencies

All dependencies now work in pyemscripten, see kylebarron/arro3#502, kylebarron/arro3#504, geoarrow/geoarrow-rs#1448

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions