From 90d8f284c714873e7bf5120d3c76348b1ec34015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9d=C3=A9ric=20Hurier=20=28Fmind=29?= Date: Mon, 18 Mar 2024 21:45:31 +0100 Subject: [PATCH] V0.8.0 (#10) --- .github/ISSUE_TEMPLATE/feat-request.md | 9 --------- .github/ISSUE_TEMPLATE/fix-request.md | 9 --------- .github/workflows/publish.yml | 6 ++++-- pyproject.toml | 1 + src/bikes/core/schemas.py | 1 + src/bikes/io/services.py | 4 ++-- tests/conftest.py | 4 ++-- tests/io/test_registries.py | 4 ++-- tests/jobs/test_training.py | 4 ++-- tests/jobs/test_tuning.py | 4 ++-- tests/utils/test_searchers.py | 2 +- 11 files changed, 17 insertions(+), 31 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/feat-request.md b/.github/ISSUE_TEMPLATE/feat-request.md index 85bdbf0..d58b629 100644 --- a/.github/ISSUE_TEMPLATE/feat-request.md +++ b/.github/ISSUE_TEMPLATE/feat-request.md @@ -4,15 +4,6 @@ about: A new feature. title: "[FEAT] " labels: feat assignees: fmind -body: -- type: checkboxes - id: breaking-change - attributes: - label: Breaking change? - options: - - label: Yes - - label: No - - label: Maybe --- ## Description diff --git a/.github/ISSUE_TEMPLATE/fix-request.md b/.github/ISSUE_TEMPLATE/fix-request.md index 39b4d03..42decd9 100644 --- a/.github/ISSUE_TEMPLATE/fix-request.md +++ b/.github/ISSUE_TEMPLATE/fix-request.md @@ -4,15 +4,6 @@ about: A bug fix title: "[FIX] " labels: fix assignees: fmind -body: -- type: checkboxes - id: breaking-change - attributes: - label: Breaking change? - options: - - label: Yes - - label: No - - label: Maybe --- ## Bug Description diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d9cc9e1..a27b0d5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,7 +3,7 @@ on: release: types: [published] env: - DOCKER_IMAGE: ghcr.io/fmind/mlops-python-package:latest + DOCKER_IMAGE: ghcr.io/fmind/mlops-python-package concurrency: cancel-in-progress: true group: publish-workflow @@ -39,4 +39,6 @@ jobs: context: . cache-to: type=gha cache-from: type=gha - tags: ${{ env.DOCKER_IMAGE }} + tags: | + ${{ env.DOCKER_IMAGE }}:latest + ${{ env.DOCKER_IMAGE }}:${{ github.ref }} diff --git a/pyproject.toml b/pyproject.toml index 3433665..a76b0a4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,6 +92,7 @@ addopts = "--verbosity=2" [tool.ruff] fix = true +indent-width = 4 line-length = 100 target-version = "py312" diff --git a/src/bikes/core/schemas.py b/src/bikes/core/schemas.py index 8971304..988954f 100644 --- a/src/bikes/core/schemas.py +++ b/src/bikes/core/schemas.py @@ -11,6 +11,7 @@ # %% TYPES +# Generic type for a dataframe container TSchema = T.TypeVar("TSchema", bound="pa.DataFrameModel") # %% SCHEMAS diff --git a/src/bikes/io/services.py b/src/bikes/io/services.py index d8657ae..13736d6 100644 --- a/src/bikes/io/services.py +++ b/src/bikes/io/services.py @@ -121,7 +121,7 @@ class RunConfig(pdt.BaseModel, strict=True, frozen=True, extra="forbid"): experiment_name: str = "bikes" # registry registry_name: str = "bikes" - # autologg + # autolog autolog_disable: bool = False autolog_disable_for_unsupported_versions: bool = False autolog_exclusive: bool = False @@ -138,7 +138,7 @@ def start(self) -> None: mlflow.set_registry_uri(uri=self.registry_uri) # experiment mlflow.set_experiment(experiment_name=self.experiment_name) - # autologging + # autolog mlflow.autolog( disable=self.autolog_disable, disable_for_unsupported_versions=self.autolog_disable_for_unsupported_versions, diff --git a/tests/conftest.py b/tests/conftest.py index 24a408a..9c8c4c9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -78,8 +78,8 @@ def extra_config() -> str: { "job": { "mlflow_service": { - "tracking_uri": "${tmp_path:}/experiments/", - "registry_uri": "${tmp_path:}/models/", + "tracking_uri": "${tmp_path:}/tracking/", + "registry_uri": "${tmp_path:}/registry/", } } } diff --git a/tests/io/test_registries.py b/tests/io/test_registries.py index 1002f6a..e05ef18 100644 --- a/tests/io/test_registries.py +++ b/tests/io/test_registries.py @@ -43,7 +43,7 @@ def test_custom_pipeline( saver = registries.CustomSaver(path=path) loader = registries.CustomLoader() register = registries.MlflowRegister(tags=tags) - run_config = services.MlflowService.RunConfig(name="Custom-Run") + run_config = mlflow_service.RunConfig(name="Custom-Run") # when with mlflow_service.run_context(run_config=run_config) as run: info = saver.save(model=model, signature=signature, input_example=inputs) @@ -92,7 +92,7 @@ def test_builtin_pipeline( saver = registries.BuiltinSaver(path=path, flavor=flavor) loader = registries.BuiltinLoader() register = registries.MlflowRegister(tags=tags) - run_config = services.MlflowService.RunConfig(name="Custom-Run") + run_config = mlflow_service.RunConfig(name="Builtin-Run") # when with mlflow_service.run_context(run_config=run_config) as run: info = saver.save(model=model, signature=signature, input_example=inputs) diff --git a/tests/jobs/test_training.py b/tests/jobs/test_training.py index a1cfe10..0c73f46 100644 --- a/tests/jobs/test_training.py +++ b/tests/jobs/test_training.py @@ -15,13 +15,13 @@ def test_training_job( targets_reader: datasets.Reader, model: models.Model, metric: metrics.Metric, - train_test_splitter: splitters.TrainTestSplitter, + train_test_splitter: splitters.Splitter, saver: registries.Saver, signer: signers.Signer, register: registries.Register, ) -> None: # given - run_config = services.MlflowService.RunConfig( + run_config = mlflow_service.RunConfig( name="TrainingTest", tags={"context": "training"}, description="Training job." ) splitter = train_test_splitter diff --git a/tests/jobs/test_tuning.py b/tests/jobs/test_tuning.py index f5d437c..cf7e0cf 100644 --- a/tests/jobs/test_tuning.py +++ b/tests/jobs/test_tuning.py @@ -15,11 +15,11 @@ def test_tuning_job( targets_reader: datasets.Reader, model: models.Model, metric: metrics.Metric, - time_series_splitter: splitters.TimeSeriesSplitter, + time_series_splitter: splitters.Splitter, searcher: searchers.Searcher, ) -> None: # given - run_config = services.MlflowService.RunConfig( + run_config = mlflow_service.RunConfig( name="TuningTest", tags={"context": "tuning"}, description="Tuning job." ) splitter = time_series_splitter diff --git a/tests/utils/test_searchers.py b/tests/utils/test_searchers.py index a39004c..7d2f1ca 100644 --- a/tests/utils/test_searchers.py +++ b/tests/utils/test_searchers.py @@ -11,7 +11,7 @@ def test_grid_cv_searcher( metric: metrics.Metric, inputs: schemas.Inputs, targets: schemas.Targets, - train_test_splitter: splitters.TrainTestSplitter, + train_test_splitter: splitters.Splitter, ) -> None: # given param_grid = {"max_depth": [3, 5, 7]}