diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 8aee9e31..592c24bd 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -17,6 +17,7 @@ on: - "thirdparty/**" - "tests/**" - ".github/workflows/CI*" + workflow_dispatch: jobs: test: @@ -27,7 +28,7 @@ jobs: strategy: matrix: - python-version: ["3.8", "3.11"] + python-version: ["3.8", "3.11", "3.12"] steps: - name: Checkout develop diff --git a/.github/workflows/Publish.yml b/.github/workflows/Publish.yml index 4d3b79d9..381e69ce 100644 --- a/.github/workflows/Publish.yml +++ b/.github/workflows/Publish.yml @@ -18,10 +18,7 @@ jobs: - uses: actions/checkout@v3 - name: Build wheels - uses: pypa/cibuildwheel@v2.15.0 - env: - CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* pp38-* pp39-* pp310-*" - CIBW_SKIP: "*-win32 *_i686 *_s390x *_ppc64le" + uses: pypa/cibuildwheel@v2.16.2 - uses: actions/upload-artifact@v3 with: diff --git a/aiotieba/__version__.py b/aiotieba/__version__.py index 221485ae..035c71bf 100644 --- a/aiotieba/__version__.py +++ b/aiotieba/__version__.py @@ -1 +1 @@ -__version__ = "3.7.3" +__version__ = "3.7.4" diff --git a/aiotieba/api/get_threads/_classdef.py b/aiotieba/api/get_threads/_classdef.py index 9e14676b..1757a034 100644 --- a/aiotieba/api/get_threads/_classdef.py +++ b/aiotieba/api/get_threads/_classdef.py @@ -1230,10 +1230,14 @@ def __init__(self, data_proto: TypeMessage) -> None: self._is_hide = bool(data_proto.is_frs_mask) self._is_livepost = bool(data_proto.is_livepost) self._vote_info = VoteInfo()._init(data_proto.poll_info) - if not self._is_share: - self._share_origin = ShareThread()._init_null() + if self._is_share: + if data_proto.origin_thread_info.pid: + self._share_origin = ShareThread()._init(data_proto.origin_thread_info) + else: + self._is_share = False + self._share_origin = ShareThread()._init_null() else: - self._share_origin = ShareThread()._init(data_proto.origin_thread_info) + self._share_origin = ShareThread()._init_null() self._view_num = data_proto.view_num self._reply_num = data_proto.reply_num self._share_num = data_proto.share_num diff --git a/aiotieba/const.py b/aiotieba/const.py index c1d236dc..ac4581bf 100644 --- a/aiotieba/const.py +++ b/aiotieba/const.py @@ -1,4 +1,4 @@ -MAIN_VERSION = "12.49.1.0" +MAIN_VERSION = "12.50.0.0" POST_VERSION = "12.35.1.0" APP_SECURE_SCHEME = "https" diff --git a/aiotieba/helper/utils.py b/aiotieba/helper/utils.py index be03e0da..e91dfc29 100644 --- a/aiotieba/helper/utils.py +++ b/aiotieba/helper/utils.py @@ -5,7 +5,10 @@ from types import FrameType from typing import Any, Callable -import async_timeout +if sys.version_info >= (3, 11): + import asyncio as async_timeout +else: + import async_timeout from ..exception import exc_handlers from ..logging import get_logger diff --git a/pyproject.toml b/pyproject.toml index ad9d9e2d..8224bc99 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,19 +19,22 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Internet :: WWW/HTTP :: Session", ] -requires-python = ">=3.8" +requires-python = ">=3.8,<3.13" dependencies = [ - "aiohttp<3.9,>=3.8.4;python_version=='3.8'", - "aiohttp<4,>=3.8.4;python_version>='3.9'", # See https://github.com/aio-libs/aiohttp/pull/6638 + "aiohttp<3.10,>=3.8.4;python_version=='3.8'", + "aiohttp<4,>=3.8.4;python_version>='3.9' and python_version<'3.12'", + "aiohttp<4,>=3.9.0b0;python_version>='3.12'", "beautifulsoup4<4.13,>=4.4.1;python_version=='3.8'", "beautifulsoup4<5,>=4.5.2;python_version=='3.9'", "beautifulsoup4<5,>=4.7.1;python_version>='3.10'", "lxml<4.10,>=4.4.1;python_version=='3.8'", "lxml<5,>=4.6.0;python_version=='3.9'", "lxml<5,>=4.6.4;python_version=='3.10'", - "lxml<5,>=4.9.2;python_version>='3.11'", + "lxml<5,>=4.9.2;python_version=='3.11'", + "lxml<5,>=4.9.3;python_version>='3.12'", "protobuf<5,>=4.21.0", "pycryptodome<3.19,>=3.7.1;python_version=='3.8'", "pycryptodome<4,>=3.7.1;python_version>='3.8'", @@ -41,8 +44,8 @@ dynamic = ["version"] [project.optional-dependencies] img = [ - "opencv-contrib-python-headless<4.9,>=4.6.0.66;sys_platform=='linux'", - "opencv-contrib-python<4.9,>=4.6.0.66;sys_platform!='linux'", + "opencv-contrib-python-headless<4.10,>=4.6.0.66;sys_platform=='linux'", + "opencv-contrib-python<4.10,>=4.6.0.66;sys_platform!='linux'", ] speedup = [ "aiodns<4,>=3.0.0", @@ -53,11 +56,12 @@ speedup = [ "pysimdjson<6,>=3.1.1;python_version=='3.9' and sys_platform=='darwin'", "pysimdjson<6,>=3.1.1;python_version=='3.9'", "pysimdjson<6,>=4.0.3;python_version=='3.10'", - "pysimdjson<6,>=5.0.1;python_version>='3.11'", - "uvloop<0.20,>=0.14.0;python_version=='3.8' and sys_platform!='win32'", - "uvloop<0.20,>=0.15.0;python_version=='3.9' and sys_platform!='win32'", - "uvloop<0.20,>=0.16.0;python_version=='3.10' and sys_platform!='win32'", - "uvloop<0.20,>=0.17.0;python_version>='3.11' and sys_platform!='win32'", + "pysimdjson<6,>=5.0.1;python_version=='3.11'", # pysimdjson does not support 3.12 (2023.11.03) + "uvloop<0.20.0,>=0.14.0;python_version=='3.8' and sys_platform!='win32'", + "uvloop<1.0,>=0.15.0;python_version=='3.9' and sys_platform!='win32'", + "uvloop<1.0,>=0.16.0;python_version=='3.10' and sys_platform!='win32'", + "uvloop<1.0,>=0.17.0;python_version=='3.11' and sys_platform!='win32'", + "uvloop<1.0,>=0.18.0;python_version>='3.12' and sys_platform!='win32'", ] [tool.setuptools.packages.find] @@ -69,15 +73,22 @@ version = { attr = "aiotieba.__version__.__version__" } [tool.setuptools.package-data] "*" = ["*.pyi"] +[tool.pdm] +allow_prereleases = true + [tool.pdm.dev-dependencies] lint = ["ruff", "black"] test = ["aiotieba[speedup]", "pytest", "pytest-asyncio", "pytest-rerunfailures"] doc = ["mkdocs-material", "mkdocstrings[python]"] +[tool.cibuildwheel] +build = "cp38-* cp39-* cp310-* cp311-* cp312-* pp38-* pp39-* pp310-*" +skip = "*-win32 *_i686 *_s390x *_ppc64le" + [tool.black] line-length = 120 skip-string-normalization = true -target-version = ["py38", "py39", "py310", "py311"] +target-version = ["py38", "py39", "py310", "py311", "py312"] [tool.ruff] line-length = 120