Skip to content

Commit

Permalink
Merge branch 'main' into release/kedro-datasets/5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lrcouto authored Oct 10, 2024
2 parents 003b5c8 + 987dab9 commit 0ffc2c1
Show file tree
Hide file tree
Showing 94 changed files with 286 additions and 283 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/kedro-airflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
uses: ./.github/workflows/unit-tests.yml
with:
plugin: kedro-airflow
Expand All @@ -40,7 +40,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
uses: ./.github/workflows/e2e-tests.yml
with:
plugin: kedro-airflow
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/kedro-datasets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
python-version: [ "3.10", "3.11", "3.12" ]
uses: ./.github/workflows/unit-tests.yml
with:
plugin: kedro-datasets
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/kedro-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
uses: ./.github/workflows/unit-tests.yml
with:
plugin: kedro-docker
Expand All @@ -40,7 +40,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
uses: ./.github/workflows/e2e-tests.yml
with:
plugin: kedro-docker
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/kedro-telemetry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
uses: ./.github/workflows/unit-tests.yml
with:
plugin: kedro-telemetry
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ repos:
exclude: ^(?!kedro-airflow/kedro_airflow/).*\.py$
pass_filenames: false
stages: [ manual ]
entry: ruff kedro-airflow --fix --exit-non-zero-on-fix
entry: ruff check kedro-airflow --fix --exit-non-zero-on-fix

- id: ruff-kedro-docker
name: "Ruff on kedro_docker/*"
Expand All @@ -51,7 +51,7 @@ repos:
exclude: ^(?!kedro-docker/kedro_docker/).*\.py$
pass_filenames: false
stages: [ manual ]
entry: ruff kedro-docker --fix --exit-non-zero-on-fix
entry: ruff check kedro-docker --fix --exit-non-zero-on-fix

- id: ruff-kedro-telemetry
name: "Ruff on kedro_telemetry/*"
Expand All @@ -60,7 +60,7 @@ repos:
exclude: ^(?!kedro-telemetry/kedro_telemetry/).*\.py$
pass_filenames: false
stages: [manual]
entry: ruff kedro-telemetry --fix --exit-non-zero-on-fix
entry: ruff check kedro-telemetry --fix --exit-non-zero-on-fix

- id: black-kedro-datasets
name: "Black"
Expand Down
2 changes: 1 addition & 1 deletion kedro-airflow/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Kedro-Airflow

[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Python Version](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue.svg)](https://pypi.org/project/kedro-airflow/)
[![Python Version](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue.svg)](https://pypi.org/project/kedro-airflow/)
[![PyPI Version](https://badge.fury.io/py/kedro-airflow.svg)](https://pypi.org/project/kedro-airflow/)
[![Code Style: Black](https://img.shields.io/badge/code%20style-black-black.svg)](https://github.com/ambv/black)

Expand Down
3 changes: 3 additions & 0 deletions kedro-airflow/RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Upcoming Release

# Release 0.10.0
* Removed support for Python 3.8

# Release 0.9.1
* Added support to specify `--conf-source` which would point to the runtime configuration directory to be used for running the DAG in airflow. This configuration path is added to the generated DAG.

Expand Down
3 changes: 1 addition & 2 deletions kedro-airflow/features/steps/sh_run.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import shlex
import subprocess
from typing import Dict


def run(
cmd: str, split: bool = True, print_output: bool = False, **kwargs: Dict
cmd: str, split: bool = True, print_output: bool = False, **kwargs: dict
) -> int:
"""
Args:
Expand Down
2 changes: 1 addition & 1 deletion kedro-airflow/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ authors = [
{name = "Kedro"}
]
description = "Kedro-Airflow makes it easy to deploy Kedro projects to Airflow"
requires-python = ">=3.8"
requires-python = ">=3.9"
license = {text = "Apache Software License (Apache 2.0)"}
dependencies = [
"kedro>=0.19.0",
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Core datasets are maintained by the [Kedro Technical Steering Committee (TSC)](h
3. Must have working doctests (unless complex cloud/DB setup required, which can be discussed in the review).
4. Must run as part of the regular CI/CD jobs.
5. Must have 100% test coverage.
6. Should support all Python versions under NEP 29 (3.9+ currently).
6. Should support all Python versions under NEP 29 (3.10+ currently).
7. Should work on Linux, macOS, and Windows.

#### Experimental datasets
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- Note that the contents of this file are also used in the documentation, see docs/source/index.md -->

[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Python Version](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue.svg)](https://pypi.org/project/kedro-datasets/)
[![Python Version](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue.svg)](https://pypi.org/project/kedro-datasets/)
[![PyPI Version](https://badge.fury.io/py/kedro-datasets.svg)](https://pypi.org/project/kedro-datasets/)
[![Code Style: Black](https://img.shields.io/badge/code%20style-black-black.svg)](https://github.com/ambv/black)

Expand Down
2 changes: 2 additions & 0 deletions kedro-datasets/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# Release 5.0.0
## Major features and improvements
* Removed support for Python 3.9
* Added the following new **experimental** datasets:

| Type | Description | Location |
Expand Down Expand Up @@ -34,6 +35,7 @@ Many thanks to the following Kedroids for contributing PRs to this release:
* [janickspirig](https://github.com/janickspirig)
* [Galen Seilis](https://github.com/galenseilis)
* [Mariusz Wojakowski](https://github.com/mariusz89016)
* [Felix Scherz](https://github.com/felixscherz)


# Release 4.1.0
Expand Down
3 changes: 1 addition & 2 deletions kedro-datasets/docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@

intersphinx_mapping = {
"kedro": ("https://docs.kedro.org/en/stable/", None),
"python": ("https://docs.python.org/3.9/", None),
"python": ("https://docs.python.org/3.10/", None),
}

type_targets = {
Expand Down Expand Up @@ -145,7 +145,6 @@
),
"py:data": (
"typing.Any",
"typing.Union",
"typing.Optional",
"typing.Tuple",
),
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/kedro_datasets/dask/csv_dataset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""``CSVDataset`` is a data set used to load and save data to CSV files using Dask
"""``CSVDataset`` is a dataset used to load and save data to CSV files using Dask
dataframe"""
from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/kedro_datasets/dask/parquet_dataset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""``ParquetDataset`` is a data set used to load and save data to parquet files using Dask
"""``ParquetDataset`` is a dataset used to load and save data to parquet files using Dask
dataframe"""
from __future__ import annotations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def __init__( # noqa: PLR0913
database: the name of the database.
(also referred to as schema). Defaults to "default".
write_mode: the mode to write the data into the table. If not
present, the data set is read-only.
present, the dataset is read-only.
Options are:["overwrite", "append", "upsert"].
"upsert" mode requires primary_key field to be populated.
Defaults to None.
Expand Down Expand Up @@ -297,7 +297,7 @@ def load(self) -> DataFrame | pd.DataFrame:
the init doesn't exist
Returns:
Union[DataFrame, pd.DataFrame]: Returns a dataframe
DataFrame | pd.DataFrame: Returns a dataframe
in the format defined in the init
"""
if self._version and self._version.load >= 0:
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/geopandas/geojson_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import copy
from pathlib import PurePosixPath
from typing import Any, Union
from typing import Any

import fsspec
import geopandas as gpd
Expand All @@ -21,7 +21,7 @@

class GeoJSONDataset(
AbstractVersionedDataset[
gpd.GeoDataFrame, Union[gpd.GeoDataFrame, dict[str, gpd.GeoDataFrame]]
gpd.GeoDataFrame, gpd.GeoDataFrame | dict[str, gpd.GeoDataFrame]
]
):
"""``GeoJSONDataset`` loads/saves data to a GeoJSON file using an underlying filesystem
Expand Down
6 changes: 3 additions & 3 deletions kedro-datasets/kedro_datasets/matplotlib/matplotlib_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import io
from copy import deepcopy
from pathlib import PurePosixPath
from typing import Any, NoReturn, Union
from typing import Any, NoReturn
from warnings import warn

import fsspec
Expand All @@ -24,7 +24,7 @@


class MatplotlibWriter(
AbstractVersionedDataset[Union[Figure, list[Figure], dict[str, Figure]], NoReturn]
AbstractVersionedDataset[Figure | list[Figure] | dict[str, Figure], NoReturn]
):
"""``MatplotlibWriter`` saves one or more Matplotlib objects as
image files to an underlying filesystem (e.g. local, S3, GCS).
Expand Down Expand Up @@ -203,7 +203,7 @@ def load(self) -> NoReturn:
def save(self, data: Figure | (list[Figure] | dict[str, Figure])) -> None:
save_path = self._get_save_path()

if isinstance(data, (list, dict)) and self._overwrite and self._exists():
if isinstance(data, list | dict) and self._overwrite and self._exists():
self._fs.rm(get_filepath_str(save_path, self._protocol), recursive=True)

if isinstance(data, list):
Expand Down
6 changes: 3 additions & 3 deletions kedro-datasets/kedro_datasets/pandas/excel_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
from copy import deepcopy
from pathlib import PurePosixPath
from typing import Any, Union
from typing import Any

import fsspec
import pandas as pd
Expand All @@ -26,8 +26,8 @@

class ExcelDataset(
AbstractVersionedDataset[
Union[pd.DataFrame, dict[str, pd.DataFrame]],
Union[pd.DataFrame, dict[str, pd.DataFrame]],
pd.DataFrame | dict[str, pd.DataFrame],
pd.DataFrame | dict[str, pd.DataFrame],
]
):
"""``ExcelDataset`` loads/saves data from/to a Excel file using an underlying
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/kedro_datasets/pandas/feather_dataset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""``FeatherDataset`` is a data set used to load and save data to feather files
"""``FeatherDataset`` is a dataset used to load and save data to feather files
using an underlying filesystem (e.g.: local, S3, GCS). The underlying functionality
is supported by pandas, so it supports all operations the pandas supports.
"""
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/kedro_datasets/pandas/sql_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ class SQLQueryDataset(AbstractDataset[None, pd.DataFrame]):
by SQLAlchemy can be found here:
https://docs.sqlalchemy.org/core/engines.html#database-urls
It does not support save method so it is a read only data set.
It does not support save method so it is a read only dataset.
To save data to a SQL server use ``SQLTableDataset``.
Example usage for the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
from __future__ import annotations

import operator
from collections.abc import Callable
from copy import deepcopy
from typing import Any, Callable
from typing import Any

from cachetools import cachedmethod
from kedro.io.core import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
from __future__ import annotations

import operator
from collections.abc import Callable
from copy import deepcopy
from pathlib import PurePosixPath
from typing import Any, Callable
from typing import Any
from urllib.parse import urlparse
from warnings import warn

Expand Down
6 changes: 2 additions & 4 deletions kedro-datasets/kedro_datasets/plotly/html_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from copy import deepcopy
from pathlib import PurePosixPath
from typing import Any, NoReturn, Union
from typing import Any, NoReturn

import fsspec
from kedro.io.core import (
Expand All @@ -18,9 +18,7 @@
from plotly import graph_objects as go


class HTMLDataset(
AbstractVersionedDataset[go.Figure, Union[go.Figure, go.FigureWidget]]
):
class HTMLDataset(AbstractVersionedDataset[go.Figure, go.Figure | go.FigureWidget]):
"""``HTMLDataset`` saves a plotly figure to an HTML file using an
underlying filesystem (e.g.: local, S3, GCS).
Expand Down
6 changes: 2 additions & 4 deletions kedro-datasets/kedro_datasets/plotly/json_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import json
from copy import deepcopy
from pathlib import PurePosixPath
from typing import Any, Union
from typing import Any

import fsspec
import plotly.io as pio
Expand All @@ -21,9 +21,7 @@
from kedro_datasets._typing import PlotlyPreview


class JSONDataset(
AbstractVersionedDataset[go.Figure, Union[go.Figure, go.FigureWidget]]
):
class JSONDataset(AbstractVersionedDataset[go.Figure, go.Figure | go.FigureWidget]):
"""``JSONDataset`` loads/saves a plotly figure from/to a JSON file using an
underlying filesystem (e.g.: local, S3, GCS).
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/polars/lazy_polars_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import logging
from copy import deepcopy
from pathlib import PurePosixPath
from typing import Any, ClassVar, Union
from typing import Any, ClassVar

import fsspec
import polars as pl
Expand All @@ -22,7 +22,7 @@

ACCEPTED_FILE_FORMATS = ["csv", "parquet"]

PolarsFrame = Union[pl.LazyFrame, pl.DataFrame]
PolarsFrame = pl.LazyFrame | pl.DataFrame

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/kedro_datasets/spark/spark_hive_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class SparkHiveDataset(AbstractDataset[DataFrame, DataFrame]):
"""``SparkHiveDataset`` loads and saves Spark dataframes stored on Hive.
This data set also handles some incompatible file types such as using partitioned parquet on
This dataset also handles some incompatible file types such as using partitioned parquet on
hive which will not normally allow upserts to existing data without a complete replacement
of the existing file/partition.
Expand Down
4 changes: 2 additions & 2 deletions kedro-datasets/kedro_datasets/svmlight/svmlight_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from copy import deepcopy
from pathlib import PurePosixPath
from typing import Any, Union
from typing import Any

import fsspec
from kedro.io.core import (
Expand All @@ -25,7 +25,7 @@
# in kedro-plugins (https://github.com/kedro-org/kedro-plugins)

# Type of data input
_DI = tuple[Union[ndarray, csr_matrix], ndarray]
_DI = tuple[ndarray | csr_matrix, ndarray]
# Type of data output
_DO = tuple[csr_matrix, ndarray]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _describe(self) -> dict[str, Any]:
return {**self.kwargs}

def save(self, data: None) -> NoReturn:
raise DatasetError(f"{self.__class__.__name__} is a read only data set type")
raise DatasetError(f"{self.__class__.__name__} is a read only dataset type")

def load(self) -> ChatAnthropic:
return ChatAnthropic(
Expand Down
Loading

0 comments on commit 0ffc2c1

Please sign in to comment.