hey-api 0.0.4__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.
- hey_api-0.0.4/.gitignore +15 -0
- hey_api-0.0.4/LICENSE +21 -0
- hey_api-0.0.4/PKG-INFO +75 -0
- hey_api-0.0.4/README.md +46 -0
- hey_api-0.0.4/build-wheels.py +118 -0
- hey_api-0.0.4/hey_api/__init__.py +5 -0
- hey_api-0.0.4/hey_api/__main__.py +67 -0
- hey_api-0.0.4/hey_api/bin/.gitkeep +0 -0
- hey_api-0.0.4/pyproject.toml +54 -0
hey_api-0.0.4/.gitignore
ADDED
hey_api-0.0.4/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-present Hey API
|
|
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.
|
hey_api-0.0.4/PKG-INFO
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hey-api
|
|
3
|
+
Version: 0.0.4
|
|
4
|
+
Summary: OpenAPI to Python code generator. Production-grade SDKs and Pydantic models.
|
|
5
|
+
Project-URL: Homepage, https://heyapi.dev/docs/openapi/python/get-started
|
|
6
|
+
Project-URL: Documentation, https://heyapi.dev/docs/openapi/python/get-started
|
|
7
|
+
Project-URL: Repository, https://github.com/hey-api/hey-api
|
|
8
|
+
Project-URL: Issues, https://github.com/hey-api/hey-api/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/hey-api/hey-api/releases
|
|
10
|
+
Project-URL: Funding, https://github.com/sponsors/hey-api
|
|
11
|
+
Author-email: Hey API <lubos@heyapi.dev>
|
|
12
|
+
License-Expression: MIT
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Keywords: api,api-client,codegen,fastapi,generator,httpx,openapi,pydantic,sdk,swagger
|
|
15
|
+
Classifier: Development Status :: 3 - Alpha
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
25
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
26
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
27
|
+
Requires-Python: >=3.9
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# Hey API
|
|
31
|
+
|
|
32
|
+
OpenAPI to Python code generator. Production-grade SDKs and Pydantic models. Built by [Hey API](https://heyapi.dev).
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
### uv
|
|
37
|
+
|
|
38
|
+
Install:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
uv add hey-api
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Or run without installing:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
uvx hey-api --help
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### pip
|
|
51
|
+
|
|
52
|
+
Install:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
pip install hey-api
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Or run without installing:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
pipx run hey-api
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Usage
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
hey-api --help
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Resources
|
|
71
|
+
|
|
72
|
+
- [Manual](https://heyapi.dev/docs/openapi/python/get-started)
|
|
73
|
+
- [GitHub](https://github.com/hey-api/hey-api)
|
|
74
|
+
- [npm](https://npmjs.com/package/@hey-api/openapi-python)
|
|
75
|
+
- [Sponsor](https://github.com/sponsors/hey-api)
|
hey_api-0.0.4/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Hey API
|
|
2
|
+
|
|
3
|
+
OpenAPI to Python code generator. Production-grade SDKs and Pydantic models. Built by [Hey API](https://heyapi.dev).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### uv
|
|
8
|
+
|
|
9
|
+
Install:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
uv add hey-api
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Or run without installing:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
uvx hey-api --help
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### pip
|
|
22
|
+
|
|
23
|
+
Install:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
pip install hey-api
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or run without installing:
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
pipx run hey-api
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
hey-api --help
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Resources
|
|
42
|
+
|
|
43
|
+
- [Manual](https://heyapi.dev/docs/openapi/python/get-started)
|
|
44
|
+
- [GitHub](https://github.com/hey-api/hey-api)
|
|
45
|
+
- [npm](https://npmjs.com/package/@hey-api/openapi-python)
|
|
46
|
+
- [Sponsor](https://github.com/sponsors/hey-api)
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Build platform-specific wheels for hey-api.
|
|
3
|
+
|
|
4
|
+
Requires: pip install hatchling wheel
|
|
5
|
+
|
|
6
|
+
This script:
|
|
7
|
+
1. Syncs the version from package.json into pyproject.toml
|
|
8
|
+
2. For each platform binary in build/, builds a wheel with hatchling
|
|
9
|
+
3. Re-tags the wheel with the correct platform tag using `wheel tags`
|
|
10
|
+
(this updates both the filename AND internal WHEEL metadata)
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import json
|
|
14
|
+
import re
|
|
15
|
+
import shutil
|
|
16
|
+
import subprocess
|
|
17
|
+
import sys
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
|
|
20
|
+
PLATFORM_MAP = {
|
|
21
|
+
"openapi-python-linux-x64": "manylinux_2_17_x86_64.manylinux2014_x86_64",
|
|
22
|
+
"openapi-python-linux-arm64": "manylinux_2_17_aarch64.manylinux2014_aarch64",
|
|
23
|
+
"openapi-python-darwin-arm64": "macosx_11_0_arm64",
|
|
24
|
+
"openapi-python-win-x64.exe": "win_amd64",
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def sync_version() -> str:
|
|
29
|
+
"""Read version from package.json and patch pyproject.toml."""
|
|
30
|
+
pkg_json = Path(__file__).parent.parent / "package.json"
|
|
31
|
+
pyproject = Path(__file__).parent / "pyproject.toml"
|
|
32
|
+
|
|
33
|
+
with open(pkg_json) as f:
|
|
34
|
+
version = json.load(f)["version"]
|
|
35
|
+
|
|
36
|
+
content = pyproject.read_text()
|
|
37
|
+
content = re.sub(
|
|
38
|
+
r'^version\s*=\s*".*"',
|
|
39
|
+
f'version = "{version}"',
|
|
40
|
+
content,
|
|
41
|
+
flags=re.MULTILINE,
|
|
42
|
+
)
|
|
43
|
+
pyproject.write_text(content)
|
|
44
|
+
return version
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def build_wheel(binary_path: Path, platform_tag: str, dist_dir: Path) -> None:
|
|
48
|
+
"""Build a wheel for a specific platform by staging the binary."""
|
|
49
|
+
pypi_dir = Path(__file__).parent
|
|
50
|
+
bin_dir = pypi_dir / "hey_api" / "bin"
|
|
51
|
+
bin_dir.mkdir(exist_ok=True)
|
|
52
|
+
|
|
53
|
+
for f in bin_dir.iterdir():
|
|
54
|
+
if f.name != ".gitkeep":
|
|
55
|
+
f.unlink()
|
|
56
|
+
|
|
57
|
+
dest = bin_dir / binary_path.name
|
|
58
|
+
shutil.copy2(binary_path, dest)
|
|
59
|
+
dest.chmod(0o755)
|
|
60
|
+
|
|
61
|
+
subprocess.run(
|
|
62
|
+
[
|
|
63
|
+
sys.executable, "-m", "hatchling", "build",
|
|
64
|
+
"--target", "wheel",
|
|
65
|
+
"-d", str(dist_dir),
|
|
66
|
+
],
|
|
67
|
+
cwd=str(pypi_dir),
|
|
68
|
+
check=True,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
# Re-tag with correct platform. `wheel tags` updates the internal
|
|
72
|
+
# WHEEL metadata (Tag + Root-Is-Purelib) AND renames the file.
|
|
73
|
+
for whl in sorted(dist_dir.glob("hey_api-*-py3-none-any.whl")):
|
|
74
|
+
subprocess.run(
|
|
75
|
+
[
|
|
76
|
+
sys.executable, "-m", "wheel", "tags",
|
|
77
|
+
"--remove",
|
|
78
|
+
"--platform-tag", platform_tag,
|
|
79
|
+
str(whl),
|
|
80
|
+
],
|
|
81
|
+
check=True,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
for f in bin_dir.iterdir():
|
|
85
|
+
if f.name != ".gitkeep":
|
|
86
|
+
f.unlink()
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def main() -> None:
|
|
90
|
+
build_dir = Path(__file__).parent.parent / "build"
|
|
91
|
+
dist_dir = Path(__file__).parent / "dist"
|
|
92
|
+
dist_dir.mkdir(exist_ok=True)
|
|
93
|
+
|
|
94
|
+
for whl in dist_dir.glob("*.whl"):
|
|
95
|
+
whl.unlink()
|
|
96
|
+
|
|
97
|
+
version = sync_version()
|
|
98
|
+
print(f"Building wheels for v{version}\n")
|
|
99
|
+
|
|
100
|
+
built = 0
|
|
101
|
+
for binary_name, platform_tag in PLATFORM_MAP.items():
|
|
102
|
+
binary_path = build_dir / binary_name
|
|
103
|
+
if not binary_path.exists():
|
|
104
|
+
print(f" skip {binary_name} (not found)")
|
|
105
|
+
continue
|
|
106
|
+
print(f" build {platform_tag}")
|
|
107
|
+
build_wheel(binary_path, platform_tag, dist_dir)
|
|
108
|
+
built += 1
|
|
109
|
+
|
|
110
|
+
wheels = list(dist_dir.glob("*.whl"))
|
|
111
|
+
print(f"\n {len(wheels)} wheels in {dist_dir}/")
|
|
112
|
+
for whl in sorted(wheels):
|
|
113
|
+
size_mb = whl.stat().st_size / (1024 * 1024)
|
|
114
|
+
print(f" {whl.name} ({size_mb:.1f} MB)")
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
if __name__ == "__main__":
|
|
118
|
+
main()
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"""Run as `python -m hey_api`, `hey-api`, or `openapi-python`."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import platform
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
import signal
|
|
7
|
+
import subprocess
|
|
8
|
+
import sys
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _get_binary_path() -> str:
|
|
12
|
+
"""Returns the path to the bundled openapi-python binary."""
|
|
13
|
+
bin_dir = Path(__file__).parent / "bin"
|
|
14
|
+
system = platform.system().lower()
|
|
15
|
+
machine = platform.machine().lower()
|
|
16
|
+
|
|
17
|
+
if machine in ("x86_64", "amd64"):
|
|
18
|
+
arch = "x64"
|
|
19
|
+
elif machine in ("arm64", "aarch64"):
|
|
20
|
+
arch = "arm64"
|
|
21
|
+
else:
|
|
22
|
+
raise RuntimeError(f"Unsupported architecture: {machine}")
|
|
23
|
+
|
|
24
|
+
if system == "windows":
|
|
25
|
+
name = f"openapi-python-win-{arch}.exe"
|
|
26
|
+
elif system == "darwin":
|
|
27
|
+
name = f"openapi-python-darwin-{arch}"
|
|
28
|
+
elif system == "linux":
|
|
29
|
+
name = f"openapi-python-linux-{arch}"
|
|
30
|
+
else:
|
|
31
|
+
raise RuntimeError(f"Unsupported platform: {system}")
|
|
32
|
+
|
|
33
|
+
path = bin_dir / name
|
|
34
|
+
if not path.is_file():
|
|
35
|
+
raise FileNotFoundError(
|
|
36
|
+
f"Binary not found at {path}. "
|
|
37
|
+
f"This pre-release does not include bundled binaries. "
|
|
38
|
+
f"Install a stable release or use npx @hey-api/openapi-python instead. "
|
|
39
|
+
f"https://heyapi.dev/docs/openapi/python/get-started"
|
|
40
|
+
)
|
|
41
|
+
return str(path)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def main() -> int:
|
|
45
|
+
try:
|
|
46
|
+
binary = _get_binary_path()
|
|
47
|
+
except (FileNotFoundError, RuntimeError) as exc:
|
|
48
|
+
print(f"Error: {exc}", file=sys.stderr)
|
|
49
|
+
return 1
|
|
50
|
+
|
|
51
|
+
if sys.platform != "win32":
|
|
52
|
+
os.chmod(binary, 0o755)
|
|
53
|
+
|
|
54
|
+
try:
|
|
55
|
+
result = subprocess.run(
|
|
56
|
+
[binary, *sys.argv[1:]],
|
|
57
|
+
stdin=sys.stdin,
|
|
58
|
+
stdout=sys.stdout,
|
|
59
|
+
stderr=sys.stderr,
|
|
60
|
+
)
|
|
61
|
+
return result.returncode
|
|
62
|
+
except KeyboardInterrupt:
|
|
63
|
+
return 128 + signal.SIGINT
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
if __name__ == "__main__":
|
|
67
|
+
raise SystemExit(main())
|
|
File without changes
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "hey-api"
|
|
3
|
+
version = "0.0.4"
|
|
4
|
+
description = "OpenAPI to Python code generator. Production-grade SDKs and Pydantic models."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICEN[CS]E*"]
|
|
8
|
+
requires-python = ">=3.9"
|
|
9
|
+
authors = [{ name = "Hey API", email = "lubos@heyapi.dev" }]
|
|
10
|
+
keywords = [
|
|
11
|
+
"api",
|
|
12
|
+
"api-client",
|
|
13
|
+
"codegen",
|
|
14
|
+
"fastapi",
|
|
15
|
+
"generator",
|
|
16
|
+
"httpx",
|
|
17
|
+
"openapi",
|
|
18
|
+
"pydantic",
|
|
19
|
+
"sdk",
|
|
20
|
+
"swagger",
|
|
21
|
+
]
|
|
22
|
+
classifiers = [
|
|
23
|
+
"Development Status :: 3 - Alpha",
|
|
24
|
+
"Intended Audience :: Developers",
|
|
25
|
+
"License :: OSI Approved :: MIT License",
|
|
26
|
+
"Programming Language :: Python :: 3",
|
|
27
|
+
"Programming Language :: Python :: 3.9",
|
|
28
|
+
"Programming Language :: Python :: 3.10",
|
|
29
|
+
"Programming Language :: Python :: 3.11",
|
|
30
|
+
"Programming Language :: Python :: 3.12",
|
|
31
|
+
"Programming Language :: Python :: 3.13",
|
|
32
|
+
"Programming Language :: Python :: 3.14",
|
|
33
|
+
"Topic :: Software Development :: Code Generators",
|
|
34
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://heyapi.dev/docs/openapi/python/get-started"
|
|
39
|
+
Documentation = "https://heyapi.dev/docs/openapi/python/get-started"
|
|
40
|
+
Repository = "https://github.com/hey-api/hey-api"
|
|
41
|
+
Issues = "https://github.com/hey-api/hey-api/issues"
|
|
42
|
+
Changelog = "https://github.com/hey-api/hey-api/releases"
|
|
43
|
+
Funding = "https://github.com/sponsors/hey-api"
|
|
44
|
+
|
|
45
|
+
[project.scripts]
|
|
46
|
+
hey-api = "hey_api.__main__:main"
|
|
47
|
+
openapi-python = "hey_api.__main__:main"
|
|
48
|
+
|
|
49
|
+
[build-system]
|
|
50
|
+
requires = ["hatchling"]
|
|
51
|
+
build-backend = "hatchling.build"
|
|
52
|
+
|
|
53
|
+
[tool.hatch.build.targets.wheel]
|
|
54
|
+
packages = ["hey_api"]
|