Skip to content

Commit

Permalink
Remove Python 3 8 support (#164)
Browse files Browse the repository at this point in the history
* remove python 3.8 support

* linting changes

---------

Co-authored-by: Baris Can Durak <[email protected]>
  • Loading branch information
strickvl and bcdurak authored Oct 9, 2024
1 parent 8c2a9e7 commit 43b48c6
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 70 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,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"]
fail-fast: false
uses: ./.github/workflows/setup-python-environment.yml
with:
Expand All @@ -38,7 +38,7 @@ jobs:
strategy:
matrix:
os: [windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
fail-fast: false
uses: ./.github/workflows/setup-python-environment.yml
with:
Expand All @@ -51,7 +51,7 @@ jobs:
strategy:
matrix:
os: [macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
fail-fast: false
uses: ./.github/workflows/setup-python-environment.yml
with:
Expand All @@ -64,7 +64,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"]
fail-fast: false
uses: ./.github/workflows/lint-unit-test.yml
with:
Expand All @@ -77,7 +77,7 @@ jobs:
strategy:
matrix:
os: [windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
fail-fast: false
uses: ./.github/workflows/lint-unit-test.yml
with:
Expand All @@ -90,7 +90,7 @@ jobs:
strategy:
matrix:
os: [macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
fail-fast: false
uses: ./.github/workflows/lint-unit-test.yml
with:
Expand Down
19 changes: 3 additions & 16 deletions .github/workflows/lint-unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@ on:
description: 'Python version'
type: choice
options:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
required: false
default: '3.8'
default: '3.9'
enable_tmate:
description: 'Enable tmate session for debugging'
type: choice
Expand Down Expand Up @@ -86,20 +85,8 @@ jobs:
- name: Docstring check
run: bash scripts/docstring.sh
# Only run the docstring check on ubuntu-latest and python 3.8
if: ${{ inputs.os == 'ubuntu-latest' && inputs.python-version == '3.8' }}

# - name: Markdown link check
# uses: gaurav-nelson/github-action-markdown-link-check@v1
# with:
# use-quiet-mode: 'yes'
# use-verbose-mode: 'no'
# folder-path: './examples, ./docs/book, ./src'
# file-path: './README.md, ./LICENSE, ./RELEASE_NOTES.md, CODE-OF-CONDUCT.md, CONTRIBUTING.md, CLA.md, RELEASE_NOTES.md, ROADMAP.md'
# config-file: .github/workflows/markdown_check_config.json
# continue-on-error: true
# # Only run the markdown link check on ubuntu-latest and python 3.8
# if: ${{ inputs.os == 'ubuntu-latest' && inputs.python-version == '3.8' }}
# Only run the docstring check on ubuntu-latest and python 3.9
if: ${{ inputs.os == 'ubuntu-latest' && inputs.python-version == '3.9' }}

- name: Run unit tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-pypi-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set up Python
uses: actions/[email protected]
with:
python-version: "3.8"
python-version: "3.9"
- name: Install Poetry
uses: snok/[email protected]
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
uses: ./.github/workflows/lint-unit-test.yml
with:
os: "ubuntu-latest"
python-version: "3.8"
python-version: "3.9"
secrets: inherit

# checks zenml and mlstacks can be installed together in same environment
Expand All @@ -25,7 +25,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "3.9"

- name: Install current package as editable
run: pip install -e .
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ classifiers = [
"Intended Audience :: System Administrators",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down Expand Up @@ -64,7 +63,7 @@ exclude = [
]

[tool.poetry.dependencies]
python = ">=3.8,<3.13"
python = ">=3.9,<3.13"
pydantic = { version = "~2.8" }
pyyaml = { version = ">=6.0.1" }
click = { version = "^8.0.1,<8.1.4" }
Expand Down Expand Up @@ -164,8 +163,8 @@ select = [
ignore = ["COM812", "ISC001"]

src = ["src", "tests"]
# use Python 3.8 as the minimum version for autofixing
target-version = "py38"
# use Python 3.9 as the minimum version for autofixing
target-version = "py39"
ignore-init-module-imports = true
# # Disable autofix for unused imports (`F401`).
# unfixable = ["F401"]
Expand Down
14 changes: 7 additions & 7 deletions src/mlstacks/analytics/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import logging
import os
from types import TracebackType
from typing import Any, Dict, List, Optional, Type, cast
from typing import Any, Optional, cast
from uuid import uuid4

import click
Expand All @@ -41,7 +41,7 @@
CONFIG_FILENAME = "config.yaml"


def on_error(error: Exception, batch: List[Dict[str, Any]]) -> None:
def on_error(error: Exception, batch: list[dict[str, Any]]) -> None:
"""Custom error handler for Segment analytics.
Args:
Expand Down Expand Up @@ -88,7 +88,7 @@ def __enter__(self) -> "MLStacksAnalyticsContext":

def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_type: Optional[type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> bool:
Expand All @@ -109,7 +109,7 @@ def __exit__(
def track(
self,
event: AnalyticsEventsEnum,
properties: Optional[Dict[Any, Any]] = None,
properties: Optional[dict[Any, Any]] = None,
) -> Any:
"""Tracks event in Segment.
Expand Down Expand Up @@ -168,7 +168,7 @@ def set_analytics_user_id(user_id: str) -> None:

def track_event(
event: AnalyticsEventsEnum,
metadata: Optional[Dict[str, Any]] = None,
metadata: Optional[dict[str, Any]] = None,
) -> bool:
"""Track segment event if user opted-in.
Expand All @@ -195,7 +195,7 @@ class EventHandler:
def __init__(
self,
event: AnalyticsEventsEnum,
metadata: Optional[Dict[str, Any]] = None,
metadata: Optional[dict[str, Any]] = None,
):
"""Initialization of the context manager.
Expand All @@ -204,7 +204,7 @@ def __init__(
metadata: The metadata of the event.
"""
self.event: AnalyticsEventsEnum = event
self.metadata: Dict[str, Any] = metadata or {}
self.metadata: dict[str, Any] = metadata or {}

def __enter__(self) -> "EventHandler":
"""Enter function of the event handler.
Expand Down
4 changes: 1 addition & 3 deletions src/mlstacks/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# permissions and limitations under the License.
"""MLStacks constants."""

from typing import Dict, List

MLSTACKS_PACKAGE_NAME = "mlstacks"
MLSTACKS_INITIALIZATION_FILE_FLAG = "IGNORE_ME"
MLSTACKS_STACK_COMPONENT_FLAGS = [
Expand Down Expand Up @@ -41,7 +39,7 @@
"model_deployer": ["seldon"],
"step_operator": ["sagemaker", "vertex"],
}
ALLOWED_COMPONENT_TYPES: Dict[str, Dict[str, List[str]]] = {
ALLOWED_COMPONENT_TYPES: dict[str, dict[str, list[str]]] = {
"aws": {
"artifact_store": ["s3"],
"container_registry": ["aws"],
Expand Down
6 changes: 3 additions & 3 deletions src/mlstacks/models/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# permissions and limitations under the License.
"""Component model."""

from typing import Dict, Optional
from typing import Optional

from pydantic import BaseModel, field_validator, model_validator

Expand Down Expand Up @@ -43,8 +43,8 @@ class ComponentMetadata(BaseModel):
environment_variables: The environment variables for the component.
"""

config: Optional[Dict[str, str]] = None
environment_variables: Optional[Dict[str, str]] = None
config: Optional[dict[str, str]] = None
environment_variables: Optional[dict[str, str]] = None


class Component(BaseModel):
Expand Down
6 changes: 3 additions & 3 deletions src/mlstacks/models/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# permissions and limitations under the License.
"""Stack model."""

from typing import Dict, List, Optional
from typing import Optional

from pydantic import BaseModel, field_validator

Expand Down Expand Up @@ -46,11 +46,11 @@ class Stack(BaseModel):
name: str
provider: ProviderEnum
default_region: Optional[str] = None
default_tags: Optional[Dict[str, str]] = None
default_tags: Optional[dict[str, str]] = None
deployment_method: Optional[DeploymentMethodEnum] = (
DeploymentMethodEnum.KUBERNETES
)
components: List[Component] = []
components: list[Component] = []

@field_validator("name")
@classmethod
Expand Down
6 changes: 3 additions & 3 deletions src/mlstacks/utils/cli_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"""CLI utilities for mlstacks."""

from pathlib import Path
from typing import TYPE_CHECKING, Any, Dict, List, NoReturn, Optional, Union
from typing import TYPE_CHECKING, Any, NoReturn, Optional, Union

import click
from rich import box, table
Expand Down Expand Up @@ -138,7 +138,7 @@ def print_markdown_with_pager(text: str) -> None:


def print_table(
obj: List[Dict[str, Any]],
obj: list[dict[str, Any]],
title: Optional[str] = None,
caption: Optional[str] = None,
**columns: table.Column,
Expand Down Expand Up @@ -189,7 +189,7 @@ def print_table(


def pretty_print_output_vals(
output_vals: Dict[str, str],
output_vals: dict[str, str],
) -> None:
"""Prints dictionary values as a rich table.
Expand Down
Loading

0 comments on commit 43b48c6

Please sign in to comment.