ziggy-pydust icon indicating copy to clipboard operation
ziggy-pydust copied to clipboard

[QUESTION] Is it possible to use external Zig dependencies?

Open ivansantiagojr opened this issue 6 months ago • 0 comments

How can I use external Zig dependencies in Ziggy Pydust projects?

For example, if I have a build.zig like in the docs:

const std = @import("std");
const py = @import("./pydust.build.zig");

pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});

    // Each Python module consists of a library_step and a test_step
    const module = pydust.addPythonModule(.{
        .name = "example.hello",
        .root_source_file = .{ .path = "example/hello.zig" },
        .target = target,
        .optimize = optimize,
    });
    module.library_step.addModule(..., ...);
    module.test_step.addModule(..., ...);
}

And I dowloaded a Zig library with:

zig fetch --save git+https://github.com/zigimg/zigimg.git

where would the following setup go in my build.zig?

const zigimg_dependency = b.dependency("zigimg", .{
    .target = target,
    .optimize = optimize,
});

exe.root_module.addImport("zigimg", zigimg_dependency.module("zigimg"));

I see that in the example we have module.library_step.addModule(..., ...);, but it does not seem like this still exists.

ivansantiagojr avatar May 26 '25 13:05 ivansantiagojr