diff --git a/.flake8 b/.flake8 index 15b489dd632..84490393cf2 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,5 @@ [flake8] -min_python_version = 3.6.0 +min_python_version = 3.7.0 max-line-length = 88 ban-relative-imports = true # flake8-use-fstring: https://github.com/MichaelKim0407/flake8-use-fstring#--percent-greedy-and---format-greedy diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1a5936b208a..b9e76eca2d4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,7 +26,7 @@ jobs: strategy: matrix: os: [Ubuntu, macOS, Windows] - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"] + python-version: ["3.7", "3.8", "3.9", "3.10"] include: - os: Ubuntu image: ubuntu-latest diff --git a/.github/workflows/skip.yml b/.github/workflows/skip.yml index 5f61eaf0bb8..bda21acf365 100644 --- a/.github/workflows/skip.yml +++ b/.github/workflows/skip.yml @@ -26,6 +26,6 @@ jobs: strategy: matrix: os: [Ubuntu, macOS, Windows] - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"] + python-version: ["3.7", "3.8", "3.9", "3.10"] steps: - run: exit 0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f4dc448f2b6..656fe1e9caa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -49,7 +49,7 @@ repos: rev: v2.31.0 hooks: - id: pyupgrade - args: [--py36-plus] + args: [--py37-plus] exclude: '^(install|get)-poetry.py$' - repo: https://github.com/pycqa/isort @@ -80,7 +80,6 @@ repos: - id: mypy pass_filenames: false additional_dependencies: - - types-dataclasses - types-requests - repo: https://github.com/pre-commit/pre-commit diff --git a/README.md b/README.md index 5a7efecec82..5e510f5bfae 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ensuring you have the right stack everywhere. ![Poetry Install](https://raw.githubusercontent.com/python-poetry/poetry/master/assets/install.gif) -It supports Python 3.6+. +It supports Python 3.7+. [![Tests Status](https://github.com/python-poetry/poetry/workflows/Tests/badge.svg?branch=master&event=push)](https://github.com/python-poetry/poetry/actions?query=workflow%3ATests+branch%3Amaster+event%3Apush) @@ -88,7 +88,7 @@ You can also install Poetry for a `git` repository by using the `--git` option: curl -sSL https://install.python-poetry.org | python3 - --git https://github.com/python-poetry/poetry.git@master ```` -_Note that the installer does not support Python < 3.6._ +_Note that the installer does not support Python < 3.7._ ## Updating `poetry` diff --git a/docs/_index.md b/docs/_index.md index 65ec48964ea..9f959fd6f2c 100644 --- a/docs/_index.md +++ b/docs/_index.md @@ -17,7 +17,7 @@ It allows you to declare the libraries your project depends on and it will manag ## System requirements -Poetry requires **Python 3.6+**. It is multi-platform and the goal is to make it work equally well +Poetry requires **Python 3.7+**. It is multi-platform and the goal is to make it work equally well on Windows, Linux and OSX. ## Installation @@ -47,7 +47,7 @@ curl -sSL https://install.python-poetry.org | python3 - ``` {{% note %}} -Note that the installer does not support Python < 3.6. +Note that the installer does not support Python < 3.7. {{% /note %}} {{% warning %}} diff --git a/docs/basic-usage.md b/docs/basic-usage.md index c158fd847ee..59569735631 100644 --- a/docs/basic-usage.md +++ b/docs/basic-usage.md @@ -47,7 +47,7 @@ readme = "README.md" packages = [{include = "poetry_demo"}] [tool.poetry.dependencies] -python = "^3.6" +python = "^3.7" [build-system] diff --git a/docs/dependency-specification.md b/docs/dependency-specification.md index 0e06cda1d5f..bebc96b3558 100644 --- a/docs/dependency-specification.md +++ b/docs/dependency-specification.md @@ -215,7 +215,7 @@ you would declare it like so: [tool.poetry.dependencies] foo = [ {version = "<=1.9", python = "^2.7"}, - {version = "^2.0", python = "^3.4"} + {version = "^2.0", python = "^3.8"} ] ``` @@ -234,7 +234,7 @@ An example where this might be useful is the following: ```toml [tool.poetry.group.dev.dependencies] -black = {version = "19.10b0", allow-prereleases = true, python = "^3.6", markers = "platform_python_implementation == 'CPython'"} +black = {version = "19.10b0", allow-prereleases = true, python = "^3.7", markers = "platform_python_implementation == 'CPython'"} ``` As a single line, this is a lot to digest. To make this a bit easier to @@ -244,7 +244,7 @@ work with, you can do the following: [tool.poetry.group.dev.dependencies.black] version = "19.10b0" allow-prereleases = true -python = "^3.6" +python = "^3.7" markers = "platform_python_implementation == 'CPython'" ``` diff --git a/docs/faq.md b/docs/faq.md index 5d7383c5ab7..13bd1693341 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -62,7 +62,7 @@ And use a `tox.ini` configuration file similar to this: ```INI [tox] isolated_build = true -envlist = py27, py36 +envlist = py27, py37 [testenv] allowlist_externals = poetry diff --git a/docs/pyproject.md b/docs/pyproject.md index 96c40280e40..9147294f441 100644 --- a/docs/pyproject.md +++ b/docs/pyproject.md @@ -233,7 +233,7 @@ is compatible is mandatory: ```toml [tool.poetry.dependencies] -python = "^3.6" +python = "^3.7" ``` {{% /note %}} diff --git a/poetry.lock b/poetry.lock index bce814fc32f..95c0fed68c3 100644 --- a/poetry.lock +++ b/poetry.lock @@ -146,14 +146,6 @@ sdist = ["setuptools_rust (>=0.11.4)"] ssh = ["bcrypt (>=3.1.5)"] test = ["pytest (>=6.2.0)", "pytest-cov", "pytest-subtests", "pytest-xdist", "pretend", "iso8601", "pytz", "hypothesis (>=1.11.4,!=3.79.2)"] -[[package]] -name = "dataclasses" -version = "0.8" -description = "A backport of the dataclasses module for Python 3.6" -category = "main" -optional = false -python-versions = ">=3.6, <3.7" - [[package]] name = "deepdiff" version = "5.7.0" @@ -264,21 +256,6 @@ zipp = ">=0.5" docs = ["sphinx", "rst.linker"] testing = ["packaging", "pep517", "importlib-resources (>=1.3)"] -[[package]] -name = "importlib-resources" -version = "5.2.3" -description = "Read resources from Python packages" -category = "main" -optional = false -python-versions = ">=3.6" - -[package.dependencies] -zipp = {version = ">=3.1.0", markers = "python_version < \"3.10\""} - -[package.extras] -docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] -testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-black (>=0.3.7)", "pytest-mypy"] - [[package]] name = "iniconfig" version = "1.1.1" @@ -418,7 +395,6 @@ optional = false python-versions = ">=3.6,<4.0" [package.dependencies] -dataclasses = {version = ">=0.8", markers = "python_version >= \"3.6\" and python_version < \"3.7\""} importlib-metadata = {version = ">=1.7.0", markers = "python_version < \"3.8\""} [[package]] @@ -433,7 +409,6 @@ python-versions = ">=3.6.1" cfgv = ">=2.0.0" identify = ">=1.0.0" importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} -importlib-resources = {version = "<5.3", markers = "python_version < \"3.7\""} nodeenv = ">=0.11.1" pyyaml = ">=5.1" toml = "*" @@ -700,7 +675,6 @@ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" distlib = ">=0.3.1,<1" filelock = ">=3.2,<4" importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} -importlib-resources = {version = ">=1.0", markers = "python_version < \"3.7\""} platformdirs = ">=2,<3" six = ">=1.9.0,<2" @@ -730,8 +704,8 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytes [metadata] lock-version = "1.1" -python-versions = "^3.6" -content-hash = "9d2e32899df46f2c63018e9a3f5e95dbbeb1ec41291c31289cff40f6f2d935a4" +python-versions = "^3.7" +content-hash = "a9b760bb9c29d1bd8835504dde250fae18549ecb21127219d6daf4e6cd26c2e9" [metadata.files] atomicwrites = [ @@ -897,10 +871,6 @@ cryptography = [ {file = "cryptography-36.0.1-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:39bdf8e70eee6b1c7b289ec6e5d84d49a6bfa11f8b8646b5b3dfe41219153316"}, {file = "cryptography-36.0.1.tar.gz", hash = "sha256:53e5c1dc3d7a953de055d77bef2ff607ceef7a2aac0353b5d630ab67f7423638"}, ] -dataclasses = [ - {file = "dataclasses-0.8-py3-none-any.whl", hash = "sha256:0201d89fa866f68c8ebd9d08ee6ff50c0b255f8ec63a71c16fda7af82bb887bf"}, - {file = "dataclasses-0.8.tar.gz", hash = "sha256:8479067f342acf957dc82ec415d355ab5edb7e7646b90dc6e2fd1d96ad084c97"}, -] deepdiff = [ {file = "deepdiff-5.7.0-py3-none-any.whl", hash = "sha256:1ffb38c3b5d9174eb2df95850c93aee55ec00e19396925036a2e680f725079e0"}, {file = "deepdiff-5.7.0.tar.gz", hash = "sha256:838766484e323dcd9dec6955926a893a83767dc3f3f94542773e6aa096efe5d4"}, @@ -939,10 +909,6 @@ importlib-metadata = [ {file = "importlib_metadata-1.7.0-py2.py3-none-any.whl", hash = "sha256:dc15b2969b4ce36305c51eebe62d418ac7791e9a157911d58bfb1f9ccd8e2070"}, {file = "importlib_metadata-1.7.0.tar.gz", hash = "sha256:90bb658cdbbf6d1735b6341ce708fc7024a3e14e99ffdc5783edea9f9b077f83"}, ] -importlib-resources = [ - {file = "importlib_resources-5.2.3-py3-none-any.whl", hash = "sha256:ae35ed1cfe8c0d6c1a53ecd168167f01fa93b893d51a62cdf23aea044c67211b"}, - {file = "importlib_resources-5.2.3.tar.gz", hash = "sha256:203d70dda34cfbfbb42324a8d4211196e7d3e858de21a5eb68c6d1cdd99e4e98"}, -] iniconfig = [ {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, diff --git a/pyproject.toml b/pyproject.toml index c1e05413f6b..a7eb405e93f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,14 +32,13 @@ generate-setup-file = false # Requirements [tool.poetry.dependencies] -python = "^3.6" +python = "^3.7" poetry-core = "^1.1.0a6" cachecontrol = { version = "^0.12.9", extras = ["filecache"] } cachy = "^0.3.0" cleo = "^1.0.0a4" crashtest = "^0.3.0" -dataclasses = { version = "^0.8", python = "<3.7" } entrypoints = "^0.3" html5lib = "^1.0" importlib-metadata = { version = "^1.6.0", python = "<3.8" } @@ -60,7 +59,7 @@ pytest = "^6.2" pytest-cov = "^2.8" pytest-mock = "^3.5" pytest-sugar = "^0.9" -pre-commit = { version = "^2.6", python = "^3.6.1" } +pre-commit = "^2.6" deepdiff = "^5.0" httpretty = "^1.0" typing-extensions = { version = "^4.0.0", python = "<3.8" } @@ -77,7 +76,7 @@ build-backend = "poetry.core.masonry.api" [tool.isort] -py_version = 36 +py_version = 37 profile = "black" force_single_line = true combine_as_imports = true @@ -88,7 +87,7 @@ extend_skip = ["setup.py"] [tool.black] -target-version = ['py36'] +target-version = ['py37'] experimental_string_processing = true force-exclude = ''' .*/setup\.py$ diff --git a/src/poetry/config/source.py b/src/poetry/config/source.py index 06bbfcd234f..3735b193dfa 100644 --- a/src/poetry/config/source.py +++ b/src/poetry/config/source.py @@ -1,8 +1,8 @@ +import dataclasses + from typing import Dict from typing import Union -import dataclasses - @dataclasses.dataclass(order=True, eq=True) class Source: diff --git a/src/poetry/console/application.py b/src/poetry/console/application.py index a74a68b0ff1..96f2e953cf5 100644 --- a/src/poetry/console/application.py +++ b/src/poetry/console/application.py @@ -16,7 +16,6 @@ from cleo.exceptions import CleoException from cleo.formatters.style import Style from cleo.io.inputs.argv_input import ArgvInput -from poetry.core.utils._compat import PY37 from poetry.__version__ import __version__ from poetry.console.command_loader import CommandLoader @@ -138,20 +137,6 @@ def create_io( ) -> "IO": io = super().create_io(input, output, error_output) - # Remove when support for Python 3.6 is removed - # https://github.com/python-poetry/poetry/issues/3412 - if ( - not PY37 - and hasattr(io.output, "_stream") - and hasattr(io.output._stream, "buffer") - and io.output._stream.encoding != "utf-8" - ): - import io as io_ - - io.output._stream = io_.TextIOWrapper( - io.output._stream.buffer, encoding="utf-8" - ) - # Set our own CLI styles formatter = io.output.formatter formatter.set_style("c1", Style("cyan")) diff --git a/src/poetry/utils/pip.py b/src/poetry/utils/pip.py index e2afd0ad379..e1d54d7e4a6 100644 --- a/src/poetry/utils/pip.py +++ b/src/poetry/utils/pip.py @@ -1,6 +1,3 @@ -import os -import sys - from typing import TYPE_CHECKING from typing import Union @@ -9,7 +6,6 @@ from poetry.exceptions import PoetryException from poetry.utils.env import EnvCommandError -from poetry.utils.env import ephemeral_environment if TYPE_CHECKING: @@ -55,18 +51,6 @@ def pip_install( try: return environment.run_pip(*args) except EnvCommandError as e: - if sys.version_info < (3, 7) and not is_wheel: - # Under certain Python3.6 installs vendored pip wheel does not contain - # zip-safe pep517 lib. In this cases we create an isolated ephemeral virtual - # environment. - with ephemeral_environment( - executable=environment.python, with_pip=True, with_setuptools=True - ) as env: - return environment.run( - *env.get_pip_command(), - *args, - env={**os.environ, "PYTHONPATH": str(env.purelib)}, - ) raise PoetryException(f"Failed to install {path.as_posix()}") from e diff --git a/tests/console/commands/source/test_add.py b/tests/console/commands/source/test_add.py index 6d225826a1f..7afbc15e36d 100644 --- a/tests/console/commands/source/test_add.py +++ b/tests/console/commands/source/test_add.py @@ -1,6 +1,7 @@ +import dataclasses + from typing import TYPE_CHECKING -import dataclasses import pytest diff --git a/tests/installation/test_executor.py b/tests/installation/test_executor.py index fc8d5d40574..1620cd68cef 100644 --- a/tests/installation/test_executor.py +++ b/tests/installation/test_executor.py @@ -17,7 +17,6 @@ from cleo.io.buffered_io import BufferedIO from poetry.core.packages.package import Package from poetry.core.packages.utils.link import Link -from poetry.core.utils._compat import PY36 from poetry.installation.executor import Executor from poetry.installation.operations import Install @@ -111,7 +110,7 @@ def test_execute_executes_a_batch_of_operations( env: MockEnv, ): pip_editable_install = mocker.patch( - "poetry.installation.executor.pip_editable_install", unsafe=not PY36 + "poetry.installation.executor.pip_editable_install" ) config.merge({"cache-dir": tmp_dir}) diff --git a/tests/utils/test_authenticator.py b/tests/utils/test_authenticator.py index 9c36f9d49c8..cf41f4f6a87 100644 --- a/tests/utils/test_authenticator.py +++ b/tests/utils/test_authenticator.py @@ -1,6 +1,7 @@ import re import uuid +from dataclasses import dataclass from typing import TYPE_CHECKING from typing import Any from typing import Dict @@ -13,7 +14,6 @@ import requests from cleo.io.null_io import NullIO -from dataclasses import dataclass from poetry.utils.authenticator import Authenticator diff --git a/tox.ini b/tox.ini index e638ee2bf69..19c8f11da5e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] minversion = 3.18.0 isolated_build = True -envlist = py36, py37, py38, py39 +envlist = py37, py38, py39 [testenv] allowlist_externals = poetry