go-to-wheel 0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,48 @@
1
+ name: Publish Python Package
2
+
3
+ on:
4
+ release:
5
+ types: [created]
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ matrix:
12
+ python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
13
+ steps:
14
+ - uses: actions/checkout@v6
15
+ - name: Set up Python ${{ matrix.python-version }}
16
+ uses: actions/setup-python@v6
17
+ with:
18
+ python-version: ${{ matrix.python-version }}
19
+ cache: 'pip'
20
+ cache-dependency-path: pyproject.toml
21
+ - name: Install dependencies
22
+ run: |
23
+ pip install -e . --group dev
24
+ - name: Run tests
25
+ run: |
26
+ pytest
27
+ deploy:
28
+ runs-on: ubuntu-latest
29
+ environment: release
30
+ permissions:
31
+ id-token: write
32
+ needs: [test]
33
+ steps:
34
+ - uses: actions/checkout@v6
35
+ - name: Set up Python
36
+ uses: actions/setup-python@v6
37
+ with:
38
+ python-version: '3.14'
39
+ cache: pip
40
+ cache-dependency-path: '**/pyproject.toml'
41
+ - name: Install dependencies
42
+ run: |
43
+ pip install setuptools wheel build
44
+ - name: Build
45
+ run: |
46
+ python -m build
47
+ - name: Publish
48
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,24 @@
1
+ name: Test
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
11
+ steps:
12
+ - uses: actions/checkout@v6
13
+ - name: Set up Python ${{ matrix.python-version }}
14
+ uses: actions/setup-python@v6
15
+ with:
16
+ python-version: ${{ matrix.python-version }}
17
+ cache: 'pip'
18
+ cache-dependency-path: pyproject.toml
19
+ - name: Install dependencies
20
+ run: |
21
+ pip install -e . --group dev
22
+ - name: Run tests
23
+ run: |
24
+ pytest -vv
@@ -0,0 +1,8 @@
1
+ .python-version
2
+ uv.lock
3
+ __pycache__/
4
+ *.pyc
5
+ .pytest_cache/
6
+ .venv/
7
+ dist/
8
+ *.egg-info/
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,145 @@
1
+ Metadata-Version: 2.4
2
+ Name: go-to-wheel
3
+ Version: 0.1
4
+ Summary: Compile Go CLI programs into Python wheels
5
+ Project-URL: Homepage, https://github.com/simonw/go-to-wheel
6
+ Project-URL: Issues, https://github.com/simonw/go-to-wheel/issues
7
+ Project-URL: CI, https://github.com/simonw/go-to-wheel/actions
8
+ Project-URL: Changelog, https://github.com/simonw/go-to-wheel/releases
9
+ Author: Simon Willison
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+
15
+ # go-to-wheel
16
+
17
+ [![PyPI](https://img.shields.io/pypi/v/go-to-wheel.svg)](https://pypi.org/project/go-to-wheel/)
18
+ [![Changelog](https://img.shields.io/github/v/release/simonw/go-to-wheel?include_prereleases&label=changelog)](https://github.com/simonw/go-to-wheel/releases)
19
+ [![Tests](https://github.com/simonw/go-to-wheel/workflows/Test/badge.svg)](https://github.com/simonw/go-to-wheel/actions?query=workflow%3ATest)
20
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/go-to-wheel/blob/main/LICENSE)
21
+
22
+ Compile Go CLI programs into Python wheels.
23
+
24
+ This tool takes a Go module directory, cross-compiles it for multiple platforms, and produces properly-tagged Python wheels that can be installed via `pip` or `pipx` to get the Go binary on your PATH.
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ pip install go-to-wheel
30
+ # or
31
+ pipx install go-to-wheel
32
+ ```
33
+
34
+ Requires Go to be installed and available in your PATH.
35
+
36
+ ## Quick start
37
+
38
+ Build wheels for all platforms from a Go module:
39
+
40
+ ```bash
41
+ go-to-wheel path/to/go-module
42
+ ```
43
+
44
+ This will create wheels in a `./dist` directory for Linux (glibc and musl), macOS (Intel and Apple Silicon), and Windows (amd64 and arm64).
45
+
46
+ ## Usage
47
+
48
+ ```bash
49
+ go-to-wheel path/to/go-folder [options]
50
+ ```
51
+
52
+ ### Options
53
+
54
+ | Option | Description | Default |
55
+ |--------|-------------|---------|
56
+ | `--name NAME` | Python package name | Directory basename |
57
+ | `--version VERSION` | Package version | `0.1.0` |
58
+ | `--output-dir DIR` | Directory for built wheels | `./dist` |
59
+ | `--entry-point NAME` | CLI command name | Same as package name |
60
+ | `--platforms PLATFORMS` | Comma-separated list of targets | All supported platforms |
61
+ | `--go-binary PATH` | Path to Go binary | `go` |
62
+ | `--description TEXT` | Package description | `"Go binary packaged as Python wheel"` |
63
+ | `--license LICENSE` | License identifier | None |
64
+ | `--author AUTHOR` | Author name | None |
65
+ | `--author-email EMAIL` | Author email | None |
66
+ | `--url URL` | Project URL | None |
67
+ | `--requires-python VERSION` | Python version requirement | `>=3.10` |
68
+
69
+ ### Examples
70
+
71
+ Build wheels with a custom package name:
72
+
73
+ ```bash
74
+ go-to-wheel ./mytool --name my-python-tool
75
+ ```
76
+
77
+ Build for specific platforms only:
78
+
79
+ ```bash
80
+ go-to-wheel ./mytool --platforms linux-amd64,darwin-arm64
81
+ ```
82
+
83
+ Build with full metadata for PyPI:
84
+
85
+ ```bash
86
+ go-to-wheel ./mytool \
87
+ --name mytool-bin \
88
+ --version 2.0.0 \
89
+ --description "My awesome tool" \
90
+ --license MIT \
91
+ --author "Jane Doe" \
92
+ --author-email "jane@example.com" \
93
+ --url "https://github.com/jane/mytool"
94
+ ```
95
+
96
+ ## Supported platforms
97
+
98
+ | Platform | Wheel Tag |
99
+ |----------|-----------|
100
+ | `linux-amd64` | `manylinux_2_17_x86_64` |
101
+ | `linux-arm64` | `manylinux_2_17_aarch64` |
102
+ | `linux-amd64-musl` | `musllinux_1_2_x86_64` |
103
+ | `linux-arm64-musl` | `musllinux_1_2_aarch64` |
104
+ | `darwin-amd64` | `macosx_10_9_x86_64` |
105
+ | `darwin-arm64` | `macosx_11_0_arm64` |
106
+ | `windows-amd64` | `win_amd64` |
107
+ | `windows-arm64` | `win_arm64` |
108
+
109
+ ## How it works
110
+
111
+ 1. Cross-compiles the Go binary using `GOOS` and `GOARCH` environment variables with `CGO_ENABLED=0` for static binaries
112
+ 2. Creates a Python package with a thin wrapper that `exec`s the bundled binary
113
+ 3. Packages everything into a wheel with the correct platform tag
114
+
115
+ The resulting wheel can be installed with pip:
116
+
117
+ ```bash
118
+ pip install ./dist/mytool-1.0.0-py3-none-manylinux_2_17_x86_64.whl
119
+ ```
120
+
121
+ Or tested directly with uv:
122
+
123
+ ```bash
124
+ uv run --with ./dist/mytool-1.0.0-py3-none-manylinux_2_17_x86_64.whl mytool --help
125
+ ```
126
+
127
+ ## Development
128
+
129
+ Clone the repository:
130
+
131
+ ```bash
132
+ git clone https://github.com/simonw/go-to-wheel
133
+ cd go-to-wheel
134
+ ```
135
+
136
+ Run tests:
137
+
138
+ ```bash
139
+ uv run pytest
140
+ ```
141
+
142
+ ## See also
143
+
144
+ - [maturin](https://github.com/PyO3/maturin) - The Rust equivalent that inspired this tool
145
+ - [pip-binary-factory](https://github.com/Bing-su/pip-binary-factory) - Template for packaging pre-built binaries
@@ -0,0 +1,131 @@
1
+ # go-to-wheel
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/go-to-wheel.svg)](https://pypi.org/project/go-to-wheel/)
4
+ [![Changelog](https://img.shields.io/github/v/release/simonw/go-to-wheel?include_prereleases&label=changelog)](https://github.com/simonw/go-to-wheel/releases)
5
+ [![Tests](https://github.com/simonw/go-to-wheel/workflows/Test/badge.svg)](https://github.com/simonw/go-to-wheel/actions?query=workflow%3ATest)
6
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/go-to-wheel/blob/main/LICENSE)
7
+
8
+ Compile Go CLI programs into Python wheels.
9
+
10
+ This tool takes a Go module directory, cross-compiles it for multiple platforms, and produces properly-tagged Python wheels that can be installed via `pip` or `pipx` to get the Go binary on your PATH.
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ pip install go-to-wheel
16
+ # or
17
+ pipx install go-to-wheel
18
+ ```
19
+
20
+ Requires Go to be installed and available in your PATH.
21
+
22
+ ## Quick start
23
+
24
+ Build wheels for all platforms from a Go module:
25
+
26
+ ```bash
27
+ go-to-wheel path/to/go-module
28
+ ```
29
+
30
+ This will create wheels in a `./dist` directory for Linux (glibc and musl), macOS (Intel and Apple Silicon), and Windows (amd64 and arm64).
31
+
32
+ ## Usage
33
+
34
+ ```bash
35
+ go-to-wheel path/to/go-folder [options]
36
+ ```
37
+
38
+ ### Options
39
+
40
+ | Option | Description | Default |
41
+ |--------|-------------|---------|
42
+ | `--name NAME` | Python package name | Directory basename |
43
+ | `--version VERSION` | Package version | `0.1.0` |
44
+ | `--output-dir DIR` | Directory for built wheels | `./dist` |
45
+ | `--entry-point NAME` | CLI command name | Same as package name |
46
+ | `--platforms PLATFORMS` | Comma-separated list of targets | All supported platforms |
47
+ | `--go-binary PATH` | Path to Go binary | `go` |
48
+ | `--description TEXT` | Package description | `"Go binary packaged as Python wheel"` |
49
+ | `--license LICENSE` | License identifier | None |
50
+ | `--author AUTHOR` | Author name | None |
51
+ | `--author-email EMAIL` | Author email | None |
52
+ | `--url URL` | Project URL | None |
53
+ | `--requires-python VERSION` | Python version requirement | `>=3.10` |
54
+
55
+ ### Examples
56
+
57
+ Build wheels with a custom package name:
58
+
59
+ ```bash
60
+ go-to-wheel ./mytool --name my-python-tool
61
+ ```
62
+
63
+ Build for specific platforms only:
64
+
65
+ ```bash
66
+ go-to-wheel ./mytool --platforms linux-amd64,darwin-arm64
67
+ ```
68
+
69
+ Build with full metadata for PyPI:
70
+
71
+ ```bash
72
+ go-to-wheel ./mytool \
73
+ --name mytool-bin \
74
+ --version 2.0.0 \
75
+ --description "My awesome tool" \
76
+ --license MIT \
77
+ --author "Jane Doe" \
78
+ --author-email "jane@example.com" \
79
+ --url "https://github.com/jane/mytool"
80
+ ```
81
+
82
+ ## Supported platforms
83
+
84
+ | Platform | Wheel Tag |
85
+ |----------|-----------|
86
+ | `linux-amd64` | `manylinux_2_17_x86_64` |
87
+ | `linux-arm64` | `manylinux_2_17_aarch64` |
88
+ | `linux-amd64-musl` | `musllinux_1_2_x86_64` |
89
+ | `linux-arm64-musl` | `musllinux_1_2_aarch64` |
90
+ | `darwin-amd64` | `macosx_10_9_x86_64` |
91
+ | `darwin-arm64` | `macosx_11_0_arm64` |
92
+ | `windows-amd64` | `win_amd64` |
93
+ | `windows-arm64` | `win_arm64` |
94
+
95
+ ## How it works
96
+
97
+ 1. Cross-compiles the Go binary using `GOOS` and `GOARCH` environment variables with `CGO_ENABLED=0` for static binaries
98
+ 2. Creates a Python package with a thin wrapper that `exec`s the bundled binary
99
+ 3. Packages everything into a wheel with the correct platform tag
100
+
101
+ The resulting wheel can be installed with pip:
102
+
103
+ ```bash
104
+ pip install ./dist/mytool-1.0.0-py3-none-manylinux_2_17_x86_64.whl
105
+ ```
106
+
107
+ Or tested directly with uv:
108
+
109
+ ```bash
110
+ uv run --with ./dist/mytool-1.0.0-py3-none-manylinux_2_17_x86_64.whl mytool --help
111
+ ```
112
+
113
+ ## Development
114
+
115
+ Clone the repository:
116
+
117
+ ```bash
118
+ git clone https://github.com/simonw/go-to-wheel
119
+ cd go-to-wheel
120
+ ```
121
+
122
+ Run tests:
123
+
124
+ ```bash
125
+ uv run pytest
126
+ ```
127
+
128
+ ## See also
129
+
130
+ - [maturin](https://github.com/PyO3/maturin) - The Rust equivalent that inspired this tool
131
+ - [pip-binary-factory](https://github.com/Bing-su/pip-binary-factory) - Template for packaging pre-built binaries