diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ede389e..54e22a9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -52,7 +52,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python_version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12.0-rc.2"] + python_version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] include: - os: ubuntu-20.04 python_version: "3.6" diff --git a/requirements.txt b/requirements.txt index 8adde75..db98340 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ confection>=0.0.4,<0.2.0 wasabi>=0.9.1,<1.2.0 srsly>=2.4.3,<3.0.0 typer>=0.3.0,<0.10.0 -cloudpathlib>=0.7.0,<0.16.0 +cloudpathlib>=0.7.0,<0.17.0 smart-open>=5.2.1,<7.0.0 # Third party dependencies requests>=2.13.0,<3.0.0 @@ -13,7 +13,7 @@ packaging>=20.0 # Development dependencies black==22.3.0 pytest>=5.2.0,!=7.1.0 -mypy>=0.990,<1.1.0; platform_machine != "aarch64" and python_version >= "3.7" +mypy>=1.5.0,<1.7.0; python_version >= "3.8" types-requests types-setuptools>=57.0.0 ruff>=0.0.259; python_version > "3.6" diff --git a/setup.cfg b/setup.cfg index 6b4860e..1dce966 100644 --- a/setup.cfg +++ b/setup.cfg @@ -37,7 +37,7 @@ install_requires = wasabi>=0.9.1,<1.2.0 srsly>=2.4.3,<3.0.0 typer>=0.3.0,<0.10.0 - cloudpathlib>=0.7.0,<0.16.0 + cloudpathlib>=0.7.0,<0.17.0 smart-open>=5.2.1,<7.0.0 requests>=2.13.0,<3.0.0 pydantic>=1.7.4,!=1.8,!=1.8.1,<3.0.0 diff --git a/weasel/cli/remote_storage.py b/weasel/cli/remote_storage.py index 685a8fc..adcc13a 100644 --- a/weasel/cli/remote_storage.py +++ b/weasel/cli/remote_storage.py @@ -1,6 +1,7 @@ import hashlib import os import site +import sys import tarfile import urllib.parse from pathlib import Path @@ -97,7 +98,10 @@ def safe_extract(tar, path): member_path = os.path.join(path, member.name) if not is_within_directory(path, member_path): raise ValueError(Errors.E201) - tar.extractall(path) + if sys.version_info >= (3, 12): + tar.extractall(path, filter="data") + else: + tar.extractall(path) safe_extract(tar_file, self.root) return url diff --git a/weasel/tests/cli/test_cli.py b/weasel/tests/cli/test_cli.py index c554e2e..9e89534 100644 --- a/weasel/tests/cli/test_cli.py +++ b/weasel/tests/cli/test_cli.py @@ -1,5 +1,4 @@ import os -import sys import time import pytest @@ -114,9 +113,6 @@ def test_is_subpath_of(parent, child, expected): assert is_subpath_of(parent, child) == expected -@pytest.mark.skipif( - sys.version_info >= (3, 12), reason="Python 3.12+ not supported for remotes" -) def test_local_remote_storage(): with make_tempdir() as d: filename = "a.txt" @@ -162,9 +158,6 @@ def test_local_remote_storage(): assert file_.read() == content -@pytest.mark.skipif( - sys.version_info >= (3, 12), reason="Python 3.12+ not supported for remotes" -) def test_local_remote_storage_pull_missing(): # pulling from a non-existent remote pulls nothing gracefully with make_tempdir() as d: diff --git a/weasel/tests/cli/test_cli_app.py b/weasel/tests/cli/test_cli_app.py index 311dbf7..cc77784 100644 --- a/weasel/tests/cli/test_cli_app.py +++ b/weasel/tests/cli/test_cli_app.py @@ -1,4 +1,3 @@ -import sys from pathlib import Path from typing import Any, Dict @@ -164,9 +163,6 @@ def test_project_clone(tmp_path: Path, options_string: str): assert (out / "README.md").is_file() -@pytest.mark.skipif( - sys.version_info >= (3, 12), reason="Python 3.12+ not supported for remotes" -) def test_project_push_pull(tmp_path: Path, project_dir: Path): proj = dict(SAMPLE_PROJECT) remote = "xyz" diff --git a/weasel/tests/cli/test_remote.py b/weasel/tests/cli/test_remote.py index ab03221..b351b90 100644 --- a/weasel/tests/cli/test_remote.py +++ b/weasel/tests/cli/test_remote.py @@ -1,4 +1,3 @@ -import sys from pathlib import Path import pytest @@ -10,9 +9,6 @@ runner = CliRunner() -if sys.version_info >= (3, 12): - pytest.skip("Python 3.12+ not supported for remotes", allow_module_level=True) - @pytest.fixture def project_dir(tmp_path_factory: pytest.TempPathFactory): diff --git a/weasel/util/filesystem.py b/weasel/util/filesystem.py index 13438fe..edc6b42 100644 --- a/weasel/util/filesystem.py +++ b/weasel/util/filesystem.py @@ -79,14 +79,7 @@ def ensure_pathy(path): """Temporary helper to prevent importing cloudpathlib globally (which was originally added due to a slow and annoying Google Cloud warning with Pathy)""" - try: - from cloudpathlib import AnyPath # noqa: F811 - except ImportError as e: - import sys - - if sys.version_info >= (3, 12): - warnings.warn(Warnings.W802) - raise e + from cloudpathlib import AnyPath # noqa: F811 return AnyPath(path)