Upload grpcio/GRPCIO_USER_GUIDE.txt with huggingface_hub
Browse files- grpcio/GRPCIO_USER_GUIDE.txt +81 -0
grpcio/GRPCIO_USER_GUIDE.txt
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
================================================================================
|
| 2 |
+
GRPCIO - USER GUIDE (Android Python STB) - Generated by RIMI
|
| 3 |
+
================================================================================
|
| 4 |
+
|
| 5 |
+
Package: grpcio 1.83.1 (latest stable on PyPI at build time)
|
| 6 |
+
Wheel tags: cp312-cp312-android_24_x86_64 / cp312-cp312-android_24_arm64_v8a
|
| 7 |
+
Runtime dep: typing_extensions~=4.12 (pure Python, own package - install it too)
|
| 8 |
+
Requires-Python: >=3.10 (app runs Python 3.12)
|
| 9 |
+
|
| 10 |
+
WHAT IT IS
|
| 11 |
+
-----------
|
| 12 |
+
gRPC is an HTTP/2-based RPC framework. The `grpc` package lets you build
|
| 13 |
+
clients and servers with unary and streaming calls, sync (`grpc`) and
|
| 14 |
+
async (`grpc.aio`) APIs, channels, interceptors, compression, and
|
| 15 |
+
TLS credentials. This wheel bundles the full upstream C++ core
|
| 16 |
+
(gRPC core, abseil, BoringSSL, c-ares, re2, upb, zlib) statically inside
|
| 17 |
+
one self-contained native extension, built from the official PyPI sdist
|
| 18 |
+
with the Android NDK (API 24). No extra native libraries are needed.
|
| 19 |
+
|
| 20 |
+
INSTALL
|
| 21 |
+
-------
|
| 22 |
+
1. Install this wheel (STANDALONE) with the app PipManager.
|
| 23 |
+
2. Install the matching pure-Python `typing_extensions` wheel (shipped
|
| 24 |
+
alongside in STANDALONE) if it is not already installed.
|
| 25 |
+
3. `import grpc` - no setup, no preload, no environment variables.
|
| 26 |
+
|
| 27 |
+
QUICK START (loopback echo, no protobuf, no external network)
|
| 28 |
+
--------------------------------------------------------------
|
| 29 |
+
>>> from concurrent import futures
|
| 30 |
+
>>> import grpc
|
| 31 |
+
>>> def echo(request, context):
|
| 32 |
+
... return b'echo:' + request
|
| 33 |
+
>>> h = grpc.unary_unary_rpc_method_handler(
|
| 34 |
+
... echo, request_deserializer=lambda b: b,
|
| 35 |
+
... response_serializer=lambda b: b)
|
| 36 |
+
>>> server = grpc.server(futures.ThreadPoolExecutor(max_workers=2))
|
| 37 |
+
>>> server.add_generic_rpc_handlers(
|
| 38 |
+
... (grpc.method_handlers_generic_handler('test.Test', {'Echo': h}),))
|
| 39 |
+
>>> port = server.add_insecure_port('127.0.0.1:0')
|
| 40 |
+
>>> server.start()
|
| 41 |
+
>>> ch = grpc.insecure_channel('127.0.0.1:%d' % port)
|
| 42 |
+
>>> grpc.channel_ready_future(ch).result(timeout=15)
|
| 43 |
+
>>> ch.unary_unary('/test.Test/Echo')(b'ping', timeout=15)
|
| 44 |
+
b'echo:ping'
|
| 45 |
+
>>> ch.close(); server.stop(None)
|
| 46 |
+
|
| 47 |
+
For real services, generate stubs with `grpcio-tools` on your PC
|
| 48 |
+
(`python -m grpc_tools.protoc`) and copy the generated *_pb2.py files
|
| 49 |
+
to the device; this wheel then serves them at runtime.
|
| 50 |
+
|
| 51 |
+
ANDROID NOTES
|
| 52 |
+
-------------
|
| 53 |
+
- Loopback TCP (127.0.0.1) is used for local client+server in one process;
|
| 54 |
+
no internet permission or external network is required for that.
|
| 55 |
+
- TLS roots: `grpc/_cython/_credentials/roots.pem` is bundled (same as
|
| 56 |
+
upstream wheels) and used by default SSL credentials.
|
| 57 |
+
- Fork support is compiled in (GRPC_ENABLE_FORK_SUPPORT); on Android,
|
| 58 |
+
prefer threads (as above) over os.fork().
|
| 59 |
+
- c-ares uses the vendored Android DNS config (bionic has no
|
| 60 |
+
getservbyport_r); async name resolution works via the platform resolver.
|
| 61 |
+
- The extension links the app's libc++_shared and librimi (provided by
|
| 62 |
+
the app, like all native packages) - nothing for you to install.
|
| 63 |
+
|
| 64 |
+
TESTED ON DEVICE (Test_Grpcio.py - ALL PASSED)
|
| 65 |
+
----------------------------------------------
|
| 66 |
+
1. import grpc + native cygrpc extension
|
| 67 |
+
2. grpc version 1.83.1
|
| 68 |
+
3. typing_extensions present
|
| 69 |
+
4. insecure_channel creation (no traffic)
|
| 70 |
+
5. loopback server bind on 127.0.0.1
|
| 71 |
+
6. channel ready on loopback
|
| 72 |
+
7. unary echo roundtrip b'ping' -> b'echo:ping'
|
| 73 |
+
8. second unary echo roundtrip (channel reuse)
|
| 74 |
+
9. StatusCode API surface
|
| 75 |
+
|
| 76 |
+
Run it from the app Scripts folder; exit code 0 means ALL PASSED
|
| 77 |
+
(network-restricted sandbox steps report SKIP instead of FAIL).
|
| 78 |
+
|
| 79 |
+
================================================================================
|
| 80 |
+
Generated by RIMI
|
| 81 |
+
================================================================================
|