Skip to content

Advertise zig and ziglang entry points for uv's sake #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.pypi.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ import sys, subprocess
subprocess.call([sys.executable, "-m", "ziglang"])
```

Binary wrapper
--------------

The [ziglang][pypi] Python package installs a binary wrapper for the Zig compiler under the name `python-zig`; the name is different to avoid conflicts with any system-wide or user-wide `zig` binaries that may be already installed.


Using with `uv`
---------------

The Zig compiler distributed in this Python package can be launched by [uv](https://docs.astral.sh/uv) without installation:

```shell
uvx --from ziglang python-zig
```

License
-------

Expand Down
5 changes: 5 additions & 0 deletions make_wheels.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ def write_wheel(out_dir, *, name, version, tag, metadata, description, contents)

return write_wheel_file(os.path.join(out_dir, wheel_name), {
**contents,
f'{dist_info}/entry_points.txt': make_message([],
'[console_scripts]\npython-zig = ziglang.__main__:dummy'
),
f'{dist_info}/METADATA': make_message([
('Metadata-Version', '2.4'),
('Name', name),
Expand Down Expand Up @@ -201,6 +204,8 @@ def write_ziglang_wheel(out_dir, *, version, platform, archive):
os.execv(argv[0], argv)
else:
import subprocess; sys.exit(subprocess.call(argv))

def dummy(): """Dummy function for an entrypoint. Zig is executed as a side effect of the import."""
'''.encode('ascii')

# 1. Check for missing required licenses paths
Expand Down