krista-common-proto-schema 1.0.6__tar.gz → 1.0.7__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.

Potentially problematic release.


This version of krista-common-proto-schema might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: krista_common_proto_schema
3
- Version: 1.0.6
3
+ Version: 1.0.7
4
4
  Summary: Shared Protocol Buffer definitions.
5
5
  Home-page: https://github.com/your-org/krista-common-proto-schema
6
6
  Author: Krista
@@ -11,6 +11,6 @@ Usage:
11
11
  message = message_pb2.Message(id=1, sender=user, content="Hello")
12
12
  """
13
13
 
14
- __version__ = "1.0.6"
14
+ __version__ = "1.0.7"
15
15
 
16
16
  __all__ = ["common"]
@@ -22,7 +22,7 @@ _runtime_version.ValidateProtobufRuntimeVersion(
22
22
  _sym_db = _symbol_database.Default()
23
23
 
24
24
 
25
- from common import user_pb2 as common_dot_user__pb2
25
+ from krista_common_proto_schema.common import user_pb2 as common_dot_user__pb2
26
26
 
27
27
 
28
28
  DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14\x63ommon/message.proto\x12\x06\x63ommon\x1a\x11\x63ommon/user.proto\"z\n\x07Message\x12\n\n\x02id\x18\x01 \x01(\x05\x12\x1c\n\x06sender\x18\x02 \x01(\x0b\x32\x0c.common.User\x12\x0f\n\x07\x63ontent\x18\x03 \x01(\t\x12\x11\n\ttimestamp\x18\x04 \x01(\x03\x12!\n\x04type\x18\x05 \x01(\x0e\x32\x13.common.MessageType*7\n\x0bMessageType\x12\x08\n\x04TEXT\x10\x00\x12\t\n\x05IMAGE\x10\x01\x12\t\n\x05VIDEO\x10\x02\x12\x08\n\x04\x46ILE\x10\x03\x42\'\n\x17\x63om.krista.proto.commonB\x0cMessageProtob\x06proto3')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: krista-common-proto-schema
3
- Version: 1.0.6
3
+ Version: 1.0.7
4
4
  Summary: Shared Protocol Buffer definitions.
5
5
  Home-page: https://github.com/your-org/krista-common-proto-schema
6
6
  Author: Krista
@@ -23,6 +23,7 @@ from distutils.command.build import build
23
23
  import subprocess
24
24
  import os
25
25
  import shutil
26
+ import re
26
27
  from pathlib import Path
27
28
 
28
29
 
@@ -64,8 +65,9 @@ class BuildProtoCommand(build_py):
64
65
  version_file = Path("../VERSION")
65
66
  version = version_file.read_text().strip()
66
67
 
67
- # Create output directory
68
+ # Create output directory and subdirectories
68
69
  output_dir.mkdir(exist_ok=True)
70
+ (output_dir / "common").mkdir(exist_ok=True)
69
71
 
70
72
  # Create __init__.py with dynamic version
71
73
  init_file = output_dir / "__init__.py"
@@ -101,13 +103,13 @@ __all__ = ["common"]
101
103
  # Compile each proto file
102
104
  for proto_file in proto_files:
103
105
  print(f"\n🔨 Compiling {proto_file}...")
104
-
106
+
105
107
  try:
106
108
  subprocess.run(
107
109
  [
108
110
  "python3", "-m", "grpc_tools.protoc",
109
111
  f"-I={proto_dir}",
110
- f"--python_out={output_dir}",
112
+ f"--python_out={output_dir.absolute()}",
111
113
  str(proto_file)
112
114
  ],
113
115
  check=True,
@@ -118,7 +120,21 @@ __all__ = ["common"]
118
120
  except subprocess.CalledProcessError as e:
119
121
  print(f" ❌ Error: {e.stderr}")
120
122
  raise
121
-
123
+
124
+ # Fix imports in generated Python files
125
+ print(f"\n🔧 Fixing imports in generated Python files...")
126
+ for py_file in output_dir.rglob("*_pb2.py"):
127
+ content = py_file.read_text()
128
+ # Replace "from common import" with "from krista_common_proto_schema.common import"
129
+ fixed_content = re.sub(
130
+ r'from common import (\w+)',
131
+ r'from krista_common_proto_schema.common import \1',
132
+ content
133
+ )
134
+ if fixed_content != content:
135
+ py_file.write_text(fixed_content)
136
+ print(f" ✅ Fixed imports in {py_file.name}")
137
+
122
138
  # Create __init__.py files in all subdirectories to make them packages
123
139
  print("\n📦 Creating __init__.py files in subdirectories...")
124
140
  for subdir in output_dir.rglob("*"):