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

Revert the addition of translate c usage

Open ivansantiagojr opened this issue 3 months ago • 5 comments

Changes

Use @cImport because translate-c does not work with files outside of the source directory, and pydust.build.zig depends on it to work.

The original changes were added in the commit 9fb5721771d0f3c28e98ce6a45386611943946dc, and that also removed usingnamespace, so I was careful I did not re-add those.

Notes

Discussions about this happened in the PR #500, where I got stuck with the usage of translate-c, so @jburgy listed 2 ways to fix that in this comment .

I decided to revert the change and use @cImport again because ziglang/translate-c does not have tagged releases and it targes latest Zig, even when unstable. It is worth keeping an eye on this library, though, we might want to use that in the future Zig releases.

ivansantiagojr avatar Sep 02 '25 02:09 ivansantiagojr

Note: I made these changes in a single commit so it is easier to re-revert, but if need, I am happy to split into multiple commits!

ivansantiagojr avatar Sep 04 '25 12:09 ivansantiagojr

I am confused by this change - isn't @cimport going to go away and translate_c is going to be the only way forward? I would prefer to figure out a way to adjust the build script instead of relying on deprecated functionality. TranslateC is shipped as part of Zig compiler itself. I think the standard management practice for any c style dependencies is to import the header file you code against and then link as approriate against local build or a shared library.

robert3005 avatar Sep 29 '25 00:09 robert3005

I see, had to read the upstream zig issue. We can merge this and go back to translatec with zig 0.16

robert3005 avatar Sep 29 '25 00:09 robert3005

I see, had to read the upstream zig issue. We can merge this and go back to translatec with zig 0.16

Agreed, @robert3005. I believe this is the way to go in this case.

ivansantiagojr avatar Sep 29 '25 01:09 ivansantiagojr

I am investigating the problem in the CI, it looks like Python libraries are not properly installed maybe? I will research the diff between ci.yml and find out what's going on.

ivansantiagojr avatar Oct 01 '25 23:10 ivansantiagojr

I have investigated this and tried to fix this for quite some time. It looks like that, for some reason, the Python library is not found during tests (and in the 0.26 release, I get the same error we have here locally). I am out of ideas to fix this, maybe awaiting for 0.16?

I wonder if someone from the community or most recent contributors would know better than me (cc @jburgy @robert3005 @boisgera)

Important: I believe this error started happening when

      - name: Run library tests
        run: poetry run python -m ziglang build test

was added to ci.yml.

ivansantiagojr avatar Dec 05 '25 21:12 ivansantiagojr