channelpass-contracts 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.
- channelpass_contracts-0.1.0/LICENSE +21 -0
- channelpass_contracts-0.1.0/MANIFEST.in +1 -0
- channelpass_contracts-0.1.0/PKG-INFO +31 -0
- channelpass_contracts-0.1.0/README.md +19 -0
- channelpass_contracts-0.1.0/proto/channelpass_contracts/demo/v1/demo.proto +22 -0
- channelpass_contracts-0.1.0/pyproject.toml +16 -0
- channelpass_contracts-0.1.0/python/channelpass_contracts/__init__.py +1 -0
- channelpass_contracts-0.1.0/python/channelpass_contracts.egg-info/PKG-INFO +31 -0
- channelpass_contracts-0.1.0/python/channelpass_contracts.egg-info/SOURCES.txt +13 -0
- channelpass_contracts-0.1.0/python/channelpass_contracts.egg-info/dependency_links.txt +1 -0
- channelpass_contracts-0.1.0/python/channelpass_contracts.egg-info/requires.txt +2 -0
- channelpass_contracts-0.1.0/python/channelpass_contracts.egg-info/top_level.txt +1 -0
- channelpass_contracts-0.1.0/setup.cfg +4 -0
- channelpass_contracts-0.1.0/setup.py +33 -0
- channelpass_contracts-0.1.0/tests/test_contracts.py +15 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Котёнок Ильназик
|
|
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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
recursive-include proto *.proto
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: channelpass-contracts
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Shared Protocol Buffers and gRPC contracts for ChannelPass
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: grpcio<2,>=1.85.4
|
|
10
|
+
Requires-Dist: protobuf<8,>=7.35.1
|
|
11
|
+
Dynamic: license-file
|
|
12
|
+
|
|
13
|
+
# ChannelPass Contracts
|
|
14
|
+
|
|
15
|
+
## Русский
|
|
16
|
+
|
|
17
|
+
Контракты проекта ChannelPass на Protobuf (`.proto`) с gRPC для Rust и Python. Лицензия MIT.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
cargo add channelpass-contracts
|
|
21
|
+
python -m pip install channelpass-contracts
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## English
|
|
25
|
+
|
|
26
|
+
ChannelPass project contracts defined in Protocol Buffers (`.proto`) with gRPC for Rust and Python. MIT license.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
cargo add channelpass-contracts
|
|
30
|
+
python -m pip install channelpass-contracts
|
|
31
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# ChannelPass Contracts
|
|
2
|
+
|
|
3
|
+
## Русский
|
|
4
|
+
|
|
5
|
+
Контракты проекта ChannelPass на Protobuf (`.proto`) с gRPC для Rust и Python. Лицензия MIT.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
cargo add channelpass-contracts
|
|
9
|
+
python -m pip install channelpass-contracts
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## English
|
|
13
|
+
|
|
14
|
+
ChannelPass project contracts defined in Protocol Buffers (`.proto`) with gRPC for Rust and Python. MIT license.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
cargo add channelpass-contracts
|
|
18
|
+
python -m pip install channelpass-contracts
|
|
19
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package channelpass.demo.v1;
|
|
4
|
+
|
|
5
|
+
service DemoService {
|
|
6
|
+
rpc Ping(PingRequest) returns (PingResponse);
|
|
7
|
+
rpc Echo(EchoRequest) returns (EchoResponse);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
message PingRequest {}
|
|
11
|
+
|
|
12
|
+
message PingResponse {
|
|
13
|
+
string message = 1;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
message EchoRequest {
|
|
17
|
+
string message = 1;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
message EchoResponse {
|
|
21
|
+
string message = 1;
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77", "grpcio-tools==1.85.4"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "channelpass-contracts"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Shared Protocol Buffers and gRPC contracts for ChannelPass"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
dependencies = ["grpcio>=1.85.4,<2", "protobuf>=7.35.1,<8"]
|
|
14
|
+
|
|
15
|
+
[tool.setuptools.packages.find]
|
|
16
|
+
where = ["python"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Generated Protocol Buffers and gRPC contracts for ChannelPass."""
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: channelpass-contracts
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Shared Protocol Buffers and gRPC contracts for ChannelPass
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: grpcio<2,>=1.85.4
|
|
10
|
+
Requires-Dist: protobuf<8,>=7.35.1
|
|
11
|
+
Dynamic: license-file
|
|
12
|
+
|
|
13
|
+
# ChannelPass Contracts
|
|
14
|
+
|
|
15
|
+
## Русский
|
|
16
|
+
|
|
17
|
+
Контракты проекта ChannelPass на Protobuf (`.proto`) с gRPC для Rust и Python. Лицензия MIT.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
cargo add channelpass-contracts
|
|
21
|
+
python -m pip install channelpass-contracts
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## English
|
|
25
|
+
|
|
26
|
+
ChannelPass project contracts defined in Protocol Buffers (`.proto`) with gRPC for Rust and Python. MIT license.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
cargo add channelpass-contracts
|
|
30
|
+
python -m pip install channelpass-contracts
|
|
31
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
setup.py
|
|
6
|
+
proto/channelpass_contracts/demo/v1/demo.proto
|
|
7
|
+
python/channelpass_contracts/__init__.py
|
|
8
|
+
python/channelpass_contracts.egg-info/PKG-INFO
|
|
9
|
+
python/channelpass_contracts.egg-info/SOURCES.txt
|
|
10
|
+
python/channelpass_contracts.egg-info/dependency_links.txt
|
|
11
|
+
python/channelpass_contracts.egg-info/requires.txt
|
|
12
|
+
python/channelpass_contracts.egg-info/top_level.txt
|
|
13
|
+
tests/test_contracts.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
channelpass_contracts
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from importlib.resources import files
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from shutil import copyfile
|
|
4
|
+
|
|
5
|
+
from grpc_tools import protoc
|
|
6
|
+
from setuptools import setup
|
|
7
|
+
from setuptools.command.build_py import build_py
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class BuildContracts(build_py):
|
|
11
|
+
def run(self):
|
|
12
|
+
super().run()
|
|
13
|
+
root = Path("proto")
|
|
14
|
+
output = Path(self.build_lib)
|
|
15
|
+
schemas = sorted(root.rglob("*.proto"))
|
|
16
|
+
if not schemas:
|
|
17
|
+
raise RuntimeError("No Protocol Buffers contracts found")
|
|
18
|
+
result = protoc.main([
|
|
19
|
+
"grpc_tools.protoc",
|
|
20
|
+
f"-I{root}",
|
|
21
|
+
f"-I{files('grpc_tools').joinpath('_proto')}",
|
|
22
|
+
f"--python_out={output}",
|
|
23
|
+
f"--pyi_out={output}",
|
|
24
|
+
f"--grpc_python_out={output}",
|
|
25
|
+
*(str(schema) for schema in schemas),
|
|
26
|
+
])
|
|
27
|
+
if result:
|
|
28
|
+
raise RuntimeError(f"Protocol Buffers generation failed with exit code {result}")
|
|
29
|
+
for schema in schemas:
|
|
30
|
+
copyfile(schema, output / schema.relative_to(root))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
setup(cmdclass={"build_py": BuildContracts})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
from channelpass_contracts.demo.v1 import demo_pb2, demo_pb2_grpc
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ContractsTest(unittest.TestCase):
|
|
7
|
+
def test_generated_messages_keep_the_wire_contract(self):
|
|
8
|
+
self.assertEqual(demo_pb2.EchoRequest(message="hi").SerializeToString(), b"\x0a\x02hi")
|
|
9
|
+
self.assertEqual(demo_pb2.PingResponse.FromString(b"\x0a\x04pong").message, "pong")
|
|
10
|
+
|
|
11
|
+
def test_generated_service_uses_the_expected_rpc_names(self):
|
|
12
|
+
service = demo_pb2.DESCRIPTOR.services_by_name["DemoService"]
|
|
13
|
+
self.assertEqual(service.full_name, "channelpass.demo.v1.DemoService")
|
|
14
|
+
self.assertEqual([method.name for method in service.methods], ["Ping", "Echo"])
|
|
15
|
+
self.assertTrue(callable(demo_pb2_grpc.DemoServiceStub))
|