Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade python to 3.12 #31

Merged
merged 1 commit into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "[email protected]:bl-sdk/common_dotfiles.git",
"commit": "fb06ff8c773806b3f8cc69dbda60c0a7b481c6de",
"commit": "e5fa8d6e372d18cb22415511cc02831cc706e061",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
23 changes: 8 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:
XWIN_VERSION: xwin-0.5.0-x86_64-unknown-linux-musl
XWIN_DOWNLOAD: https://github.com/Jake-Shadle/xwin/releases/download/0.5.0/xwin-0.5.0-x86_64-unknown-linux-musl.tar.gz
# Python settings
PYTHON_VERSION: "3.11.5"
PYTHON_VERSION: "3.12.1"

jobs:
cache-clang:
Expand Down Expand Up @@ -322,19 +322,6 @@ jobs:
- name: Check spelling
uses: crate-ci/typos@master

black:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Check formatting
uses: psf/black@stable
with:
options: --check --verbose
src: ./stubs

pyright:
runs-on: ubuntu-latest

Expand All @@ -356,7 +343,13 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Run Ruff
- name: Run Ruff Linting
uses: chartboost/ruff-action@v1
with:
src: ./stubs

- name: Run Ruff Formatting
uses: chartboost/ruff-action@v1
with:
src: ./stubs
args: format --check
32 changes: 26 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
[tool.black]
target-version = ["py311"]
line-length = 100

[tool.pyright]
pythonVersion = "3.11"
pythonVersion = "3.12"
typeCheckingMode = "strict"

include = ["stubs"]

[tool.ruff]
target-version = "py311"
target-version = "py312"
line-length = 100
select = [
"F",
Expand All @@ -23,13 +19,17 @@ select = [
"YTT",
"ANN",
"ASYNC",
"S",
"BLE",
"B",
"A",
"COM",
"C4",
"DTZ",
"T10",
"FA",
"ISC",
"ICN",
"G",
"PIE",
"PYI",
Expand All @@ -39,11 +39,19 @@ select = [
"SLOT",
"SIM",
"TID",
"TCH",
"INT",
"ARG",
"PTH",
"TD",
"FIX",
"ERA",
"PGH",
"PL",
"FLY",
"PERF",
"FURB",
"LOG",
"RUF",
]
ignore = [
Expand All @@ -67,11 +75,23 @@ ignore = [
"ANN101",
"ANN102",
"ANN401",
"S101",
"S603",
"S607",
"PYI011",
"PYI021",
"PYI029",
"PYI044",
"PGH003",
"PLR0904",
"PLR0911",
"PLR0912",
"PLR0913",
"PLR0915",
"PLR6301",
"PLW0603",
"PLW2901",
"FURB140",
]

[tool.ruff.per-file-ignores]
Expand Down
4 changes: 2 additions & 2 deletions stubs/unrealsdk/commands/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from collections.abc import Callable
from typing import Final, TypeAlias
from typing import Final

__all__: tuple[str, ...] = (
"NEXT_LINE",
Expand All @@ -12,7 +12,7 @@ __all__: tuple[str, ...] = (

NEXT_LINE: Final[str] = ...

_CommandCallback: TypeAlias = Callable[[str, int], None]
type _CommandCallback = Callable[[str, int], None]

def add_command(cmd: str, callback: _CommandCallback) -> None:
"""
Expand Down
20 changes: 11 additions & 9 deletions stubs/unrealsdk/hooks/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# ruff: noqa: D205, FIX004

from __future__ import annotations

from collections.abc import Callable
from enum import EnumMeta
from types import EllipsisType
from typing import Any, ClassVar, Literal, TypeAlias, overload
from typing import Any, ClassVar, Literal, overload

from unrealsdk.unreal import BoundFunction, UObject, WrappedStruct

Expand All @@ -22,7 +24,7 @@ class Block:
"""
A sentinel used to indicate a hook should block execution of the unrealscript
function.
""" # noqa: D205
"""

# HACK: Pybind enums are completely normal classes, they don't inherit from the standard library
# enums, which means we're not allowed to use them in Literal type hints.
Expand Down Expand Up @@ -67,17 +69,17 @@ class Unset:
"""
A sentinel used to indicate a return value override is unset - i.e. the actual
return value will be used.
""" # noqa: D205
"""

_HookBlockSignal: TypeAlias = None | EllipsisType | Block | type[Block]
_PreHookCallback: TypeAlias = Callable[
type _HookBlockSignal = None | EllipsisType | Block | type[Block]
type _PreHookCallback = Callable[
[UObject, WrappedStruct, Any, BoundFunction],
_HookBlockSignal | tuple[_HookBlockSignal, Any],
]
_PostHookCallback: TypeAlias = Callable[[UObject, WrappedStruct, Any, BoundFunction], None]
type _PostHookCallback = Callable[[UObject, WrappedStruct, Any, BoundFunction], None]

_PreHookType: TypeAlias = Literal[Type.PRE]
_PostHookType: TypeAlias = Literal[Type.POST, Type.POST_UNCONDITIONAL]
type _PreHookType = Literal[Type.PRE]
type _PostHookType = Literal[Type.POST, Type.POST_UNCONDITIONAL]

@overload
def add_hook(
Expand Down Expand Up @@ -170,7 +172,7 @@ def log_all_calls(should_log: bool) -> None:

Args:
should_log: True to turn on logging all calls, false to turn it off.
""" # noqa: D205
"""

def remove_hook(func: str, type: Type, identifier: str) -> bool:
"""
Expand Down
12 changes: 7 additions & 5 deletions stubs/unrealsdk/logging/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# ruff: noqa: D205

from __future__ import annotations

from typing import Any, ClassVar
Expand Down Expand Up @@ -87,7 +89,7 @@ def dev_warning(*args: Any, **kwargs: Any) -> None:
Args:
*args: Forwarded to print().
**kwargs: Forwarded to print().
""" # noqa: D205
"""

def error(*args: Any, **kwargs: Any) -> None:
"""
Expand All @@ -97,7 +99,7 @@ def error(*args: Any, **kwargs: Any) -> None:
Args:
*args: Forwarded to print().
**kwargs: Forwarded to print().
""" # noqa: D205
"""

def info(*args: Any, **kwargs: Any) -> None:
"""
Expand All @@ -107,7 +109,7 @@ def info(*args: Any, **kwargs: Any) -> None:
Args:
*args: Forwarded to print().
**kwargs: Forwarded to print().
""" # noqa: D205
"""

def is_console_ready() -> bool:
"""
Expand All @@ -127,7 +129,7 @@ def misc(*args: Any, **kwargs: Any) -> None:
Args:
*args: Forwarded to print().
**kwargs: Forwarded to print().
""" # noqa: D205
"""

def set_console_level(level: Level) -> bool:
"""
Expand All @@ -149,4 +151,4 @@ def warning(*args: Any, **kwargs: Any) -> None:
Args:
*args: Forwarded to print().
**kwargs: Forwarded to print().
""" # noqa: D205
"""
4 changes: 3 additions & 1 deletion stubs/unrealsdk/unreal/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# ruff: noqa: D205

from __future__ import annotations

from ._bound_function import BoundFunction
Expand Down Expand Up @@ -80,4 +82,4 @@ def dir_includes_unreal(should_include: bool) -> None:

Args:
should_include: True if to include dynamic properties, false to not.
""" # noqa: D205
"""
Loading
Loading