Skip to content

pypi distribution with python bindings #174

Description

@vriesdemichael

Python Integration: PyPI (The Shared Library Vector)
The Concept: Instead of distributing a raw executable, you compile the Go code into a C-shared library and wrap it in Python. This allows users to pip install your tool, exposing both a Python API and a CLI command. Warning: This forces you to enable CGO, which drastically increases the risk of triggering Windows Defender ML false positives.
The Implementation Checklist:
[ ] Refactor Go Code: Modify your Go entry points to use //export tags so the functions can be called by C/Python.
[ ] Create Python Wrapper: Write a Python module using ctypes or cffi to load the compiled .so/.dll and expose the CLI entry point in pyproject.toml.
[ ] Set Up a Separate Pipeline: Create a new GitHub Action workflow entirely separate from GoReleaser.
[ ] Configure cibuildwheel: Implement cibuildwheel in the action to compile the Go code with CGO_ENABLED=1 and -buildmode=c-shared, and package it into .whl files across the OS/Architecture matrix.
[ ] Configure Trusted Publishing: Set up PyPI Trusted Publishing (OIDC) in your GitHub Action so it can securely push the wheels to PyPI without needing static passwords.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions