const py = @import("pydust");
pub fn hello() !py.PyString {
return try py.PyString.create("Hello!");
}
comptime {
py.rootmodule(@This());
}
Import compiled to Python, run your module hello
Method and you will get back Python shong with text Hello!
. Functions, class and instance of the class, exceptions, Python protocol (for access with zero kicks) and GIL suspension are available through pydust.
Pydust currently has several restrictions. The largest and most problematic is that it currently supports only ZIG version 0.11. It also seems that the development of Pydust to support future versions of ZIG will also become. The open problem on Github monitors efforts to add support for the latest versions of ZIG. Another possible restriction, depending on how you evolve with Python, is Pydust’s dependence on the petty project management system. If you are no longer using poetry, you may need to rework your workflow to set things properly.
Conclusion
Python has been surrounded for decades, with a firmly established Mayra behavior that does not go anywhere. Zig is a young language and is developing quickly, with Virgin of the room for change. Both of them complement each other more that compete, and we only started to see all the ways they can work together.