The Zig programming language, packaged for PyPI

Overview

Zig PyPI distribution

This repository contains the script used to repackage the releases of the Zig programming language as Python binary wheels. This document is intended for maintainers; see the package README for rationale and usage instructions.

The repackaged artifacts are published as the ziglang PyPI package.

Preparation

The script requires Python 3.5 or later.

Install the dependencies:

pip install wheel twine libarchive-c

The libarchive-c Python library requires the native libarchive library to be available.

Building wheels

Run the repackaging script:

python make_wheels.py

This command will download the Zig release archives for every supported platform and convert them to binary wheels, which are placed under dist/. The Zig version and platforms are configured in the script source.

The process of converting release archives to binary wheels is deterministic, and the output of the script should be bit-for-bit identical regardless of the environment and platform it runs under. To this end, it prints the SHA256 hashes of inputs and outputs; the hashes of the inputs will match the ones on the Zig downloads page, and the hashes of the outputs will match the ones on the PyPI downloads page.

Uploading wheels

Run the publishing utility:

twine dist/*

This command will upload the binary wheels built in the previous step to PyPI.

License

This script is distributed under the terms of the MIT (Expat) license.

You might also like...
sawa (ꦱꦮ) is an open source programming language, an interpreter to be precise, where you can write python code using javanese character.
sawa (ꦱꦮ) is an open source programming language, an interpreter to be precise, where you can write python code using javanese character.

ꦱꦮ sawa (ꦱꦮ) is an open source programming language, an interpreter to be precise, where you can write python code using javanese character. sawa iku

The Official interpreter for the Pix programming language.
The Official interpreter for the Pix programming language.

The official interpreter for the Pix programming language. Pix Pix is a programming language dedicated to readable syntax and usability Q) Is Pix the

A topology optimization framework written in Taichi programming language, which is embedded in Python.
A topology optimization framework written in Taichi programming language, which is embedded in Python.

Taichi TopOpt (Under Active Development) Intro A topology optimization framework written in Taichi programming language, which is embedded in Python.

An esoteric programming language that supports concurrency, regex, and web requests.

The Hofstadter Esoteric Programming Language Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's La

Built with Python programming language and QT library and Guess the number in three easy, medium and hard rolls
Built with Python programming language and QT library and Guess the number in three easy, medium and hard rolls

guess-the-numbers Built with Python programming language and QT library and Guess the number in three easy, medium and hard rolls Number guessing game

Built with Python programming language and QT library and Guess the number in three easy, medium and hard rolls
Built with Python programming language and QT library and Guess the number in three easy, medium and hard rolls

password-generator Built with Python programming language and QT library and Guess the number in three easy, medium and hard rolls Password generator

🚀 emojimash 🚀 is a programming language with ALL THE EMOJI

🚀 emojimash 🚀 is a programming language with ALL THE EMOJI

Nook is a simple, concatenative programming language written in Python.

Nook Nook is a simple, concatenative programming language written in Python. Status Nook is currently WIP. It lacks a lot of basic feature, and will n

A programming language that for tech savvy graphic designers

Microsoft Hackathon - PhoTex Idea A programming language that allows tech savvy graphic designers develop scalable vector graphics using plain text co

Comments
  • Support armv7l architecture

    Support armv7l architecture

    Can you publish a wheel for armv7l?

    Older RasPi’s, various embedded boards, OpenWRT routers are the things that could be supported, in addition to the aarch64 port already present

    enhancement 
    opened by MikeKlem 2
  • Question: why not using setuptools/setup.py?

    Question: why not using setuptools/setup.py?

    Feel free to ignore if unhelpful, but I was wondering why a custom make_wheels.py script is being used rather than a standard setup.py script (or perhaps setup.cfg or pyproject.toml) with setuptools? I imagine there's a good reason that I'm not seeing :)

    Perhaps worth pointing out that https://github.com/pypa/wheel#wheel states:

    It should be noted that wheel is not intended to be used as a library, and as such there is no stable, public API.

    The reason I was wondering is I was thinking it might be helpful to give the ziglang package a zig entrypoint, i.e. when installing into a venv with pip install ziglang you would get a venv/bin/zig executable, which would be on PATH when the venv was active. Definitely not necessary for the intended use-case, and not obviously desirable in general, but was just a thought that this could be used as a slight abuse of PyPI/pip just for installing zig!

    question 
    opened by LewisGaul 2
  • Publish wheels for musllinux

    Publish wheels for musllinux

    On Alpine linux running:

    pip install 'ziglang==0.10.0'
    

    Fails with:

    ERROR: Could not find a version that satisfies the requirement ziglang==0.10.0 (from versions: 0.0.0)
    ERROR: No matching distribution found for ziglang==0.10.0
    

    I think this is because the publishing script only releases manylinux wheels and not musllinux wheels https://github.com/ziglang/zig-pypi/blob/8d37e955e3af0c0d88851e8283081b89b074e3bc/make_wheels.py#L115-L122

    Since the linux- binaries published on the zig website are statically linked I think changing

        'linux-x86_64':   'manylinux_2_12_x86_64.manylinux2010_x86_64',
    

    to

        'linux-x86_64':   'manylinux_2_12_x86_64.manylinux2010_x86_64.musllinux_1_1_x86_64',
    

    to the publishing script should work.

    I tested this out locally by downloading ziglang-0.10.0-py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.whl and renaming it to ziglang-0.10.0-py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.musllinux_1_1_x86_64.whl and then running python3 -m ziglang worked fine.

    Publishing this wheel means running pip install maturin[zig] on Alpine linux will work as well.

    opened by zmanji 1
  • Use os.exec rather than sys.exit(subprocess.call(...))

    Use os.exec rather than sys.exit(subprocess.call(...))

    Using an os.exec* function, when available (Unix, Windows) will replace the Python wrapper process, rather than keeping it around until zig has finished. This saves memory and makes processes easier to debug.

    You should be able to change:

    sys.exit(subprocess.call([
        os.path.join(os.path.dirname(__file__), "{entry_name}"),
        *sys.argv[1:]
    ]))
    

    to something like:

    path = os.path.join(os.path.dirname(__file__), "{entry_name}")
    os.execvp("zig", path, *sys.argv[1:])
    
    opened by adamchainz 7
Owner
Zig Programming Language
Zig is a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
Zig Programming Language
Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.

Advent Of Code 2021 - Python English Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels th

Coral Izquierdo Muñiz 2 Jan 9, 2022
Rick Astley Language is a rick roll oriented, dynamic, strong, esoteric programming language.

Rick Roll Language / Rick Astley Language A rick roll oriented, dynamic, strong, esoteric programming language. Prolegomenon The reasons that I made t

Rick Roll Programming Language 658 Jan 9, 2023
PyGo custom language, New but similar language programming

New but similar language programming. Now we are capable to program in a very similar language to Python but at the same time get the efficiency of Go.

Fernando Perez 4 Nov 19, 2022
A PDM plugin to publish to PyPI

PDM Publish A PDM plugin to publish to PyPI NOTE: Consider if you need this over using twine directly Installation If you installed pdm via pipx: pipx

Branch Vincent 20 Aug 6, 2022
Automatically give thanks to Pypi packages you use in your project!

Automatically give thanks to Pypi packages you use in your project!

Ward 25 Dec 20, 2021
PyPI package for scaffolding out code for decision tree models that can learn to find relationships between the attributes of an object.

Decision Tree Writer This package allows you to train a binary classification decision tree on a list of labeled dictionaries or class instances, and

null 2 Apr 23, 2022
Check if Python package names are available on PyPI.

?? isavailable Can I haz this Python package on PyPI? Check if Python package names are available on PyPI. Usage $ isavailable checks whether your des

Felipe S. S. Schneider 3 May 18, 2022
A pypi package details search python module

A pypi package details search python module

Fayas Noushad 5 Nov 30, 2021
PyPIContents is an application that generates a Module Index from the Python Package Index (PyPI) and also from various versions of the Python Standard Library.

PyPIContents is an application that generates a Module Index from the Python Package Index (PyPI) and also from various versions of the Python Standar

Collage Labs 10 Nov 19, 2022
Short, introductory guide for the Python programming language

100 Page Python Intro This book is a short, introductory guide for the Python programming language.

Sundeep Agarwal 185 Dec 26, 2022