See also the generated Zig documentation.
By far the easiest way to get started is by creating a project from our GitHub template: github.com/fulcrum-so/ziggy-pydust-template/
This template includes:
- A Python Poetry project
src/directory containing a Pydust Python module
- Pytest setup for running both Python and Zig unit tests.
- GitHub Actions workflows for building and publishing the package.
- VSCode settings for recommended extensions, debugger configurations, etc.
Assuming you have an existing Poetry project, these are the changes you need to make to
pyproject.toml to setup Ziggy Pydust. But first, add Pydust as a dev dependency:
We recommend locking the build dependency minor version before
As well as creating the
build.py for Poetry to invoke the Pydust build.
My First Module
Once Poetry is configured, add a Pydust module to your
pyproject.toml and start writing some Zig!
poetry install will build your modules. After this, you will be
able to import your module from within
poetry shell or
poetry run pytest.
Zig Language Server
Currently ZLS (at least when running in VSCode) requires a small amount of manual setup.
In the root of your project, create a
zls.build.json file containing the path to your python executable.
This can be obtained by running
poetry env info -e.
Pydust makes it easy to get started building a Zig extension for Python. But when your use-case becomes sufficiently
complex, you may wish to have full control of your
By default, Pydust will generated two files:
pydust.build.zig- a Zig file used for bootstrapping Pydust and configuring Python modules.
build.zig- a valid Zig build configuration based on the
tool.pydust.ext_moduleentries in your
In self-managed mode, Pydust will only generate the
pydust.build.zig file and your are free to manage your own
To enable this mode, set the flag in your
pyproject.toml and remove any
You can then configure Python modules from a custom