manygo 0.1.0__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,16 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: gomod
4
+ directory: /
5
+ schedule:
6
+ interval: "weekly"
7
+ open-pull-requests-limit: 3
8
+ labels:
9
+ - "dependabot:golang"
10
+ - package-ecosystem: "github-actions"
11
+ directory: /
12
+ schedule:
13
+ interval: "weekly"
14
+ open-pull-requests-limit: 3
15
+ labels:
16
+ - "dependabot:actions"
@@ -0,0 +1,26 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*.*.*"
7
+
8
+ jobs:
9
+ pypi:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ id-token: write
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ with:
16
+ persist-credentials: false
17
+ fetch-depth: 0
18
+ - uses: actions/setup-go@v5
19
+ with:
20
+ go-version: stable
21
+ cache: false
22
+ - uses: astral-sh/setup-uv@v5
23
+ with:
24
+ enable-cache: false
25
+ - run: uv build
26
+ - run: uv publish
@@ -0,0 +1,36 @@
1
+ name: GitHub Actions Security Analysis with zizmor 🌈
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+
9
+ jobs:
10
+ zizmor:
11
+ name: zizmor latest via PyPI
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ security-events: write
15
+ # required for workflows in private repositories
16
+ contents: read
17
+ actions: read
18
+ steps:
19
+ - name: Checkout repository
20
+ uses: actions/checkout@v4
21
+ with:
22
+ persist-credentials: false
23
+
24
+ - name: Install the latest version of uv
25
+ uses: astral-sh/setup-uv@v5
26
+
27
+ - name: Run zizmor 🌈
28
+ run: uvx zizmor --format sarif . > results.sarif
29
+ env:
30
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31
+
32
+ - name: Upload SARIF file
33
+ uses: github/codeql-action/upload-sarif@v3
34
+ with:
35
+ sarif_file: results.sarif
36
+ category: zizmor
@@ -0,0 +1,172 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ #pdm.lock
113
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
+ # in version control.
115
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
+ .pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .env
132
+ .venv
133
+ env/
134
+ venv/
135
+ ENV/
136
+ env.bak/
137
+ venv.bak/
138
+
139
+ # Spyder project settings
140
+ .spyderproject
141
+ .spyproject
142
+
143
+ # Rope project settings
144
+ .ropeproject
145
+
146
+ # mkdocs documentation
147
+ /site
148
+
149
+ # mypy
150
+ .mypy_cache/
151
+ .dmypy.json
152
+ dmypy.json
153
+
154
+ # Pyre type checker
155
+ .pyre/
156
+
157
+ # pytype static type analyzer
158
+ .pytype/
159
+
160
+ # Cython debug symbols
161
+ cython_debug/
162
+
163
+ # PyCharm
164
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
167
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168
+ #.idea/
169
+
170
+ # PyPI configuration file
171
+ .pypirc
172
+ .aider*
manygo-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Jamison Lahman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
manygo-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,50 @@
1
+ Metadata-Version: 2.4
2
+ Name: manygo
3
+ Version: 0.1.0
4
+ Summary: Python library with helpers for packaging golang source code
5
+ Author-email: Jamison Lahman <jamison@lahman.dev>
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Keywords: golang,packaging,platform-tags
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Requires-Python: >=3.9
19
+ Description-Content-Type: text/markdown
20
+
21
+ # manygo
22
+
23
+ A Python library for generating platform-specific tags for Golang packages and binaries.
24
+
25
+ ## Overview
26
+
27
+ `manygo` provides utilities to help with packaging and distributing Golang applications, with a focus on generating accurate Python platform tags for cross-platform compatibility.
28
+
29
+ ## Features
30
+
31
+ - Convert Golang platform identifiers (GOOS and GOARCH) to Python platform tags
32
+ - Support for multiple architectures and operating systems
33
+ - Helpful for creating wheel distributions and managing platform-specific builds
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ pip install manygo
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ ```python
44
+ >>> import manygo
45
+ >>> manygo.get_platform_tag('linux', 'amd64')
46
+ 'manylinux_2_17_x86_64'
47
+
48
+ >>> manygo.get_platform_tag('darwin', 'arm64')
49
+ 'macosx_11_0_arm64'
50
+ ```
manygo-0.1.0/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # manygo
2
+
3
+ A Python library for generating platform-specific tags for Golang packages and binaries.
4
+
5
+ ## Overview
6
+
7
+ `manygo` provides utilities to help with packaging and distributing Golang applications, with a focus on generating accurate Python platform tags for cross-platform compatibility.
8
+
9
+ ## Features
10
+
11
+ - Convert Golang platform identifiers (GOOS and GOARCH) to Python platform tags
12
+ - Support for multiple architectures and operating systems
13
+ - Helpful for creating wheel distributions and managing platform-specific builds
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ pip install manygo
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```python
24
+ >>> import manygo
25
+ >>> manygo.get_platform_tag('linux', 'amd64')
26
+ 'manylinux_2_17_x86_64'
27
+
28
+ >>> manygo.get_platform_tag('darwin', 'arm64')
29
+ 'macosx_11_0_arm64'
30
+ ```
@@ -0,0 +1,65 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Literal
4
+
5
+ # Supported Go operating systems with known platform tags
6
+ GOOS = Literal['darwin', 'linux', 'windows']
7
+
8
+ # Supported Go architectures with known platform tags
9
+ GOARCH = Literal['amd64', 'arm64', '386', 'arm', 's390x', 'ppc64le', 'ppc64']
10
+
11
+ def get_platform_tag(
12
+ goos: GOOS,
13
+ goarch: GOARCH
14
+ ) -> str:
15
+ """
16
+ Convert GOOS and GOARCH to a valid Python platform tag.
17
+
18
+ This function provides a mapping between Go's platform identifiers
19
+ (operating system and architecture) and Python platform tags used
20
+ in packaging and distribution.
21
+
22
+ Supported platforms are derived from the Go toolchain's supported
23
+ platforms, which can be listed via `$ go tools dist list`. See also,
24
+ https://go.dev/doc/install/source#environment. Python's platform tags
25
+ are described in https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/#platform-tag.
26
+
27
+ Args:
28
+ goos (GOOS): The operating system identifier
29
+ goarch (GOARCH): The architecture identifier
30
+
31
+ Returns:
32
+ str: A Python platform tag suitable for wheel or other packaging
33
+
34
+ Raises:
35
+ ValueError: If no platform tag can be generated for the given combination
36
+ """
37
+ # Mapping of special cases and conversions
38
+ platform_map = {
39
+ ('darwin', 'amd64'): 'macosx_10_12_x86_64',
40
+ ('darwin', 'arm64'): 'macosx_11_0_arm64',
41
+ ('windows', '386'): 'win32',
42
+ ('windows', 'arm64'): 'win_arm64',
43
+ ('windows', 'amd64'): 'win_amd64',
44
+ }
45
+
46
+ # Check for direct mapping first
47
+ if (goos, goarch) in platform_map:
48
+ return platform_map[(goos, goarch)]
49
+
50
+ # Generic fallback conversion
51
+ arch_map = {
52
+ 'amd64': 'x86_64',
53
+ 'arm64': 'aarch64',
54
+ '386': 'i686',
55
+ 'arm': 'armv7l',
56
+ 's390x': 's390x',
57
+ 'ppc64le': 'ppc64le',
58
+ 'ppc64': 'ppc64',
59
+ }
60
+
61
+ # Try to construct a generic tag
62
+ if goos == 'linux' and goarch in arch_map:
63
+ return f'manylinux_2_17_{arch_map[goarch]}'
64
+
65
+ raise ValueError(f'No platform tag for {goos}/{goarch}')
@@ -0,0 +1,29 @@
1
+ [build-system]
2
+ requires = ["hatchling", "hatch-vcs"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "manygo"
7
+ description = "Python library with helpers for packaging golang source code"
8
+ readme = "README.md"
9
+ requires-python = ">=3.9"
10
+ license = "MIT"
11
+ authors = [
12
+ { name = "Jamison Lahman", email = "jamison@lahman.dev" }
13
+ ]
14
+ keywords = ["golang", "packaging", "platform-tags"]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.9",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ ]
26
+ dynamic = ["version"]
27
+
28
+ [tool.hatch.version]
29
+ source = "vcs"
@@ -0,0 +1,49 @@
1
+ from __future__ import annotations
2
+
3
+ import unittest
4
+
5
+ from manygo import get_platform_tag
6
+
7
+
8
+ class TestManyGo(unittest.TestCase):
9
+ def test_get_platform_tag_darwin(self) -> None:
10
+ assert get_platform_tag('darwin', 'amd64') == 'macosx_10_12_x86_64'
11
+ assert get_platform_tag('darwin', 'arm64') == 'macosx_11_0_arm64'
12
+ with self.assertRaises(ValueError):
13
+ get_platform_tag('darwin', '386')
14
+
15
+ def test_get_platform_tag_linux(self) -> None:
16
+ assert get_platform_tag('linux', 'amd64') == 'manylinux_2_17_x86_64'
17
+ assert get_platform_tag('linux', 'arm64') == 'manylinux_2_17_aarch64'
18
+ assert get_platform_tag('linux', '386') == 'manylinux_2_17_i686'
19
+ assert get_platform_tag('linux', 'arm') == 'manylinux_2_17_armv7l'
20
+
21
+ def test_get_platform_tag_windows(self) -> None:
22
+ assert get_platform_tag('windows', 'amd64') == 'win_amd64'
23
+ assert get_platform_tag('windows', 'arm64') == 'win_arm64'
24
+ assert get_platform_tag('windows', '386') == 'win32'
25
+
26
+ def test_get_platform_tag_other_architectures(self) -> None:
27
+ assert get_platform_tag('linux', 's390x') == 'manylinux_2_17_s390x'
28
+ assert get_platform_tag('linux', 'ppc64le') == 'manylinux_2_17_ppc64le'
29
+ assert get_platform_tag('linux', 'ppc64') == 'manylinux_2_17_ppc64'
30
+
31
+ def test_get_platform_tag_unsupported_configurations(self) -> None:
32
+ # Unsupported OS
33
+ with self.assertRaises(ValueError):
34
+ get_platform_tag('freebsd', 'amd64')
35
+
36
+ # Unsupported architecture for a supported OS
37
+ with self.assertRaises(ValueError):
38
+ get_platform_tag('darwin', 'ppc64')
39
+
40
+ # Unsupported architecture for Linux
41
+ with self.assertRaises(ValueError):
42
+ get_platform_tag('linux', 'mips')
43
+
44
+ # Unsupported combination
45
+ with self.assertRaises(ValueError):
46
+ get_platform_tag('windows', 's390x')
47
+
48
+ if __name__ == "__main__":
49
+ unittest.main()