Skip to content

Commit

Permalink
chore: remove support for python 3.9 (#870)
Browse files Browse the repository at this point in the history
* chore: remove support for python 3.9

Signed-off-by: Felix Scherz <[email protected]>

* chore: remove Union in favor of | operator

Signed-off-by: Felix Scherz <[email protected]>

* chore: use collections.abc.Callable instead of typing.Callable

Signed-off-by: Felix Scherz <[email protected]>

* chore: remove python 3.9 from CI

Signed-off-by: Felix Scherz <[email protected]>

* docs: document removal of python 3.9 support

Signed-off-by: Felix Scherz <[email protected]>

* chore: use `|` in favor of tuples for isinstance checks

Signed-off-by: Felix Scherz <[email protected]>

* chore: run formatter

Signed-off-by: Felix Scherz <[email protected]>

* chore: remove environment markers for python 3.9

Signed-off-by: Felix Scherz <[email protected]>

* docs: add to contributer list

Signed-off-by: Felix Scherz <[email protected]>

---------

Signed-off-by: Felix Scherz <[email protected]>
  • Loading branch information
felixscherz authored Oct 10, 2024
1 parent 9f9c1c3 commit 62a5808
Show file tree
Hide file tree
Showing 18 changed files with 31 additions and 37 deletions.
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
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
@@ -1,5 +1,6 @@
# Upcoming Release
## Major features and improvements
* Removed support for Python 3.9
* Added the following new **experimental** datasets:

| Type | Description | Location |
Expand Down Expand Up @@ -31,6 +32,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
Original file line number Diff line number Diff line change
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
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
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
5 changes: 2 additions & 3 deletions kedro-datasets/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ authors = [
{name = "Kedro"}
]
description = "Kedro-Datasets is where you can find all of Kedro's data connectors."
requires-python = ">=3.9"
requires-python = ">=3.10"
license = {text = "Apache Software License (Apache 2.0)"}
dependencies = [
"kedro>=0.19.7",
Expand Down Expand Up @@ -227,8 +227,7 @@ test = [
"jupyterlab>=3.0",
"jupyter~=1.0",
"lxml~=4.6",
"matplotlib>=3.0.3, <3.4; python_version < '3.10'", # 3.4.0 breaks holoviews
"matplotlib>=3.5, <3.6; python_version >= '3.10'",
"matplotlib>=3.5, <3.6",
"memory_profiler>=0.50.0, <1.0",
"moto==5.0.0",
"mypy~=1.0",
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
https://docs.pytest.org/en/latest/fixture.html
"""

from typing import Callable
from collections.abc import Callable
from unittest.mock import MagicMock

import aiobotocore.awsrequest
Expand Down
6 changes: 1 addition & 5 deletions kedro-datasets/tests/spark/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
import pytest
from delta import configure_spark_with_delta_pip
from filelock import FileLock

try:
from pyspark.sql import SparkSession
except ImportError: # pragma: no cover
pass # this is only for test discovery to succeed on Python 3.8, 3.9
from pyspark.sql import SparkSession


def _setup_spark_session():
Expand Down

0 comments on commit 62a5808

Please sign in to comment.