{"id":28766270,"url":"https://github.com/jathinshyam/grpc-starter","last_synced_at":"2026-04-17T08:03:37.257Z","repository":{"id":297822832,"uuid":"998005001","full_name":"JathinShyam/grpc-starter","owner":"JathinShyam","description":"A Python gRPC calculator service demonstrating core gRPC concepts with add, subtract, multiply, and divide operations. Includes error handling and test coverage.","archived":false,"fork":false,"pushed_at":"2025-06-07T17:23:41.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-07T18:20:49.841Z","etag":null,"topics":["grpc","grpc-python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JathinShyam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-07T17:01:33.000Z","updated_at":"2025-06-07T17:23:44.000Z","dependencies_parsed_at":"2025-06-07T18:32:57.588Z","dependency_job_id":null,"html_url":"https://github.com/JathinShyam/grpc-starter","commit_stats":null,"previous_names":["jathinshyam/grpc-starter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JathinShyam/grpc-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JathinShyam%2Fgrpc-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JathinShyam%2Fgrpc-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JathinShyam%2Fgrpc-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JathinShyam%2Fgrpc-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JathinShyam","download_url":"https://codeload.github.com/JathinShyam/grpc-starter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JathinShyam%2Fgrpc-starter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260355369,"owners_count":22996463,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grpc","grpc-python"],"created_at":"2025-06-17T12:00:34.768Z","updated_at":"2026-04-17T08:03:37.211Z","avatar_url":"https://github.com/JathinShyam.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gRPC Foundations Project\n\nA complete implementation covering Phase 1 learning objectives:\n\n- gRPC architecture fundamentals\n- Protocol Buffer definitions\n- Unary RPC implementation\n- Error handling patterns\n\n## Prerequisites\n\n- Python 3.11 or higher\n- pip (Python package installer)\n- Protocol Buffers compiler (protoc)\n- Git (optional, for version control)\n\n## Installation\n\n1. Clone the repository (if using Git):\n\n```bash\ngit clone git@github.com:JathinShyam/grpc-starter.git\ncd grpc-starter\n```\n\n2. Create and activate virtual environment:\n\n```bash\npython -m venv venv\nsource venv/bin/activate  # Linux/Mac\nvenv\\Scripts\\activate     # Windows\n```\n\n3. Install required dependencies:\n\n```bash\npip install -r requirements.txt\n```\n\n4. Install Protocol Buffers compiler:\n\n- **Linux**:\n\n```bash\nsudo apt-get install protobuf-compiler  # Ubuntu/Debian\nsudo yum install protobuf-compiler      # CentOS/RHEL\n```\n\n- **macOS**:\n\n```bash\nbrew install protobuf\n```\n\n- **Windows**: Download from [Protocol Buffers releases](https://github.com/protocolbuffers/protobuf/releases)\n\n## Project Structure\n\n```\n.\n├── protos/                  # Protocol Buffer definitions\n│   └── calculator.proto     # Service and message definitions\n├── generated/              # Generated gRPC code\n│   ├── calculator_pb2.py   # Generated message classes\n│   └── calculator_pb2_grpc.py  # Generated service classes\n├── server.py              # gRPC server implementation\n├── client.py             # gRPC client implementation\n├── requirements.txt      # Python dependencies\n└── README.md            # This file\n```\n\n## Key Concepts Covered\n\n### 1. gRPC Architecture\n\n- Client-server communication model\n- Protocol Buffers as IDL (Interface Definition Language)\n- HTTP/2 transport benefits\n- Bi-directional streaming capabilities\n- Service definition and implementation\n\n### 2. Protocol Buffers\n\n- Message definitions\n- Service declarations\n- Scalar data types\n- `oneof` field usage\n- Package namespacing\n- Field numbering and versioning\n- Nested message types\n\n### 3. Code Generation\n\n- `protoc` compiler workflow\n- Python class generation\n- Serialization/deserialization\n- Service stub generation\n- Message type definitions\n\n### 4. Unary RPC Implementation\n\n- Service implementation inheritance\n- Request/response handling\n- Context manipulation\n- Error handling\n- Request validation\n- Response formatting\n\n### 5. Error Handling\n\n- Status codes (INVALID_ARGUMENT)\n- Error details propagation\n- Client-side exception handling\n- Timeout management\n- Graceful error recovery\n- Custom error types\n\n### 6. Best Practices\n\n- Thread pool management\n- Proper channel handling\n- Input validation\n- Clean resource termination\n- Connection pooling\n- Load balancing\n- Security considerations\n\n## Running the Project\n\n1. Start the gRPC server:\n\n```bash\npython server.py\n```\n\nThe server will start on port 50051 by default.\n\n2. Run the client in a separate terminal:\n\n```bash\npython client.py\n```\n\n3. Example client usage:\n\n```python\nimport grpc\nfrom generated import calculator_pb2, calculator_pb2_grpc\n\ndef run():\n    # Create a gRPC channel\n    with grpc.insecure_channel('localhost:50051') as channel:\n        # Create a stub (client)\n        stub = calculator_pb2_grpc.CalculatorStub(channel)\n\n        # Make Add request\n        add_request = calculator_pb2.AddRequest(a=10, b=20)\n        add_response = stub.Add(add_request)\n        print(f\"Add result: {add_response.result}\")\n\n        # Make Divide request\n        divide_request = calculator_pb2.DivideRequest(dividend=100, divisor=5)\n        divide_response = stub.Divide(divide_request)\n        print(f\"Divide result: {divide_response.quotient}\")\n\nif __name__ == '__main__':\n    run()\n```\n\n## Testing\n\n1. Unit Tests:\n\n```bash\n# Run tests with coverage\n./run_tests.sh\n\n# Or run tests directly with pytest\npython -m pytest tests/\n```\n\n2. Manual Testing:\n\n- Use the provided client to test different operations\n- Test error cases (e.g., division by zero)\n- Verify response times and performance\n\n## Troubleshooting\n\nCommon issues and solutions:\n\n1. **ImportError: No module named 'grpc'**\n\n   - Solution: Ensure you're in the virtual environment and run `pip install -r requirements.txt`\n\n2. **Connection refused errors**\n\n   - Solution: Verify the server is running and check the port number\n\n3. **Protocol Buffer compilation errors**\n   - Solution: Ensure protoc is installed and in your PATH\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Commit your changes\n4. Push to the branch\n5. Create a Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjathinshyam%2Fgrpc-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjathinshyam%2Fgrpc-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjathinshyam%2Fgrpc-starter/lists"}