Replies: 6 comments 6 replies
-
Speficially, we have mutable comptime state in ziggy-pydust/pydust/src/discovery.zig Lines 36 to 43 in 5407e11 So we're really looking for folks to experiment with different ways of designing a new API that doesn't use discovery in this way. We can then try to reach consensus on one that works well. This isn't an easy thing to do. I don't think it makes sense to hand off to a maintainer that doesn't have a good grasp or good ideas on how to redevelop this part of the project. |
Beta Was this translation helpful? Give feedback.
-
Helpful, thank you @gatesn. The first version of zig I used is 0.13.x so I never knew fn defword(
comptime last: ?[]const Instr,
comptime flag: Flag,
comptime name: []const u8,
comptime data: []const []const Instr,
) [offset + data.len + 1]Instr {
const code = [_]Instr{.{ .code = docol_ }} ++ comptime init: {
var code: [data.len]Instr = undefined;
for (&code, data) |*d, s| {
d.* = .{ .word = codeFieldAddress(s.ptr) };
}
break :init &code;
};
return defword_(last, flag, name, code);
} namely mutating a "regular" |
Beta Was this translation helpful? Give feedback.
-
UPDATE: I just realized that I have been succefully using |
Beta Was this translation helpful? Give feedback.
-
Over a month and many false starts later, I finally got something that works with zig 0.13 and python 3.12. I did have to tweak the API: const py = @import("pydust");
const root = @This();
pub fn hello() !py.PyString(root) {
return try py.PyString(root).create("Hello!");
}
comptime {
py.rootmodule(root);
} which gives me ~/ziggy-pydust$ PYTHONPATH=example python -c "from hello import hello; print(hello())"
Hello! So instead of @gatesn, @robert3005, @slonik-az, please review #429 |
Beta Was this translation helpful? Give feedback.
-
@gatesn good news: #429 is in reasonable shape and all python tests pass! test "pydust-expected-failure" {
py.initialize();
defer py.finalize();
const str = try py.PyString(root).create("hello");
defer str.decref();
try std.testing.expectEqualStrings("world", try str.asSlice());
} |
Beta Was this translation helpful? Give feedback.
-
#429 was merged which renders this discussion moot |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
(continued from #420)
@gatesn how do you propose we "engage on some proposals for how to bring the project up to date with latest Zig"? I have some spare cycles and am happy to get my hands dirty. Would love pointers on "features of comptime that are no longer supported >0.12.0"
Beta Was this translation helpful? Give feedback.
All reactions