These are general guidelines for working in this workspace.
- Be direct and concise in your responses.
- Provide clear explanations for your actions.
- Use the
docs/directory for all documentation. - Follow the existing structure of the project when adding new files.
- Use the
Makefileto build the project.
- Follow the coding style of the existing code.
- Write tests for new features.
- This project is a Python distribution for the browser and Node.js based on WebAssembly.
- The project is hosted on GitHub at https://github.com/pyodide/pyodide.
- Compiler: Work on the CPython compilation to WebAssembly, including LLVM and Emscripten.
- Python: Improve the Python interpreter, including standard library compatibility, performance, and size.
- Package Support: Add support for new packages, including those with C, C++, Fortran, or Rust extensions.
- Packaging and Distribution: Improve the packaging and distribution of Pyodide and its packages.
- Browser Integration: Enhance the interaction between the Python and JavaScript runtimes.
- JS Runtimes: Improve support for different JavaScript runtimes, such as Node.js, Deno, and Bun.
- Tooling: Improve the build system, package installer, and testing infrastructure.
- Documentation: Improve the existing documentation and add new content.
- Application Development: Build new applications using Pyodide.
- The development environment is Linux-based.
- For Windows users, WSL or GitHub Codespaces is recommended.
- Follow the instructions in the documentation to build Pyodide from source.
- cpython/: Contains the CPython source code, patches, and build scripts.
- src/: Contains the JavaScript and Python APIs, as well as the Foreign Function Interface (FFI).
- packages/: Contains the recipes for building Python packages.
- pyodide-build/: Contains the build system for Pyodide. pyodide-build is a submodule and we do not directly modify the source code in this repository. All the pyodide-build-related changes should be dealt separately in pyodide-build repository.
- WebAssembly: The compilation target for the CPython interpreter and native extensions.
- Emscripten: The compiler toolchain used to build WebAssembly modules for the browser.
- LLVM: The underlying compiler infrastructure used by Emscripten.
- Use
maketo build the project. - For a streamlined build process, use the provided Docker image.
- When building from source, follow the specific instructions for your operating system (Linux, macOS).
- Python packages are built using recipes defined in
meta.yamlfiles. - To add a new package, create a recipe and add it to the
pyodide-recipesrepository. - Use
pyodide buildto build individual packages from source.
- Follow the development workflow outlined in
docs/development/contributing.md. - Adhere to the Code of Conduct.
- Use
prek(faster alternative topre-commit) to ensure code style consistency.
- When modifying the core C code in
src/core, follow the guidelines indocs/development/core.md. - Use the provided error handling macros for consistency.
- Follow the specified function structure for clarity and correct resource management.
- Use
pytestfor the Python test suite andnpm testfor the JavaScript tests. - Refer to
docs/development/debugging.mdfor tips on debugging, including how to handle linker errors and build with symbols.
- All documentation is located in the
docs/directory. - The documentation is organized into three main sections:
usage,development, andproject. - New documentation should be added to the appropriate section.
- The documentation is built using Sphinx.
- The required Python packages for building the documentation are listed in
docs/requirements-doc.txt. - When adding new dependencies, update
docs/requirements-doc.txt.
- The main entry point for the documentation is
docs/index.rst. - We only use markdown except for the index.rst file.
- JavaScript and TypeScript documentation is handled via
sphinx-js.
- The
Makefileandmake.batfiles in thedocs/directory are used to build the documentation. - Use
make helpto see available build targets.