From 7c7822f52cdedebc9420ee9633b4d7dc906e0cda Mon Sep 17 00:00:00 2001 From: c0llab0rat0r <78339685+c0llab0rat0r@users.noreply.github.com> Date: Sun, 4 Apr 2021 21:04:47 -0500 Subject: [PATCH] Bump min Python version from 3.5.4 to 3.7.2 --- .travis.yml | 12 ++++++------ ipfshttpclient/client/__init__.py | 1 + ipfshttpclient/filescanner.py | 17 +++++------------ ipfshttpclient/http.py | 2 +- ipfshttpclient/http_common.py | 4 ++-- ipfshttpclient/multipart.py | 1 + pyproject.toml | 8 ++------ 7 files changed, 18 insertions(+), 27 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0f6811fe..10befe32 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,32 +1,32 @@ # Config file for automatic testing at travis-ci.com language: python -dist: bionic # VirtualEnv is too old on xenial +dist: focal matrix: include: - - python: "3.6" - python: "3.7" - python: "3.8" - - python: "pypy3" + # - python: "pypy3" travis doesn't support pypy on Python 3.7 yet - python: "3.8" env: IPFS_VERSION=compat - python: "3.8" env: TOXENV=py3-httpx + dist: bionic - python: "3.8" env: TOXENV=styleck before_install: ":" - python: "3.8" env: TOXENV=typeck before_install: ":" - + # Testing on macOS/Darwin tends to be much slower so only test the bare minimum # # When changing any version here also update the relevant checksum below with # the values found on the https://python.org/ website. - os: osx language: shell - env: PYTHON_VERSION=3.6.8-macosx10.9 + env: PYTHON_VERSION=3.7.9-macosx10.9 - os: osx language: shell env: PYTHON_VERSION=3.8.2-macosx10.9 @@ -109,7 +109,7 @@ install: ### ====== MODIFY THIS WHEN CHANGING MACOS PYTHON TEST VERSIONS ====== ### case "${PYTHON_VERSION}" in - 3.6.8-macosx10.9) MD5_MACOS="786c4d9183c754f58751d52f509bc971" ;; + 3.7.9-macosx10.9) MD5_MACOS="4b544fc0ac8c3cffdb67dede23ddb79e" ;; 3.8.2-macosx10.9) MD5_MACOS="f12203128b5c639dc08e5a43a2812cc7" ;; esac ### ------------------------------ END ------------------------------- ### diff --git a/ipfshttpclient/client/__init__.py b/ipfshttpclient/client/__init__.py index 74e8962c..235e3396 100644 --- a/ipfshttpclient/client/__init__.py +++ b/ipfshttpclient/client/__init__.py @@ -18,6 +18,7 @@ VERSION_BLACKLIST = [] VERSION_MAXIMUM = "0.8.0" +from . import base from . import bitswap from . import block from . import bootstrap diff --git a/ipfshttpclient/filescanner.py b/ipfshttpclient/filescanner.py index 9c6e9f3d..c71c2e00 100644 --- a/ipfshttpclient/filescanner.py +++ b/ipfshttpclient/filescanner.py @@ -10,21 +10,16 @@ from . import utils +re_pattern_type = re.Pattern -if sys.version_info >= (3, 7): #PY37+ - re_pattern_type = re.Pattern - if ty.TYPE_CHECKING: - re_pattern_t = re.Pattern[ty.AnyStr] - else: - re_pattern_t = re.Pattern -else: #PY36- - re_pattern_t = re_pattern_type = type(re.compile("")) - +if ty.TYPE_CHECKING: + re_pattern_t = re.Pattern[ty.AnyStr] +else: + re_pattern_t = re.Pattern # Windows does not have os.O_DIRECTORY O_DIRECTORY: int = getattr(os, "O_DIRECTORY", 0) - # Neither Windows nor MacOS have os.fwalk even through Python 3.9 HAVE_FWALK: bool = hasattr(os, "fwalk") HAVE_FWALK_BYTES = HAVE_FWALK and sys.version_info >= (3, 7) @@ -510,8 +505,6 @@ def __init__( os.stat(directory_str) # … and possibly open it as a FD if this is supported by the platform - # - # Note: `os.fwalk` support for binary paths was only added in 3.7+. directory_str_or_fd: ty.Union[ty.AnyStr, int] = directory_str if HAVE_FWALK and (not isinstance(directory_str, bytes) or HAVE_FWALK_BYTES): fd = os.open(directory_str, os.O_RDONLY | O_DIRECTORY) diff --git a/ipfshttpclient/http.py b/ipfshttpclient/http.py index cae811f0..5e6e7ff7 100644 --- a/ipfshttpclient/http.py +++ b/ipfshttpclient/http.py @@ -30,4 +30,4 @@ except ImportError: # pragma: no cover from . import http_httpx as _backend -ClientSync = _backend.ClientSync \ No newline at end of file +ClientSync = _backend.ClientSync diff --git a/ipfshttpclient/http_common.py b/ipfshttpclient/http_common.py index c74a7b11..5af2e31e 100644 --- a/ipfshttpclient/http_common.py +++ b/ipfshttpclient/http_common.py @@ -676,7 +676,7 @@ def download( args Positional parameters to be sent along with the HTTP request opts - Query string paramters to be sent along with the HTTP request + Query string parameters to be sent along with the HTTP request compress Whether the downloaded file should be GZip compressed by the daemon before being sent to the client @@ -721,4 +721,4 @@ def download( tf.extractall(path=utils.convert_path(target)) finally: for closable in closables: - closable.close() \ No newline at end of file + closable.close() diff --git a/ipfshttpclient/multipart.py b/ipfshttpclient/multipart.py index f06f95b4..49184e17 100644 --- a/ipfshttpclient/multipart.py +++ b/ipfshttpclient/multipart.py @@ -400,6 +400,7 @@ def __init__(self, directory: ty.Union[ty.AnyStr, utils.PathLike[ty.AnyStr], int # Figure out the absolute path of the directory added self.abspath = None + if not isinstance(directory, int): self.abspath = os.path.abspath(utils.convert_path(directory)) diff --git a/pyproject.toml b/pyproject.toml index 27509e62..d763d0c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,10 +15,8 @@ description-file = "README.md" # Notes: `typing.NoReturn` was introduced post-release in Python 3.5.4 and 3.6.2 and had # a critical bug (https://bugs.python.org/issue34921) in 3.7.0 to 3.7.1. So the # compatible versions below reflect the range of Python versions with working -# `typing.NoReturn` function signature support. (Also, many other `typing` module -# items were only introduced post-release in 3.6 and version restrictions on these -# versions ensure that those are all available as well.) -requires-python = ">=3.6.2,!=3.7.0,!=3.7.1" +# `typing.NoReturn` function signature support. +requires-python = ">=3.7.2" requires = [ "multiaddr (>=0.0.7)", "requests (>=2.11)" @@ -43,11 +41,9 @@ classifiers = [ # Specify the Python versions you support here. In particular, ensure # that you indicate whether you support Python 2, Python 3 or both. "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8" ] [tool.flit.metadata.urls] Documentation = "https://ipfs.io/ipns/12D3KooWEqnTdgqHnkkwarSrJjeMP2ZJiADWLYADaNvUb6SQNyPF/docs/" -