gRPC interface to lara_django_sequences
Project description
LARA Django Sequences - gRPC API
This directory contains the gRPC interface for the lara-django-sequences application, providing a high-performance API for sequence data handling (DNA, RNA, peptide/protein, PNA, XNA) in the LARA database.
Overview
The gRPC API provides remote procedure call access to the LARA Django Sequences service with support for multiple programming languages through protocol buffer definitions. It also contains a high-level Python interface for easy integration with Python applications.
Package: lara-django-sequences-grpc
Python Requirement: 3.13.*
Project Structure
api/grpc/
├── go/ # Go gRPC client code
├── connect-es/ # Connect-ES client code
├── connectrpc-es/ # ConnectRPC ES implementations
├── grpc-web/ # gRPC-Web client code
├── gen/ # Generated code from protobuf definitions
├── dist/ # Distribution packages
├── pyproject.toml # Python project configuration
└── python/ # Python API module root
└── lara_django_sequences_grpc/
├── lara_django_sequences_data_model.py # Data model definitions
├── lara_django_sequences_interface.py # High-level interface
└── v1/
└── *_pb2.py # Generated protocol buffer code
Installation
Using uv (Recommended)
Install the lara-django-sequences-grpc package with uv for faster dependency resolution:
cd api/grpc
uv pip install .
Or with development dependencies:
uv pip install -e ".[dev]"
For development, install with editable mode and all dependency groups:
cd api/grpc
uv sync --all-groups
Using pip
Alternatively, install with pip:
pip install lara-django-sequences-grpc
Or from the local directory:
cd api/grpc
pip install .
Dependencies
- Runtime:
grpcio>=1.73.0 - Development:
grpcio-tools>=1.73.0pytest>=8,<9pytest-cov>=6,<7pytest-asyncio
Code Generation
Protocol buffer definitions are located in ../proto/lara_django_sequences_grpc/. To regenerate gRPC code from protobuf definitions, e.g. in case you changed the .proto file, use the Buf CLI:
cd api
buf generate
This will generate code for multiple targets as configured in buf.gen.yaml:
- Python
- Go
- JavaScript/TypeScript (Connect-ES, ConnectRPC, gRPC-Web)
Running Tests
The test suite is located in api/tests/ and includes tests for all major functionalities:
Using uv
# From the api/grpc directory
uv run pytest api/tests/
# With coverage
uv run pytest api/tests/ --cov
Using pytest directly
# From the api/grpc directory
pytest api/tests/
# With coverage
pytest api/tests/ --cov
Usage Examples
Python Client
import grpc
from lara_django_sequences_grpc import sequence_pb2, sequence_pb2_grpc
# Create a channel to the gRPC server
channel = grpc.insecure_channel('localhost:50051')
# Create a stub (client)
stub = sequence_pb2_grpc.SequenceServiceStub(channel)
# Make a request
response = stub.GetSequence(sequence_pb2.GetSequenceRequest(id=1))
print(response)
# Don't forget to close the channel when done
channel.close()
# For more comprehensive examples, see the demo clients in `../../demo/` and the documentation at [https://larasuite.gitlab.io/lara-django-sequences/](https://larasuite.gitlab.io/lara-django-sequences/).
Working with uv
This project is configured for uv with the following features:
- Build Backend:
uv_build>=0.7.13,<0.8.0 - Module Root:
python/(all Python gRPC code should be placed here) - Dependency Groups: Development dependencies are organized in groups
Common uv commands:
# Sync dependencies
uv sync
# Sync with development dependencies
uv sync --all-groups
# Add a new dependency
uv add package-name
# Add a development dependency
uv add --dev package-name
# Run a command in the uv environment
uv run python script.py
# Build the package
uv build
Module Root
The Python module root is configured at python/, meaning all Python gRPC code should be placed in that directory.
Documentation
- Project Documentation: https://larasuite.gitlab.io/lara-django-sequences/
- Source Code: https://gitlab.com/larasuite/lara-django-sequences
- Issue Tracker: https://gitlab.com/larasuite/lara-django-sequences/-/issues
- Protocol Buffer Definitions: ../proto/lara_django_sequences_grpc/
Protocol Buffer Linting
The project uses Buf for linting and breaking change detection. Configuration is in ../buf.yaml:
- Follows DEFAULT lint rules with specific exceptions
- Breaking change detection enabled
- Ignores certain Google type definitions
Contributing
Contributions are welcome! Please see the CONTRIBUTING.md file in the project root for guidelines.
When modifying protobuf definitions:
- Edit
.protofiles in../proto/lara_django_sequences_grpc/ - Run
buf generateto regenerate code - Update tests as needed
- Run the test suite to ensure compatibility
License
See the LICENSE file in the project root.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lara_django_sequences_grpc-0.2.113.tar.gz.
File metadata
- Download URL: lara_django_sequences_grpc-0.2.113.tar.gz
- Upload date:
- Size: 23.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7adbe040c2468d3f27f87de80e32c079d525fe3b5d59d049d80c88e1b4d466f2
|
|
| MD5 |
819501ae15e950b7caa4087a2a50ed2e
|
|
| BLAKE2b-256 |
8f4e49bdfdc9fcf30dc1709b3b5ae38d7e8fec6bfed0db5f21a65afb9ee379eb
|
File details
Details for the file lara_django_sequences_grpc-0.2.113-py3-none-any.whl.
File metadata
- Download URL: lara_django_sequences_grpc-0.2.113-py3-none-any.whl
- Upload date:
- Size: 25.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
726f022cf2a7dfb296bfc082456b7153d0f89e199ccb3250722167a9fcd0e6b6
|
|
| MD5 |
0778741f3ded5ea3b31c8d1cd909106c
|
|
| BLAKE2b-256 |
fb30a0837b7cb87ac81b13fee9a24061bfd53eb72fd36fd1a0a07489c04a7320
|