Skip to content

Commit bae505b

Browse files
authored
Update for cloudpathlib 0.16 (#68)
* Update for cloudpathlib 0.16 * Unskip python 3.12 remote tests * Remove cloudpathlib warnings * Address `tar.extractall` `filter` deprecation warning for python 3.12+ * Update mypy * Remove unused imports
1 parent f8d12f3 commit bae505b

8 files changed

Lines changed: 10 additions & 28 deletions

File tree

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
fail-fast: false
5353
matrix:
5454
os: [ubuntu-latest, windows-latest, macos-latest]
55-
python_version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12.0-rc.2"]
55+
python_version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
5656
include:
5757
- os: ubuntu-20.04
5858
python_version: "3.6"

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ confection>=0.0.4,<0.2.0
33
wasabi>=0.9.1,<1.2.0
44
srsly>=2.4.3,<3.0.0
55
typer>=0.3.0,<0.10.0
6-
cloudpathlib>=0.7.0,<0.16.0
6+
cloudpathlib>=0.7.0,<0.17.0
77
smart-open>=5.2.1,<7.0.0
88
# Third party dependencies
99
requests>=2.13.0,<3.0.0
@@ -13,7 +13,7 @@ packaging>=20.0
1313
# Development dependencies
1414
black==22.3.0
1515
pytest>=5.2.0,!=7.1.0
16-
mypy>=0.990,<1.1.0; platform_machine != "aarch64" and python_version >= "3.7"
16+
mypy>=1.5.0,<1.7.0; python_version >= "3.8"
1717
types-requests
1818
types-setuptools>=57.0.0
1919
ruff>=0.0.259; python_version > "3.6"

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ install_requires =
3737
wasabi>=0.9.1,<1.2.0
3838
srsly>=2.4.3,<3.0.0
3939
typer>=0.3.0,<0.10.0
40-
cloudpathlib>=0.7.0,<0.16.0
40+
cloudpathlib>=0.7.0,<0.17.0
4141
smart-open>=5.2.1,<7.0.0
4242
requests>=2.13.0,<3.0.0
4343
pydantic>=1.7.4,!=1.8,!=1.8.1,<3.0.0

weasel/cli/remote_storage.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import hashlib
22
import os
33
import site
4+
import sys
45
import tarfile
56
import urllib.parse
67
from pathlib import Path
@@ -97,7 +98,10 @@ def safe_extract(tar, path):
9798
member_path = os.path.join(path, member.name)
9899
if not is_within_directory(path, member_path):
99100
raise ValueError(Errors.E201)
100-
tar.extractall(path)
101+
if sys.version_info >= (3, 12):
102+
tar.extractall(path, filter="data")
103+
else:
104+
tar.extractall(path)
101105

102106
safe_extract(tar_file, self.root)
103107
return url

weasel/tests/cli/test_cli.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import os
2-
import sys
32
import time
43

54
import pytest
@@ -114,9 +113,6 @@ def test_is_subpath_of(parent, child, expected):
114113
assert is_subpath_of(parent, child) == expected
115114

116115

117-
@pytest.mark.skipif(
118-
sys.version_info >= (3, 12), reason="Python 3.12+ not supported for remotes"
119-
)
120116
def test_local_remote_storage():
121117
with make_tempdir() as d:
122118
filename = "a.txt"
@@ -162,9 +158,6 @@ def test_local_remote_storage():
162158
assert file_.read() == content
163159

164160

165-
@pytest.mark.skipif(
166-
sys.version_info >= (3, 12), reason="Python 3.12+ not supported for remotes"
167-
)
168161
def test_local_remote_storage_pull_missing():
169162
# pulling from a non-existent remote pulls nothing gracefully
170163
with make_tempdir() as d:

weasel/tests/cli/test_cli_app.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import sys
21
from pathlib import Path
32
from typing import Any, Dict
43

@@ -164,9 +163,6 @@ def test_project_clone(tmp_path: Path, options_string: str):
164163
assert (out / "README.md").is_file()
165164

166165

167-
@pytest.mark.skipif(
168-
sys.version_info >= (3, 12), reason="Python 3.12+ not supported for remotes"
169-
)
170166
def test_project_push_pull(tmp_path: Path, project_dir: Path):
171167
proj = dict(SAMPLE_PROJECT)
172168
remote = "xyz"

weasel/tests/cli/test_remote.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import sys
21
from pathlib import Path
32

43
import pytest
@@ -10,9 +9,6 @@
109

1110
runner = CliRunner()
1211

13-
if sys.version_info >= (3, 12):
14-
pytest.skip("Python 3.12+ not supported for remotes", allow_module_level=True)
15-
1612

1713
@pytest.fixture
1814
def project_dir(tmp_path_factory: pytest.TempPathFactory):

weasel/util/filesystem.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,7 @@ def ensure_pathy(path):
7979
"""Temporary helper to prevent importing cloudpathlib globally (which was
8080
originally added due to a slow and annoying Google Cloud warning with
8181
Pathy)"""
82-
try:
83-
from cloudpathlib import AnyPath # noqa: F811
84-
except ImportError as e:
85-
import sys
86-
87-
if sys.version_info >= (3, 12):
88-
warnings.warn(Warnings.W802)
89-
raise e
82+
from cloudpathlib import AnyPath # noqa: F811
9083

9184
return AnyPath(path)
9285

0 commit comments

Comments
 (0)