From e9a7e0657d440a12f220dd43acdede080d19847a Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Tue, 12 Oct 2021 18:53:28 +0300 Subject: [PATCH] dvc: drop 3.6 support (#6792) * dvc: drop 3.6 support Considering that 3.6 has ~2 months until EOL, and our deps are dropping support for it already (e.g. pygit2), we are droppipping it as well. This will reduce the load on our test CI as well, since we've started supporting 3.10 recently. * setup.cfg: adjust requirements * daemon: remove 3.6 logic * tests: utils: remove pre 3.7 logic --- .github/workflows/tests.yaml | 2 +- dvc/daemon.py | 3 +-- setup.cfg | 9 ++------- tests/utils/httpd.py | 33 --------------------------------- 4 files changed, 4 insertions(+), 43 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 71ece2d94..06ee87d29 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -45,7 +45,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-20.04, windows-latest, macos-latest] - pyv: ["3.6", "3.7", "3.8", "3.9", "3.10"] + pyv: ["3.7", "3.8", "3.9", "3.10"] exclude: # no wheels for pygit2 yet - os: windows-latest diff --git a/dvc/daemon.py b/dvc/daemon.py index 76be1d4fd..c9e9a2381 100644 --- a/dvc/daemon.py +++ b/dvc/daemon.py @@ -12,8 +12,6 @@ from dvc.utils import fix_env, is_binary logger = logging.getLogger(__name__) -CREATE_NO_WINDOW = 0x08000000 # only available since Python 3.7 in subprocess. - def _popen(cmd, **kwargs): prefix = [sys.executable] @@ -28,6 +26,7 @@ def _popen(cmd, **kwargs): def _spawn_windows(cmd, env): from subprocess import ( CREATE_NEW_PROCESS_GROUP, + CREATE_NO_WINDOW, STARTF_USESHOWWINDOW, STARTUPINFO, ) diff --git a/setup.cfg b/setup.cfg index b4b1fb33e..ba0c04997 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,7 +19,6 @@ keywords = data-science, data-version-control, machine-learning, git classifiers = Development Status :: 4 - Beta Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 @@ -30,7 +29,7 @@ setup_requires = setuptools>=58.2 setuptools_scm[toml]>=6.3.1 fastentrypoints>=0.12 -python_requires = >=3.6 +python_requires = >=3.7 zip_safe = False packages = find: include_package_data = True @@ -42,8 +41,7 @@ install_requires = configobj>=5.0.6 gitpython>3 dulwich>=0.20.23 - pygit2>=1.5.0,<1.7; python_version < '3.7' - pygit2>=1.5.0; python_version >= '3.7' + pygit2>=1.5.0 setuptools>=34.0.0 nanotime>=0.5.2 pyasn1>=0.4.1 @@ -62,12 +60,9 @@ install_requires = packaging>=19.0 zc.lockfile>=1.2.1 flufl.lock>=3.2,<4 - win-unicode-console>=0.5; sys_platform == 'win32' networkx>=2.5 psutil>=5.8.0 pydot>=1.2.4 - dataclasses>=0.7; python_version < '3.7' - contextvars>=2.1; python_version < '3.7' importlib-metadata>=1.4; python_version < '3.8' flatten_dict>=0.4.1,<1 tabulate>=0.8.7 diff --git a/tests/utils/httpd.py b/tests/utils/httpd.py index 44c0d7bfe..f3ef6a22c 100644 --- a/tests/utils/httpd.py +++ b/tests/utils/httpd.py @@ -1,6 +1,5 @@ import hashlib import os -import sys import threading from contextlib import contextmanager from http import HTTPStatus @@ -11,40 +10,8 @@ from RangeHTTPServer import RangeRequestHandler class TestRequestHandler(RangeRequestHandler): def __init__(self, *args, **kwargs): - # NOTE: `directory` was introduced in 3.7 - if sys.version_info < (3, 7): - self.directory = kwargs.pop("directory", None) or os.getcwd() super().__init__(*args, **kwargs) - def translate_path(self, path): - import posixpath - import urllib - - # NOTE: `directory` was introduced in 3.7 - if sys.version_info >= (3, 7): - return super().translate_path(path) - - path = path.split("?", 1)[0] - path = path.split("#", 1)[0] - # Don't forget explicit trailing slash when normalizing. Issue17324 - trailing_slash = path.rstrip().endswith("/") - try: - path = urllib.parse.unquote(path, errors="surrogatepass") - except UnicodeDecodeError: - path = urllib.parse.unquote(path) - path = posixpath.normpath(path) - words = path.split("/") - words = filter(None, words) - path = self.directory - for word in words: - if os.path.dirname(word) or word in (os.curdir, os.pardir): - # Ignore components that are not a simple file/directory name - continue - path = os.path.join(path, word) - if trailing_slash: - path += "/" - return path - def end_headers(self): # RangeRequestHandler only sends Accept-Ranges header if Range header # is present, see https://github.com/danvk/RangeHTTPServer/issues/23