File
Blob: src/workerd/server/pyodide.h
| 1 | // Copyright (c) 2017-2022 Cloudflare, Inc. |
| 2 | // Licensed under the Apache 2.0 license found in the LICENSE file or at: |
| 3 | // https://opensource.org/licenses/Apache-2.0 |
| 4 | #pragma once |
| 5 | |
| 6 | #include <workerd/api/pyodide/pyodide.h> |
| 7 | #include <workerd/io/compatibility-date.capnp.h> |
| 8 | #include <workerd/jsg/jsg.h> |
| 9 | |
| 10 | #include <kj/array.h> |
| 11 | #include <kj/compat/http.h> |
| 12 | #include <kj/filesystem.h> |
| 13 | #include <kj/string.h> |
| 14 | #include <kj/timer.h> |
| 15 | |
| 16 | namespace workerd::server { |
| 17 | |
| 18 | // Used to preload the Pyodide bundle during workerd startup |
| 19 | kj::Promise<kj::Maybe<jsg::Bundle::Reader>> fetchPyodideBundle( |
| 20 | const api::pyodide::PythonConfig& pyConfig, |
| 21 | kj::String version, |
| 22 | kj::Network& network, |
| 23 | kj::Timer& timer); |
| 24 | |
| 25 | // Preloads all required Python packages for a worker |
| 26 | kj::Promise<void> fetchPyodidePackages(const api::pyodide::PythonConfig& pyConfig, |
| 27 | const api::pyodide::PyodidePackageManager& pyodidePackageManager, |
| 28 | kj::ArrayPtr<kj::String> pythonRequirements, |
| 29 | workerd::PythonSnapshotRelease::Reader pythonSnapshotRelease, |
| 30 | kj::Network& network, |
| 31 | kj::Timer& timer); |
| 32 | |
| 33 | } // namespace workerd::server |