diff --git a/.github/workflows/quality-check-dagster-contrib-gemini.yml b/.github/workflows/quality-check-dagster-gemini.yml similarity index 51% rename from .github/workflows/quality-check-dagster-contrib-gemini.yml rename to .github/workflows/quality-check-dagster-gemini.yml index 168fc49..8fa5616 100644 --- a/.github/workflows/quality-check-dagster-contrib-gemini.yml +++ b/.github/workflows/quality-check-dagster-gemini.yml @@ -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 \ No newline at end of file + working_directory: ./libraries/dagster-gemini diff --git a/.github/workflows/release-dagster-contrib-gemini.yml b/.github/workflows/release-dagster-contrib-gemini.yml deleted file mode 100644 index 04e91e6..0000000 --- a/.github/workflows/release-dagster-contrib-gemini.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: build-and-release-dagster-contrib-gemini - -on: - push: - tags: - - 'dagster_contrib_gemini-*.*.*' - -jobs: - build-and-release-dagster-contrib-gemini: - uses: ./.github/workflows/template-release.yml - with: - library_name: dagster-contrib-gemini - working_directory: ./libraries/dagster-contrib-gemini - secrets: inherit \ No newline at end of file diff --git a/.github/workflows/release-dagster-gemini.yml b/.github/workflows/release-dagster-gemini.yml new file mode 100644 index 0000000..05acc84 --- /dev/null +++ b/.github/workflows/release-dagster-gemini.yml @@ -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 diff --git a/libraries/dagster-contrib-gemini/dagster_contrib_gemini/__init__.py b/libraries/dagster-contrib-gemini/dagster_contrib_gemini/__init__.py deleted file mode 100644 index 071f9fa..0000000 --- a/libraries/dagster-contrib-gemini/dagster_contrib_gemini/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from dagster_contrib_gemini.resource import GeminiResource as GeminiResource diff --git a/libraries/dagster-contrib-gemini/Makefile b/libraries/dagster-gemini/Makefile similarity index 100% rename from libraries/dagster-contrib-gemini/Makefile rename to libraries/dagster-gemini/Makefile diff --git a/libraries/dagster-contrib-gemini/README.md b/libraries/dagster-gemini/README.md similarity index 87% rename from libraries/dagster-contrib-gemini/README.md rename to libraries/dagster-gemini/README.md index dc5bdc4..a583772 100644 --- a/libraries/dagster-contrib-gemini/README.md +++ b/libraries/dagster-gemini/README.md @@ -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 @@ -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") @@ -55,4 +55,4 @@ The `Makefile` provides the tools required to test and lint your local installat make test make ruff make check -``` \ No newline at end of file +``` diff --git a/libraries/dagster-gemini/dagster_gemini/__init__.py b/libraries/dagster-gemini/dagster_gemini/__init__.py new file mode 100644 index 0000000..d253b61 --- /dev/null +++ b/libraries/dagster-gemini/dagster_gemini/__init__.py @@ -0,0 +1 @@ +from dagster_gemini.resource import GeminiResource as GeminiResource diff --git a/libraries/dagster-contrib-gemini/dagster_contrib_gemini/resource.py b/libraries/dagster-gemini/dagster_gemini/resource.py similarity index 98% rename from libraries/dagster-contrib-gemini/dagster_contrib_gemini/resource.py rename to libraries/dagster-gemini/dagster_gemini/resource.py index 30a3acd..3bab247 100644 --- a/libraries/dagster-contrib-gemini/dagster_contrib_gemini/resource.py +++ b/libraries/dagster-gemini/dagster_gemini/resource.py @@ -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") @@ -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. @@ -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") diff --git a/libraries/dagster-contrib-gemini/dagster_contrib_gemini_tests/__init__.py b/libraries/dagster-gemini/dagster_gemini_tests/__init__.py similarity index 100% rename from libraries/dagster-contrib-gemini/dagster_contrib_gemini_tests/__init__.py rename to libraries/dagster-gemini/dagster_gemini_tests/__init__.py diff --git a/libraries/dagster-contrib-gemini/dagster_contrib_gemini_tests/test_resource.py b/libraries/dagster-gemini/dagster_gemini_tests/test_resource.py similarity index 91% rename from libraries/dagster-contrib-gemini/dagster_contrib_gemini_tests/test_resource.py rename to libraries/dagster-gemini/dagster_gemini_tests/test_resource.py index 4f7bfe2..09bb37c 100644 --- a/libraries/dagster-contrib-gemini/dagster_contrib_gemini_tests/test_resource.py +++ b/libraries/dagster-gemini/dagster_gemini_tests/test_resource.py @@ -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()) @@ -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): @@ -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): @@ -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 ): @@ -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 ): @@ -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 ): @@ -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): @@ -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 ): @@ -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): @@ -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")], @@ -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 diff --git a/libraries/dagster-contrib-gemini/pyproject.toml b/libraries/dagster-gemini/pyproject.toml similarity index 80% rename from libraries/dagster-contrib-gemini/pyproject.toml rename to libraries/dagster-gemini/pyproject.toml index c96c7eb..e8ebe0f 100644 --- a/libraries/dagster-contrib-gemini/pyproject.toml +++ b/libraries/dagster-gemini/pyproject.toml @@ -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" @@ -21,4 +21,4 @@ requires = ["setuptools>=42"] build-backend = "setuptools.build_meta" [tool.setuptools] -packages = ["dagster_contrib_gemini"] +packages = ["dagster_gemini"] diff --git a/libraries/dagster-contrib-gemini/uv.lock b/libraries/dagster-gemini/uv.lock similarity index 99% rename from libraries/dagster-contrib-gemini/uv.lock rename to libraries/dagster-gemini/uv.lock index 39a87fb..c2000f2 100644 --- a/libraries/dagster-contrib-gemini/uv.lock +++ b/libraries/dagster-gemini/uv.lock @@ -231,7 +231,7 @@ wheels = [ ] [[package]] -name = "dagster-contrib-gemini" +name = "dagster-gemini" version = "0.0.1" source = { editable = "." } dependencies = [