Skip to content

Commit

Permalink
[dagster-gemini] dagster-contrib-gemini -> dagster-gemini
Browse files Browse the repository at this point in the history
  • Loading branch information
cmpadden committed Jan 15, 2025
1 parent 474c263 commit 8cab3f9
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 56 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: quality-check-dagster-contrib-gemini
name: quality-check-dagster-gemini
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'libraries/dagster-contrib-gemini/**'
- 'libraries/dagster-gemini/**'

jobs:
check:
uses: ./.github/workflows/template-quality-check.yml
with:
working_directory: ./libraries/dagster-contrib-gemini
working_directory: ./libraries/dagster-gemini
14 changes: 0 additions & 14 deletions .github/workflows/release-dagster-contrib-gemini.yml

This file was deleted.

14 changes: 14 additions & 0 deletions .github/workflows/release-dagster-gemini.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: build-and-release-dagster-gemini

on:
push:
tags:
- 'dagster_gemini-*.*.*'

jobs:
build-and-release-dagster-gemini:
uses: ./.github/workflows/template-release.yml
with:
library_name: dagster-gemini
working_directory: ./libraries/dagster-gemini
secrets: inherit

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# dagster-contrib-gemini
# dagster-gemini

A dagster module that provides integration with [Gemini](https://deepmind.google/technologies/gemini/).

## Installation

The `dagster_contrib_gemini` module is available as a PyPI package - install with your preferred python
The `dagster_gemini` module is available as a PyPI package - install with your preferred python
environment manager (We recommend [uv](https://github.com/astral-sh/uv)).

```
source .venv/bin/activate
uv pip install dagster_contrib_gemini
uv pip install dagster_gemini
```

## Example Usage
Expand All @@ -25,7 +25,7 @@ not the streaming or batching API.

```python
from dagster import AssetExecutionContext, Definitions, EnvVar, asset, define_asset_job
from dagster_contrib_gemini import GeminiResource
from dagster_gemini import GeminiResource


@asset(compute_kind="gemini")
Expand Down Expand Up @@ -55,4 +55,4 @@ The `Makefile` provides the tools required to test and lint your local installat
make test
make ruff
make check
```
```
1 change: 1 addition & 0 deletions libraries/dagster-gemini/dagster_gemini/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from dagster_gemini.resource import GeminiResource as GeminiResource
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class GeminiResource(ConfigurableResource):
.. code-block:: python
from dagster import AssetExecutionContext, Definitions, EnvVar, asset, define_asset_job
from dagster_contrib_gemini import GeminiResource
from dagster_gemini import GeminiResource
@asset(compute_kind="gemini")
Expand Down Expand Up @@ -180,7 +180,7 @@ def get_model(
define_asset_job,
op,
)
from dagster_contrib_gemini import GeminiResource
from dagster_gemini import GeminiResource
# This is an asset using the Gemini resource - usage stats will be logged to
# the asset metadata.
Expand Down Expand Up @@ -256,7 +256,7 @@ def get_model_for_asset(
define_asset_job,
multi_asset,
)
from dagster_contrib_gemini import GeminiResource
from dagster_gemini import GeminiResource
@asset(compute_kind="gemini")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
from dagster._core.errors import DagsterInvariantViolationError
from dagster._core.execution.context.init import build_init_resource_context
from dagster._utils.test import wrap_op_in_graph_and_execute
from dagster_contrib_gemini import GeminiResource
from dagster_gemini import GeminiResource

API_KEY = "xoxp-1234123412341234-12341234-1234"
MODEL_NAME = "gemini-1.5-flash"


@patch("dagster_contrib_gemini.resource.GenerativeModel")
@patch("dagster_contrib_gemini.resource.genai.configure")
@patch("dagster_gemini.resource.GenerativeModel")
@patch("dagster_gemini.resource.genai.configure")
def test_gemini_client(mock_configure, mock_model) -> None:
gemini_resource = GeminiResource(api_key=API_KEY, generative_model_name=MODEL_NAME)
gemini_resource.setup_for_execution(build_init_resource_context())
Expand All @@ -40,9 +40,9 @@ def test_gemini_client(mock_configure, mock_model) -> None:
mock_model.assert_called_once_with(model_name=MODEL_NAME)


@patch("dagster_contrib_gemini.resource.GenerativeModel")
@patch("dagster_gemini.resource.GenerativeModel")
@patch("dagster.OpExecutionContext", autospec=OpExecutionContext)
@patch("dagster_contrib_gemini.resource.genai.configure")
@patch("dagster_gemini.resource.genai.configure")
def test_gemini_resource_with_op(mock_configure, mock_context, mock_model):
@op
def gemini_op(gemini_resource: GeminiResource):
Expand All @@ -61,9 +61,9 @@ def gemini_op(gemini_resource: GeminiResource):
assert result.success


@patch("dagster_contrib_gemini.resource.GenerativeModel")
@patch("dagster_gemini.resource.GenerativeModel")
@patch("dagster.AssetExecutionContext", autospec=AssetExecutionContext)
@patch("dagster_contrib_gemini.resource.genai.configure")
@patch("dagster_gemini.resource.genai.configure")
def test_gemini_resource_with_asset(mock_configure, mock_context, mock_model):
@asset
def gemini_asset(gemini_resource: GeminiResource):
Expand All @@ -83,10 +83,10 @@ def gemini_asset(gemini_resource: GeminiResource):
assert result.success


@patch("dagster_contrib_gemini.resource.GeminiResource._wrap_with_usage_metadata")
@patch("dagster_contrib_gemini.resource.GenerativeModel")
@patch("dagster_gemini.resource.GeminiResource._wrap_with_usage_metadata")
@patch("dagster_gemini.resource.GenerativeModel")
@patch("dagster.AssetExecutionContext", autospec=AssetExecutionContext)
@patch("dagster_contrib_gemini.resource.genai.configure")
@patch("dagster_gemini.resource.genai.configure")
def test_gemini_resource_with_graph_backed_asset(
mock_configure, mock_context, mock_model, mock_wrapper
):
Expand Down Expand Up @@ -118,10 +118,10 @@ def gemini_asset():
assert result.success


@patch("dagster_contrib_gemini.resource.GeminiResource._wrap_with_usage_metadata")
@patch("dagster_contrib_gemini.resource.GenerativeModel")
@patch("dagster_gemini.resource.GeminiResource._wrap_with_usage_metadata")
@patch("dagster_gemini.resource.GenerativeModel")
@patch("dagster.AssetExecutionContext", autospec=AssetExecutionContext)
@patch("dagster_contrib_gemini.resource.genai.configure")
@patch("dagster_gemini.resource.genai.configure")
def test_gemini_resource_with_multi_asset(
mock_configure, mock_context, mock_model, mock_wrapper
):
Expand Down Expand Up @@ -166,10 +166,10 @@ def gemini_multi_asset(gemini_resource: GeminiResource):
assert result.success


@patch("dagster_contrib_gemini.resource.GeminiResource._wrap_with_usage_metadata")
@patch("dagster_gemini.resource.GeminiResource._wrap_with_usage_metadata")
@patch("dagster.AssetExecutionContext", autospec=AssetExecutionContext)
@patch("dagster_contrib_gemini.resource.GenerativeModel")
@patch("dagster_contrib_gemini.resource.genai.configure")
@patch("dagster_gemini.resource.GenerativeModel")
@patch("dagster_gemini.resource.genai.configure")
def test_gemini_resource_with_partitioned_asset(
mock_configure, mock_model, mock_context, mock_wrapper
):
Expand Down Expand Up @@ -235,8 +235,8 @@ def gemini_partitioned_asset(gemini_resource: GeminiResource):


@patch("dagster.AssetExecutionContext", autospec=AssetExecutionContext)
@patch("dagster_contrib_gemini.resource.GenerativeModel")
@patch("dagster_contrib_gemini.resource.genai.configure")
@patch("dagster_gemini.resource.GenerativeModel")
@patch("dagster_gemini.resource.genai.configure")
def test_gemini_wrapper_with_asset(mock_configure, mock_model, mock_context):
@asset
def gemini_asset(gemini_resource: GeminiResource):
Expand Down Expand Up @@ -284,8 +284,8 @@ def gemini_asset(gemini_resource: GeminiResource):


@patch("dagster.AssetExecutionContext", autospec=AssetExecutionContext)
@patch("dagster_contrib_gemini.resource.GenerativeModel")
@patch("dagster_contrib_gemini.resource.genai.configure")
@patch("dagster_gemini.resource.GenerativeModel")
@patch("dagster_gemini.resource.genai.configure")
def test_gemini_wrapper_with_graph_backed_asset(
mock_configure, mock_model, mock_context
):
Expand Down Expand Up @@ -344,8 +344,8 @@ def gemini_asset():

# Test that usage metadata is not logged in an op context
@patch("dagster.OpExecutionContext", autospec=OpExecutionContext)
@patch("dagster_contrib_gemini.resource.GenerativeModel")
@patch("dagster_contrib_gemini.resource.genai.configure")
@patch("dagster_gemini.resource.GenerativeModel")
@patch("dagster_gemini.resource.genai.configure")
def test_gemini_wrapper_with_op(mock_configure, mock_model, mock_context):
@op
def gemini_op(gemini_resource: GeminiResource):
Expand Down Expand Up @@ -389,8 +389,8 @@ def gemini_job():


@patch("dagster.AssetExecutionContext", autospec=AssetExecutionContext)
@patch("dagster_contrib_gemini.resource.GenerativeModel")
@patch("dagster_contrib_gemini.resource.genai.configure")
@patch("dagster_gemini.resource.GenerativeModel")
@patch("dagster_gemini.resource.genai.configure")
def test_gemini_wrapper_with_multi_asset(mock_configure, mock_model, mock_context):
@multi_asset(
specs=[AssetSpec("status"), AssetSpec("result")],
Expand Down Expand Up @@ -442,8 +442,8 @@ def gemini_multi_asset(gemini_resource: GeminiResource):
assert result.success


@patch("dagster_contrib_gemini.resource.GenerativeModel")
@patch("dagster_contrib_gemini.resource.genai.configure")
@patch("dagster_gemini.resource.GenerativeModel")
@patch("dagster_gemini.resource.genai.configure")
def test_gemini_wrapper_with_partitioned_asset(mock_configure, mock_model):
NUM_PARTITION_KEYS = 4
NUM_ASSET_DEFS = 5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "dagster-contrib-gemini"
version = "0.0.2"
name = "dagster-gemini"
version = "0.0.1"
description = "Dagster integration with Gemini"
readme = "README.md"
requires-python = ">=3.9"
Expand All @@ -21,4 +21,4 @@ requires = ["setuptools>=42"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
packages = ["dagster_contrib_gemini"]
packages = ["dagster_gemini"]

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8cab3f9

Please sign in to comment.