Skip to content

Commit 8fc39e7

Browse files
py313
1 parent 5b5ac44 commit 8fc39e7

File tree

11 files changed

+172
-195
lines changed

11 files changed

+172
-195
lines changed

.github/workflows/ci.yml

+2-6
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,14 @@ jobs:
8888
fail-fast: false
8989
matrix:
9090
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
91-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.9", "pypy3.10"]
91+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.9", "pypy3.10"]
9292
extras: [ "" ]
9393
exclude:
9494
- os: "macos-latest"
9595
python-version: "pypy3.10"
9696
- os: "windows-latest"
9797
python-version: "pypy3.10"
9898
# Workaround for https://github.com/actions/setup-python/issues/696
99-
- os: "macos-latest"
100-
python-version: 3.7
10199
- os: "macos-latest"
102100
python-version: 3.8
103101
- os: "macos-latest"
@@ -107,8 +105,6 @@ jobs:
107105
extras: "full"
108106
os: "ubuntu-latest"
109107
# Workaround for https://github.com/actions/setup-python/issues/696
110-
- os: "macos-13"
111-
python-version: 3.7
112108
- os: "macos-13"
113109
python-version: 3.8
114110
- os: "macos-13"
@@ -150,4 +146,4 @@ jobs:
150146
sudo apt-get install -y graphviz plantuml
151147
python -m pip install --upgrade nox pdm
152148
- name: Build the docs
153-
run: nox --non-interactive -vs doc
149+
run: nox --non-interactive -vs doc

b2sdk/_internal/sync/action.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from __future__ import annotations
1111

1212
import contextlib
13+
import functools
1314
import logging
1415
import os
1516
from abc import ABCMeta, abstractmethod
@@ -113,23 +114,18 @@ def __init__(
113114
self.size = size
114115
self.encryption_settings_provider = encryption_settings_provider
115116
self.large_file_sha1 = None
116-
# TODO: Remove once we drop Python 3.7 support
117-
self.cached_upload_source = None
118117

119118
def get_bytes(self) -> int:
120119
"""
121120
Return file size.
122121
"""
123122
return self.size
124123

125-
@property
126-
# TODO: Use @functools.cached_property once we drop Python 3.7 support
124+
@functools.cached_property
127125
def _upload_source(self) -> UploadSourceLocalFile:
128126
""" Upload source if the file was to be uploaded in full """
129127
# NOTE: We're caching this to ensure that sha1 is not recalculated.
130-
if self.cached_upload_source is None:
131-
self.cached_upload_source = UploadSourceLocalFile(self.local_full_path)
132-
return self.cached_upload_source
128+
return UploadSourceLocalFile(self.local_full_path)
133129

134130
def get_all_sources(self) -> list[OutboundTransferSource]:
135131
""" Get list of sources required to complete this upload """

b2sdk/version.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,9 @@
99
######################################################################
1010
from __future__ import annotations
1111

12+
from importlib.metadata import version as _version
1213
from sys import version_info as _version_info
1314

14-
try:
15-
from importlib.metadata import version as _version
16-
except ModuleNotFoundError: # python 3.7
17-
from importlib_metadata import version as _version
18-
1915
__all__ = [
2016
"VERSION",
2117
"PYTHON_VERSION",

changelog.d/+drop_py37.removed.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Remove Python 3.7 support in new releases.
2+
Under Python 3.7 `pip` will keep resolving the latest version of the package that supports active interpreter.
3+
Python 3.8 is now the minimum supported version, [until it reaches EOL in October 2024](https://devguide.python.org/versions/).
4+
We encourage use of latest stable Python release.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Declare official support for Python 3.13 in b2sdk.
2+
Test b2sdk against Python 3.13 in CI.

noxfile.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
'3.10',
3737
'3.11',
3838
'3.12',
39+
'3.13',
3940
] if NOX_PYTHONS is None else NOX_PYTHONS.split(',')
4041

4142

@@ -52,7 +53,7 @@ def _detect_python_nox_id() -> str:
5253
PYTHON_VERSIONS = [_detect_python_nox_id()]
5354
print(f"CI job mode; using provided interpreter only; PYTHON_VERSIONS={PYTHON_VERSIONS!r}")
5455

55-
PYTHON_DEFAULT_VERSION = PYTHON_VERSIONS[-1]
56+
PYTHON_DEFAULT_VERSION = PYTHON_VERSIONS[-2] if len(PYTHON_VERSIONS) > 1 else PYTHON_VERSIONS[0]
5657

5758
PY_PATHS = ['b2sdk', 'test', 'noxfile.py']
5859

pdm.lock

+147-166
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+3-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies = [
1212
"requests<3.0.0,>=2.9.1",
1313
"typing-extensions>=4.7.1; python_version < '3.12'",
1414
]
15-
requires-python = ">=3.7"
15+
requires-python = ">=3.8"
1616
readme = "README.md"
1717
license = {text = "MIT"}
1818
keywords = ["backblaze", "b2", "cloud", "storage"]
@@ -22,12 +22,12 @@ classifiers = [
2222
"Topic :: Software Development :: Libraries",
2323
"License :: OSI Approved :: MIT License",
2424
"Programming Language :: Python :: 3",
25-
"Programming Language :: Python :: 3.7",
2625
"Programming Language :: Python :: 3.8",
2726
"Programming Language :: Python :: 3.9",
2827
"Programming Language :: Python :: 3.10",
2928
"Programming Language :: Python :: 3.11",
3029
"Programming Language :: Python :: 3.12",
30+
"Programming Language :: Python :: 3.13",
3131
]
3232

3333
[project.urls]
@@ -169,9 +169,7 @@ test = [
169169
"pytest-timeout==2.1.0",
170170
"tqdm<5.0.0,>=4.5.0",
171171
"eval_type_backport>=0.1.3,<1; python_version<'3.10'", # used with pydantic
172-
# remove `and platform_python_implementation!='PyPy'` after dropping Python 3.7 support as that
173-
# will allow us to update pydantic to a version which installs properly under PyPy
174-
"pydantic>=2.0.1,<3; python_version>='3.8' and platform_python_implementation!='PyPy'",
172+
"pydantic>=2.0.1",
175173
"pywin32>=306; sys_platform == \"win32\" and platform_python_implementation!='PyPy'",
176174
]
177175
release = [

test/unit/scan/test_folder_traversal.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,12 @@ def test_invalid_name(self, tmp_path):
9393
]
9494

9595
@pytest.mark.skipif(
96-
platform.system() == 'Windows' and platform.python_implementation() == 'PyPy',
97-
reason=
98-
"PyPy on Windows force-decodes non-UTF-8 filenames, which makes it impossible to test this case"
96+
platform.system() == 'Windows' and
97+
(platform.python_implementation() == 'PyPy' or sys.version_info >= (3, 13)),
98+
reason=(
99+
"PyPy on Windows force-decodes non-UTF-8 filenames, which makes it impossible to test this case. "
100+
"Python 3.13 does so similarly on Windows."
101+
)
99102
)
100103
def test_invalid_unicode_filename(self, tmp_path):
101104
# Create a directory structure below with initial scanning point at tmp_path/dir:

test/unit/v0/test_version_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def easy(bbb):
3030
assert easy(5) == 5
3131
assert easy(bbb=5) == 5
3232
assert easy.__name__ == 'easy'
33-
assert easy.__doc__ == ' easy docstring '
33+
assert easy.__doc__.strip() == 'easy docstring'
3434
assert len(w) == 0
3535

3636
with warnings.catch_warnings(record=True) as w:

test/unit/v1/test_version_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def easy(bbb):
3131
assert easy(5) == 5
3232
assert easy(bbb=5) == 5
3333
assert easy.__name__ == 'easy'
34-
assert easy.__doc__ == ' easy docstring '
34+
assert easy.__doc__.strip() == 'easy docstring'
3535
assert len(w) == 0
3636

3737
with warnings.catch_warnings(record=True) as w:

0 commit comments

Comments
 (0)