Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
src/athena_client/generated/* linguist-generated=true
src/resolver_athena_client/generated/* linguist-generated=true
52 changes: 7 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,22 @@ jobs:
- name: Install the project
run: uv sync --locked --all-extras --dev

- name: Ensure no differences in generated code (Unix)
- name: Ensure no differences in generated code
if: runner.os != 'Windows'
shell: bash
run: |
source .venv/bin/activate
GENERATED_DIR="src/athena_client/generated"
BACKUP_DIR="src/athena_client/generated_backup"
GENERATED_DIR="src/resolver_athena_client/generated"
BACKUP_DIR="src/resolver_athena_client/generated_backup"

cp -r $GENERATED_DIR $BACKUP_DIR

./scripts/compile_proto.sh || (echo "Protobuf compilation failed. Ensure submodules are initialized and the proto file exists." && exit 1)

# Fix imports in generated files
if [[ -f "$GENERATED_DIR/athena/athena_pb2_grpc.py" && -f "$GENERATED_DIR/athena/athena_pb2.py" ]]; then
sed -i.bak 's/^from athena /from athena_client.generated.athena /' "$GENERATED_DIR/athena/athena_pb2_grpc.py"
sed -i.bak 's/^from athena /from athena_client.generated.athena /' "$GENERATED_DIR/athena/athena_pb2.py"
sed -i.bak 's/^from athena /from resolver_athena_client.generated.athena /' "$GENERATED_DIR/athena/athena_pb2_grpc.py"
sed -i.bak 's/^from athena /from resolver_athena_client.generated.athena /' "$GENERATED_DIR/athena/athena_pb2.py"
rm -f "$GENERATED_DIR/athena/athena_pb2_grpc.py.bak" "$GENERATED_DIR/athena/athena_pb2.py.bak"
else
echo "Error: Expected files not found in $GENERATED_DIR/athena"
Expand All @@ -78,44 +78,6 @@ jobs:

rm -rf $BACKUP_DIR

- name: Ensure no differences in generated code (Windows)
if: runner.os == 'Windows'
shell: powershell
run: |
& .venv\Scripts\Activate.ps1
$GENERATED_DIR = "src\athena_client\generated"
$BACKUP_DIR = "src\athena_client\generated_backup"

Copy-Item -Recurse -Path $GENERATED_DIR -Destination $BACKUP_DIR

# Compile protobuf files directly since compile_proto.sh won't work on Windows
if (!(Test-Path "athena-protobufs\athena\athena.proto")) {
Write-Host "Error: Protobuf file not found at athena-protobufs\athena\athena.proto. Ensure the submodule is initialized and updated."
exit 1
}

New-Item -ItemType Directory -Force -Path $GENERATED_DIR | Out-Null

python -m grpc_tools.protoc --proto_path="athena-protobufs" --python_out=$GENERATED_DIR --grpc_python_out=$GENERATED_DIR --mypy_out=$GENERATED_DIR "athena-protobufs\athena\athena.proto"

# Fix imports in generated files
if ((Test-Path "$GENERATED_DIR\athena\athena_pb2_grpc.py") -and (Test-Path "$GENERATED_DIR\athena\athena_pb2.py")) {
(Get-Content "$GENERATED_DIR\athena\athena_pb2_grpc.py") -replace '^from athena ', 'from athena_client.generated.athena ' | Set-Content "$GENERATED_DIR\athena\athena_pb2_grpc.py"
(Get-Content "$GENERATED_DIR\athena\athena_pb2.py") -replace '^from athena ', 'from athena_client.generated.athena ' | Set-Content "$GENERATED_DIR\athena\athena_pb2.py"
} else {
Write-Host "Error: Expected files not found in $GENERATED_DIR\athena"
exit 1
}

# Simple directory comparison for Windows
$differences = Compare-Object -ReferenceObject (Get-ChildItem -Recurse $GENERATED_DIR) -DifferenceObject (Get-ChildItem -Recurse $BACKUP_DIR) -Property Name, Length
if ($differences) {
Write-Host "Generated code differs. Please commit the changes after running compile_proto.sh."
exit 1
}

Remove-Item -Recurse -Force $BACKUP_DIR

- name: Run linter
run: |
uv run ruff check
Expand All @@ -130,7 +92,7 @@ jobs:

- name: Run tests
run: |
uv run pytest --junitxml=pytest.xml --tb=auto --cov-report=term-missing:skip-covered --cov=src tests/ | tee pytest-coverage.txt
uv run pytest --junitxml=pytest.xml --tb=auto --cov-report=term-missing:skip-covered --cov=src/resolver_athena_client tests/ | tee pytest-coverage.txt

- name: Upload test results
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -188,7 +150,7 @@ jobs:
if: github.event_name == 'release' && github.event.action == 'published'
environment:
name: pypi
url: https://pypi.org/p/athena-client
url: https://pypi.org/p/resolver-athena-client
permissions:
id-token: write

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The Athena client supports two authentication methods:

### Static Token Authentication
```python
from athena_client.client.channel import create_channel
from resolver_athena_client.client.channel import create_channel

# Use a pre-existing authentication token
channel = create_channel(host="your-host", auth_token="your-token")
Expand All @@ -20,7 +20,7 @@ The credential helper automatically handles OAuth token acquisition and refresh:

```python
import asyncio
from athena_client.client.channel import CredentialHelper, create_channel_with_credentials
from resolver_athena_client.client.channel import CredentialHelper, create_channel_with_credentials

async def main():
# Create credential helper with OAuth settings
Expand Down
30 changes: 15 additions & 15 deletions docs/api/client.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Client Interface
================

.. currentmodule:: athena_client.client
.. currentmodule:: resolver.athena_client.client
Comment thread
snus-kin marked this conversation as resolved.
Outdated

The client module provides the main interface for interacting with Athena
services, including the primary client class and authentication helpers.
Expand All @@ -19,7 +19,7 @@ Example:
... print(result.outputs)


.. currentmodule:: athena_client.client.athena_client
.. currentmodule:: resolver_athena_client.client.athena_client

.. autoclass:: AthenaClient
:members:
Expand All @@ -30,7 +30,7 @@ Example:
Channel Management
------------------

.. currentmodule:: athena_client.client.channel
.. currentmodule:: resolver_athena_client.client.channel

.. autofunction:: create_channel_with_credentials

Expand All @@ -55,14 +55,14 @@ Channel Management
Deployment Selection
--------------------

.. currentmodule:: athena_client.client.deployment_selector
.. currentmodule:: resolver_athena_client.client.deployment_selector

See :doc:`deployment_selector` for deployment discovery and selection functionality.

Correlation and Tracing
-----------------------

.. currentmodule:: athena_client.client.correlation
.. currentmodule:: resolver_athena_client.client.correlation

.. autoclass:: CorrelationProvider
:members:
Expand All @@ -87,7 +87,7 @@ Correlation and Tracing
Utility Functions
-----------------

.. currentmodule:: athena_client.client.utils
.. currentmodule:: resolver_athena_client.client.utils

.. autofunction:: process_classification_outputs

Expand All @@ -109,7 +109,7 @@ Utility Functions
Constants
---------

.. currentmodule:: athena_client.client.consts
.. currentmodule:: resolver_athena_client.client.consts

Common constants used throughout the client library.

Expand All @@ -127,9 +127,9 @@ Basic Classification
.. code-block:: python

import asyncio
from athena_client.client.athena_client import AthenaClient
from athena_client.client.athena_options import AthenaOptions
from athena_client.client.channel import create_channel
from resolver_athena_client.client.athena_client import AthenaClient
from resolver_athena_client.client.athena_options import AthenaOptions
from resolver_athena_client.client.channel import create_channel

async def main():
# Create channel with static token
Expand Down Expand Up @@ -167,9 +167,9 @@ OAuth Authentication

import asyncio
import os
from athena_client.client.athena_client import AthenaClient
from athena_client.client.athena_options import AthenaOptions
from athena_client.client.channel import (
from resolver_athena_client.client.athena_client import AthenaClient
from resolver_athena_client.client.athena_options import AthenaOptions
from resolver_athena_client.client.channel import (
CredentialHelper,
create_channel_with_credentials
)
Expand Down Expand Up @@ -205,12 +205,12 @@ Error Handling

.. code-block:: python

from athena_client.client.exceptions import (
from resolver_athena_client.client.exceptions import (
AthenaClientError,
AuthenticationError,
ConnectionError
)
from athena_client.client.utils import (
from resolver_athena_client.client.utils import (
process_classification_outputs,
has_output_errors
)
Expand Down
2 changes: 1 addition & 1 deletion docs/api/correlation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The correlation system provides mechanisms for generating and managing
correlation IDs for requests. This system enables request tracing,
deduplication, and logging correlation across the service.

.. module:: athena_client.client.correlation
.. module:: resolver_athena_client.client.correlation

Correlation Providers
~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion docs/api/deployment_selector.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The deployment selector provides functionality for discovering and selecting
Athena service deployments. It abstracts the complexities of deployment
management and provides a simple interface for listing deployments.

.. module:: athena_client.client.deployment_selector
.. module:: resolver_athena_client.client.deployment_selector

.. autoclass:: DeploymentSelector
:members:
Expand Down
16 changes: 8 additions & 8 deletions docs/api/exceptions.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Error Handling
==============

.. currentmodule:: athena_client.client.exceptions
.. currentmodule:: resolver_athena_client.client.exceptions

The exceptions module provides a comprehensive hierarchy of exception types for handling various error conditions that can occur when using the Athena Client library.

Expand Down Expand Up @@ -88,7 +88,7 @@ Basic Error Handling

.. code-block:: python

from athena_client.client.exceptions import (
from resolver_athena_client.client.exceptions import (
AthenaError,
InvalidAuthError,
InvalidRequestError
Expand Down Expand Up @@ -118,7 +118,7 @@ OAuth Error Handling

.. code-block:: python

from athena_client.client.exceptions import (
from resolver_athena_client.client.exceptions import (
OAuthError,
TokenExpiredError,
CredentialError
Expand All @@ -145,8 +145,8 @@ Classification Error Handling

.. code-block:: python

from athena_client.client.exceptions import ClassificationOutputError
from athena_client.client.utils import process_classification_outputs
from resolver_athena_client.client.exceptions import ClassificationOutputError
from resolver_athena_client.client.utils import process_classification_outputs

try:
async for result in results:
Expand Down Expand Up @@ -174,7 +174,7 @@ Connection Error Handling

.. code-block:: python

from athena_client.client.exceptions import InvalidHostError
from resolver_athena_client.client.exceptions import InvalidHostError
import asyncio

try:
Expand All @@ -201,7 +201,7 @@ Retry Logic
.. code-block:: python

import asyncio
from athena_client.client.exceptions import (
from resolver_athena_client.client.exceptions import (
AthenaError,
TokenExpiredError,
InvalidRequestError
Expand Down Expand Up @@ -239,7 +239,7 @@ Graceful Degradation

.. code-block:: python

from athena_client.client.exceptions import AthenaError
from resolver_athena_client.client.exceptions import AthenaError

async def classify_with_fallback(client, image_iterator, fallback_handler=None):
"""Classify images with fallback handling."""
Expand Down
10 changes: 5 additions & 5 deletions docs/api/grpc_wrappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ The GRPC wrappers module provides low-level components for interacting with the
Athena service via GRPC. These are consumed by the higher-level clients, you
should only use them directly if you are implementing a new client.

See the :doc:`athena_protobufs:index` for more information about the protobuf definitions.
See the athena-protobufs repository for more information about the protobuf definitions.

.. module:: athena_client.grpc_wrappers
.. module:: resolver_athena_client.grpc_wrappers

Service Clients
---------------

.. autoclass:: athena_client.grpc_wrappers.classifier_service.ClassifierServiceClient
.. autoclass:: resolver_athena_client.grpc_wrappers.classifier_service.ClassifierServiceClient
:members:
:special-members: __init__
:show-inheritance:
Expand All @@ -24,6 +24,6 @@ The ClassifierServiceClient provides direct access to Athena service methods::
classify_response = await client.classify(request)


The ``list_deployments(request)`` method corresponds to :doc:`athena_protobufs:api_reference#listdeployments`.
The ``list_deployments(request)`` method lists available deployments for classification.

The ``classify(request)`` method corresponds to :doc:`athena_protobufs:api_reference#classify`.
The ``classify(request)`` method performs image classification using the configured deployment.
Loading