Skip to content

Commit

Permalink
Merge pull request Backblaze#1039 from reef-technologies/drop_python37
Browse files Browse the repository at this point in the history
Drop python37
  • Loading branch information
mjurbanski-reef authored Aug 13, 2024
2 parents 50e2e68 + f20f7f6 commit 06b18b4
Show file tree
Hide file tree
Showing 10 changed files with 580 additions and 453 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,19 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.9", "pypy3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.9", "pypy3.10"]
exclude:
- os: "macos-latest"
python-version: "pypy3.10"
- os: "windows-latest"
python-version: "pypy3.10"
# Workaround for https://github.com/actions/setup-python/issues/696
- os: "macos-latest"
python-version: 3.7
- os: "macos-latest"
python-version: 3.8
- os: "macos-latest"
python-version: 3.9
include:
# Workaround for https://github.com/actions/setup-python/issues/696
- os: "macos-13"
python-version: 3.7
- os: "macos-13"
python-version: 3.8
- os: "macos-13"
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ With `nox`, you can run different sessions (default are `lint` and `test`):

* `format` -> Format the code.
* `lint` -> Run linters.
* `test` (`test-3.7`, `test-3.8`, `test-3.9`, `test-3.10`, `test-3.11`) -> Run test suite.
* `test` (`test-3.8`, `test-3.9`, `test-3.10`, `test-3.11`) -> Run test suite.
* `cover` -> Perform coverage analysis.
* `build` -> Build the distribution.
* `generate_dockerfile` -> generate dockerfile
Expand All @@ -90,9 +90,9 @@ nox > Running session format
...
```

Sessions `test` ,`unit`, and `integration` can run on many Python versions, 3.7-3.11 by default.
Sessions `test` ,`unit`, and `integration` can run on many Python versions.

Sessions other than that use the last given Python version, 3.11 by default.
Sessions other than that use the last given Python version.

You can change it:

Expand Down
2 changes: 1 addition & 1 deletion b2.spec.template
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ a = Analysis(['b2/_internal/${VERSION}/__main__.py'],
pathex=['.'],
binaries=[],
datas=datas,
hiddenimports=['pkg_resources.py2_warn'],
hiddenimports=['pkg_resources.extern', 'pkg_resources.py2_warn'],
hookspath=['pyinstaller-hooks'],
runtime_hooks=[],
win_no_prefer_redirects=False,
Expand Down
4 changes: 1 addition & 3 deletions b2/_internal/_cli/autocomplete_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
import argcomplete
from class_registry import ClassRegistry, RegistryKeyError

from b2._internal._utils.python_compat import shlex_join

logger = logging.getLogger(__name__)

SHELL_REGISTRY = ClassRegistry()
Expand Down Expand Up @@ -275,7 +273,7 @@ def _silent_success_run_with_pty(
"""
import pexpect

command_str = shlex_join(cmd)
command_str = shlex.join(cmd)

child = pexpect.spawn(command_str, timeout=timeout, env=env)
output = io.BytesIO()
Expand Down
33 changes: 0 additions & 33 deletions b2/_internal/_utils/python_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
"""
Utilities for compatibility with older Python versions.
"""
import functools
import shlex
import sys

if sys.version_info < (3, 9):
Expand All @@ -21,34 +19,3 @@ def removeprefix(s: str, prefix: str) -> str:

else:
removeprefix = str.removeprefix

if sys.version_info < (3, 8):

class singledispatchmethod:
"""
singledispatchmethod backport for Python 3.7.
There are no guarantees for its completeness.
"""

def __init__(self, method):
self.dispatcher = functools.singledispatch(method)
self.method = method

def register(self, cls, method=None):
return self.dispatcher.register(cls, func=method)

def __get__(self, obj, cls):
@functools.wraps(self.method)
def method_wrapper(arg, *args, **kwargs):
method_desc = self.dispatcher.dispatch(arg.__class__)
return method_desc.__get__(obj, cls)(arg, *args, **kwargs)

method_wrapper.register = self.register
return method_wrapper

def shlex_join(split_command):
return ' '.join(shlex.quote(arg) for arg in split_command)
else:
singledispatchmethod = functools.singledispatchmethod
shlex_join = shlex.join
3 changes: 2 additions & 1 deletion b2/_internal/_utils/uri.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import dataclasses
import pathlib
import urllib.parse
from functools import singledispatchmethod
from pathlib import Path
from typing import Sequence

Expand All @@ -23,7 +24,7 @@
)
from b2sdk.v2.exception import B2Error

from b2._internal._utils.python_compat import removeprefix, singledispatchmethod
from b2._internal._utils.python_compat import removeprefix


class B2URIBase:
Expand Down
6 changes: 6 additions & 0 deletions changelog.d/+drop_py37.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Remove Python 3.7 support in new releases.
Under Python 3.7 `pip` will keep resolving the latest version of the package that supports active interpreter.
This change comes at benefit of using newer versions of B2 CLI dependencies in `b2` standalone binary as well as in the official docker image.
Python 3.8 is now the minimum supported version, [until it reaches EOL in October 2024](https://devguide.python.org/versions/).
We encourage use of latest stable Python release.
If Python interpreter upgrade from 3.7 is not an option, please use provided standalone binaries or official docker image.
1 change: 0 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
PYTHON_VERSIONS = [
'pypy3.9',
'pypy3.10',
'3.7',
'3.8',
'3.9',
'3.10',
Expand Down
Loading

0 comments on commit 06b18b4

Please sign in to comment.