Skip to content

Commit

Permalink
Merge pull request #492 from gdsfactory/py310-backport
Browse files Browse the repository at this point in the history
Py310 backport
  • Loading branch information
sebastian-goeldi authored Oct 12, 2024
2 parents 413701d + 0dbbaa1 commit b90b146
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 16 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/test_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
cache: "pip"
cache-dependency-path: pyproject.toml
- name: setup-mypy
Expand All @@ -28,7 +28,10 @@ jobs:
strategy:
max-parallel: 12
matrix:
python-version: ["3.11", "3.12"]
python-version:
- "3.10"
- "3.11"
- "3.12"
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
Expand All @@ -54,7 +57,8 @@ jobs:
strategy:
max-parallel: 12
matrix:
python-version: ["3.11", "3.12"]
python-version:
- "3.12"
os: [ubuntu-latest]

steps:
Expand Down
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ description = "KLayout API implementation of gdsfactory"
readme = "README.md"
classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: OS Independent",
]
requires-python = ">=3.11"
requires-python = ">=3.10"


version = "0.21.0"
Expand Down Expand Up @@ -84,7 +86,7 @@ kf = "kfactory.cli:app"
where = ["src"]

[tool.mypy]
python_version = "3.11"
python_version = "3.10"
strict = true
exclude = [
"src/kfactory/widgets/interactive.py",
Expand Down Expand Up @@ -116,7 +118,7 @@ fix = true
line-length = 88
exclude = ["tests", "docs", "src/kfactory/widgets/interactive.py"]
indent-width = 4
target-version = "py311"
target-version = "py310"

[tool.ruff.lint]
select = [
Expand Down
4 changes: 2 additions & 2 deletions src/kfactory/cli/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import os
import runpy
import sys
from enum import StrEnum
from enum import Enum
from pathlib import Path
from typing import Annotated, Optional

Expand Down Expand Up @@ -40,7 +40,7 @@ def show(
kfshow(path, use_libraries=True)


class LayoutSuffix(StrEnum):
class LayoutSuffix(str, Enum):
gds = "gds"
gdsgz = "gds.gz"
oas = "oas"
Expand Down
6 changes: 3 additions & 3 deletions src/kfactory/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import re
import sys
import traceback
from enum import StrEnum
from enum import Enum
from itertools import takewhile
from pathlib import Path
from typing import TYPE_CHECKING, Any, Literal, Protocol, cast, runtime_checkable
Expand Down Expand Up @@ -74,7 +74,7 @@ def tracing_formatter(record: loguru.Record) -> str:
)


class LogLevel(StrEnum):
class LogLevel(str, Enum):
"""KFactory logger levels."""

TRACE = "TRACE"
Expand All @@ -86,7 +86,7 @@ class LogLevel(StrEnum):
CRITICAL = "CRITICAL"


class CHECK_INSTANCES(StrEnum):
class CHECK_INSTANCES(str, Enum):
RAISE = "error"
FLATTEN = "flatten"
VINSTANCES = "vinstances"
Expand Down
3 changes: 2 additions & 1 deletion src/kfactory/cross_section.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
from __future__ import annotations

from functools import cached_property
from typing import TYPE_CHECKING, Self
from typing import TYPE_CHECKING

from pydantic import BaseModel, model_validator
from typing_extensions import Self

from . import kdb
from .enclosure import DLayerEnclosure, LayerEnclosure
Expand Down
3 changes: 2 additions & 1 deletion src/kfactory/enclosure.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
from enum import IntEnum
from functools import lru_cache
from hashlib import sha1
from typing import TYPE_CHECKING, Any, NotRequired, TypedDict, TypeGuard, overload
from typing import TYPE_CHECKING, Any, TypeGuard, overload

import numpy as np
from pydantic import BaseModel, Field, PrivateAttr, field_validator, model_serializer
from typing_extensions import NotRequired, TypedDict

from . import kdb
from .conf import config, logger
Expand Down
4 changes: 1 addition & 3 deletions src/kfactory/kcell.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@
Annotated,
Any,
Literal,
NotRequired,
Protocol,
TypeAlias,
TypedDict,
TypeVar,
cast,
get_origin,
Expand All @@ -57,7 +55,7 @@
ValidationError,
model_validator,
)
from typing_extensions import ParamSpec, Self # noqa: UP035
from typing_extensions import NotRequired, ParamSpec, Self, TypedDict

from . import __version__, kdb, lay, rdb
from .conf import CHECK_INSTANCES, LogLevel, config, logger
Expand Down

0 comments on commit b90b146

Please sign in to comment.