krista-common-proto-schema 1.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.
- krista_common_proto_schema-1.0.1/PKG-INFO +21 -0
- krista_common_proto_schema-1.0.1/krista_common_proto_schema/__init__.py +20 -0
- krista_common_proto_schema-1.0.1/krista_common_proto_schema.egg-info/PKG-INFO +21 -0
- krista_common_proto_schema-1.0.1/krista_common_proto_schema.egg-info/SOURCES.txt +7 -0
- krista_common_proto_schema-1.0.1/krista_common_proto_schema.egg-info/dependency_links.txt +1 -0
- krista_common_proto_schema-1.0.1/krista_common_proto_schema.egg-info/requires.txt +1 -0
- krista_common_proto_schema-1.0.1/krista_common_proto_schema.egg-info/top_level.txt +1 -0
- krista_common_proto_schema-1.0.1/setup.cfg +4 -0
- krista_common_proto_schema-1.0.1/setup.py +182 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: krista_common_proto_schema
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Shared Protocol Buffer definitions.
|
|
5
|
+
Home-page: https://github.com/your-org/krista-common-proto-schema
|
|
6
|
+
Author: Krista
|
|
7
|
+
Author-email: vijay.bhatt@kristasoft.com
|
|
8
|
+
License: UNKNOWN
|
|
9
|
+
Platform: UNKNOWN
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
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
|
+
Requires-Python: >=3.9
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
UNKNOWN
|
|
21
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Krista Common Proto Schema Package
|
|
3
|
+
|
|
4
|
+
This package contains compiled Protocol Buffer definitions
|
|
5
|
+
that can be imported directly in Python projects.
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
from krista_common_proto_schema import user_pb2, message_pb2
|
|
9
|
+
|
|
10
|
+
user = user_pb2.User(id=1, name="John")
|
|
11
|
+
message = message_pb2.Message(id=1, sender=user, content="Hello")
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
__version__ = "1.0.1"
|
|
15
|
+
|
|
16
|
+
# Import compiled proto modules for easy access
|
|
17
|
+
from . import user_pb2
|
|
18
|
+
from . import message_pb2
|
|
19
|
+
|
|
20
|
+
__all__ = ["user_pb2", "message_pb2"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: krista-common-proto-schema
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Shared Protocol Buffer definitions.
|
|
5
|
+
Home-page: https://github.com/your-org/krista-common-proto-schema
|
|
6
|
+
Author: Krista
|
|
7
|
+
Author-email: vijay.bhatt@kristasoft.com
|
|
8
|
+
License: UNKNOWN
|
|
9
|
+
Platform: UNKNOWN
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
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
|
+
Requires-Python: >=3.9
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
UNKNOWN
|
|
21
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
setup.py
|
|
2
|
+
krista_common_proto_schema/__init__.py
|
|
3
|
+
krista_common_proto_schema.egg-info/PKG-INFO
|
|
4
|
+
krista_common_proto_schema.egg-info/SOURCES.txt
|
|
5
|
+
krista_common_proto_schema.egg-info/dependency_links.txt
|
|
6
|
+
krista_common_proto_schema.egg-info/requires.txt
|
|
7
|
+
krista_common_proto_schema.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
protobuf<5.0.0,>=3.20.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
krista_common_proto_schema
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Setup script for common-proto-schema Python package.
|
|
4
|
+
|
|
5
|
+
This makes the proto schema installable as a Python package,
|
|
6
|
+
similar to how Maven packages it as a JAR for Java.
|
|
7
|
+
|
|
8
|
+
Usage:
|
|
9
|
+
# Install locally (development)
|
|
10
|
+
pip install -e .
|
|
11
|
+
|
|
12
|
+
# Build distribution
|
|
13
|
+
python setup.py sdist bdist_wheel
|
|
14
|
+
|
|
15
|
+
# Install from built package
|
|
16
|
+
pip install dist/common_proto_schema-1.0.0-py3-none-any.whl
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from setuptools import setup, find_packages
|
|
20
|
+
from setuptools.command.build_py import build_py
|
|
21
|
+
import subprocess
|
|
22
|
+
import os
|
|
23
|
+
import shutil
|
|
24
|
+
from pathlib import Path
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class BuildProtoCommand(build_py):
|
|
28
|
+
"""Custom build command that compiles proto files before building package."""
|
|
29
|
+
|
|
30
|
+
def run(self):
|
|
31
|
+
"""Compile proto files to Python before building."""
|
|
32
|
+
print("=" * 60)
|
|
33
|
+
print("Compiling proto files to Python...")
|
|
34
|
+
print("=" * 60)
|
|
35
|
+
|
|
36
|
+
# Verify proto checksums first
|
|
37
|
+
print("\nš Verifying proto file checksums...")
|
|
38
|
+
verify_script = Path("../proto/verify_checksums.sh")
|
|
39
|
+
if verify_script.exists():
|
|
40
|
+
try:
|
|
41
|
+
subprocess.run(
|
|
42
|
+
["bash", str(verify_script)],
|
|
43
|
+
cwd=str(verify_script.parent),
|
|
44
|
+
check=True,
|
|
45
|
+
capture_output=True,
|
|
46
|
+
text=True
|
|
47
|
+
)
|
|
48
|
+
print("ā
Proto checksums verified\n")
|
|
49
|
+
except subprocess.CalledProcessError as e:
|
|
50
|
+
print(f"ā Proto checksum verification failed!")
|
|
51
|
+
print(e.stdout)
|
|
52
|
+
print(e.stderr)
|
|
53
|
+
raise RuntimeError("Proto files have been modified. Update VERSION and regenerate checksums.")
|
|
54
|
+
else:
|
|
55
|
+
print("ā ļø Checksum verification skipped (verify_checksums.sh not found)\n")
|
|
56
|
+
|
|
57
|
+
# Paths
|
|
58
|
+
proto_dir = Path("../proto")
|
|
59
|
+
output_dir = Path("krista_common_proto_schema")
|
|
60
|
+
|
|
61
|
+
# Read version from VERSION file
|
|
62
|
+
version_file = Path("../VERSION")
|
|
63
|
+
version = version_file.read_text().strip()
|
|
64
|
+
|
|
65
|
+
# Create output directory
|
|
66
|
+
output_dir.mkdir(exist_ok=True)
|
|
67
|
+
|
|
68
|
+
# Create __init__.py with dynamic version
|
|
69
|
+
init_file = output_dir / "__init__.py"
|
|
70
|
+
init_file.write_text(f'''"""
|
|
71
|
+
Krista Common Proto Schema Package
|
|
72
|
+
|
|
73
|
+
This package contains compiled Protocol Buffer definitions
|
|
74
|
+
that can be imported directly in Python projects.
|
|
75
|
+
|
|
76
|
+
Usage:
|
|
77
|
+
from krista_common_proto_schema import user_pb2, message_pb2
|
|
78
|
+
|
|
79
|
+
user = user_pb2.User(id=1, name="John")
|
|
80
|
+
message = message_pb2.Message(id=1, sender=user, content="Hello")
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
__version__ = "{version}"
|
|
84
|
+
|
|
85
|
+
# Import compiled proto modules for easy access
|
|
86
|
+
from . import user_pb2
|
|
87
|
+
from . import message_pb2
|
|
88
|
+
|
|
89
|
+
__all__ = ["user_pb2", "message_pb2"]
|
|
90
|
+
''')
|
|
91
|
+
|
|
92
|
+
# Find all .proto files
|
|
93
|
+
proto_files = list(proto_dir.glob("**/*.proto"))
|
|
94
|
+
|
|
95
|
+
if not proto_files:
|
|
96
|
+
print("ā ļø No proto files found!")
|
|
97
|
+
return
|
|
98
|
+
|
|
99
|
+
print(f"Found {len(proto_files)} proto files:")
|
|
100
|
+
for pf in proto_files:
|
|
101
|
+
print(f" - {pf}")
|
|
102
|
+
|
|
103
|
+
# Compile each proto file
|
|
104
|
+
for proto_file in proto_files:
|
|
105
|
+
print(f"\nšØ Compiling {proto_file}...")
|
|
106
|
+
|
|
107
|
+
try:
|
|
108
|
+
subprocess.run(
|
|
109
|
+
[
|
|
110
|
+
"python3", "-m", "grpc_tools.protoc",
|
|
111
|
+
f"-I={proto_dir}",
|
|
112
|
+
f"--python_out={output_dir}",
|
|
113
|
+
str(proto_file)
|
|
114
|
+
],
|
|
115
|
+
check=True,
|
|
116
|
+
capture_output=True,
|
|
117
|
+
text=True
|
|
118
|
+
)
|
|
119
|
+
print(f" ā
Compiled successfully")
|
|
120
|
+
except subprocess.CalledProcessError as e:
|
|
121
|
+
print(f" ā Error: {e.stderr}")
|
|
122
|
+
raise
|
|
123
|
+
|
|
124
|
+
print("\n" + "=" * 60)
|
|
125
|
+
print("ā
All proto files compiled successfully!")
|
|
126
|
+
print("=" * 60)
|
|
127
|
+
|
|
128
|
+
# Continue with normal build
|
|
129
|
+
super().run()
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
# Read version from VERSION file at repository root
|
|
133
|
+
version_file = Path(__file__).parent.parent / "VERSION"
|
|
134
|
+
version = version_file.read_text().strip()
|
|
135
|
+
|
|
136
|
+
setup(
|
|
137
|
+
name="krista_common_proto_schema",
|
|
138
|
+
version=version,
|
|
139
|
+
author="Krista",
|
|
140
|
+
author_email="vijay.bhatt@kristasoft.com",
|
|
141
|
+
description="Shared Protocol Buffer definitions.",
|
|
142
|
+
long_description=open("README.md").read() if os.path.exists("README.md") else "",
|
|
143
|
+
long_description_content_type="text/markdown",
|
|
144
|
+
url="https://github.com/your-org/krista-common-proto-schema",
|
|
145
|
+
|
|
146
|
+
# Package configuration
|
|
147
|
+
packages=["krista_common_proto_schema"],
|
|
148
|
+
package_dir={"krista_common_proto_schema": "krista_common_proto_schema"},
|
|
149
|
+
|
|
150
|
+
# Include proto files in the package
|
|
151
|
+
package_data={
|
|
152
|
+
"krista_common_proto_schema": ["*.proto"],
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
# Dependencies
|
|
156
|
+
install_requires=[
|
|
157
|
+
"protobuf>=3.20.0,<5.0.0",
|
|
158
|
+
],
|
|
159
|
+
|
|
160
|
+
# Build dependencies
|
|
161
|
+
setup_requires=[
|
|
162
|
+
"grpcio-tools>=1.60.0",
|
|
163
|
+
],
|
|
164
|
+
|
|
165
|
+
# Custom build command
|
|
166
|
+
cmdclass={
|
|
167
|
+
"build_py": BuildProtoCommand,
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
# Metadata
|
|
171
|
+
classifiers=[
|
|
172
|
+
"Development Status :: 4 - Beta",
|
|
173
|
+
"Intended Audience :: Developers",
|
|
174
|
+
"Programming Language :: Python :: 3",
|
|
175
|
+
"Programming Language :: Python :: 3.9",
|
|
176
|
+
"Programming Language :: Python :: 3.10",
|
|
177
|
+
"Programming Language :: Python :: 3.11",
|
|
178
|
+
"Programming Language :: Python :: 3.12",
|
|
179
|
+
],
|
|
180
|
+
python_requires=">=3.9",
|
|
181
|
+
)
|
|
182
|
+
|