Skip to content

Commit

Permalink
Deprecate Python 3.6 (python-poetry#263)
Browse files Browse the repository at this point in the history
* Vendors: Bump min python 3.6 -> 3.7

* ci: Remove python 3.6

* ci[pre-commit]: Update pyupgrade arg 3.6 -> 3.7

* chore(flake8): Add min_python_version

* deps(pyproject): Bump minimum python 3.6 -> 3.7

* deps: Remove PEP 557 (dataclasses) backport for 3.6

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* chore(tox): remove python 3.6

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* chore: Remove PY36

* CI(integration): Remove 3.6

* chore(testutils.py): Unused args

Co-authored-by: Branch Vincent <branchevincent@gmail.com>

* build(deps): Simplify isort markers

Co-authored-by: Branch Vincent <branchevincent@gmail.com>

* build(deps): Simplify pre-commit marker

Co-authored-by: Branch Vincent <branchevincent@gmail.com>

* chore: Cleanup unused condition, import

* chore: Remove PY37 checks (unused)

* chore: Fix codesmell

See also: https://sonarcloud.io/project/issues?id=poetry-core&open=AX5towEhmZqnEonFAx80&pullRequest=263&resolved=false&types=CODE_SMELL

* chore: Remove FileNotFoundError

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Branch Vincent <branchevincent@gmail.com>
  • Loading branch information
3 people authored and DavidVujic committed Mar 26, 2022
1 parent 280e2af commit b9b9580
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 48 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[flake8]
min_python_version = 3.7.0
max-line-length = 88
ignore = E501, E203, W503, ANN101, ANN102, SIM106
ban-relative-imports = True
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
os: [Ubuntu, MacOS, Windows]
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9]
experimental: [false]
include:
- os: Ubuntu
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [Ubuntu, MacOS, Windows]
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9]
experimental: [false]
bootstrap-args: [""]
include:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ repos:
hooks:
- id: pyupgrade
args:
- --py36-plus
- --py37-plus

- repo: https://github.com/pycqa/isort
rev: 5.10.1
Expand Down
45 changes: 28 additions & 17 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,22 @@ exclude = [
"Bug Tracker" = "https://github.com/python-poetry/poetry/issues"

[tool.poetry.dependencies]
python = "^3.6"
python = "^3.7"

# required for compatibility
importlib-metadata = {version = ">=1.7.0", python = "<3.8"}
dataclasses = {version = ">=0.8", python = "~3.6"}

[tool.poetry.dev-dependencies]
pre-commit = {version = "^2.15.0", python = "^3.6.1"}
pre-commit = "^2.15.0"
pyrsistent = "^0.18.0"
pytest = "^6.2"
pytest-cov = "^2.8"
pytest-mock = "^3.5"
tox = "^3.0"
vendoring = {version = "^0.3", python = "^3.8"}
pep517 = "^0.11.0"
black = {version = "^21.9b0", markers = "python_version >= '3.6.2' and python_version < '4.0' and implementation_name != 'pypy'"}
isort = {version = "^5.9.3", python = "^3.6.1"}
black = {version = "^21.9b0", markers = "python_version >= '3.7.0' and python_version < '4.0' and implementation_name != 'pypy'"}
isort = "^5.9.3"

[tool.black]
line-length = 88
Expand Down
9 changes: 0 additions & 9 deletions src/poetry/core/utils/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,9 @@
from typing import List


PY36 = sys.version_info >= (3, 6)
PY37 = sys.version_info >= (3, 7)

WINDOWS = sys.platform == "win32"


try:
FileNotFoundError
except NameError:
FileNotFoundError = IOError


def list_to_shell_command(cmd: List[str]) -> str:
executable = cmd[0]

Expand Down
5 changes: 2 additions & 3 deletions tests/masonry/builders/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from poetry.core.factory import Factory
from poetry.core.masonry.builders.builder import Builder
from poetry.core.utils._compat import PY37


if TYPE_CHECKING:
Expand All @@ -29,7 +28,7 @@ def test_builder_find_excluded_files(mocker: "MockerFixture"):


@pytest.mark.xfail(
sys.platform == "win32" and not PY37,
sys.platform == "win32",
reason="Windows is case insensitive for the most part",
)
def test_builder_find_case_sensitive_excluded_files(mocker: "MockerFixture"):
Expand All @@ -54,7 +53,7 @@ def test_builder_find_case_sensitive_excluded_files(mocker: "MockerFixture"):


@pytest.mark.xfail(
sys.platform == "win32" and not PY37,
sys.platform == "win32",
reason="Windows is case insensitive for the most part",
)
def test_builder_find_invalid_case_sensitive_excluded_files(mocker: "MockerFixture"):
Expand Down
10 changes: 3 additions & 7 deletions tests/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
from contextlib import contextmanager
from pathlib import Path
from typing import Any
from typing import ContextManager
from typing import Dict
from typing import Generator
from typing import List
from typing import Optional

from poetry.core.toml import TOMLFile
from poetry.core.utils._compat import PY37


__toml_build_backend_patch__ = {
Expand All @@ -27,7 +26,7 @@
@contextmanager
def temporary_project_directory(
path: Path, toml_patch: Optional[Dict[str, Any]] = None
) -> ContextManager[str]:
) -> Generator[str, None, None]:
"""
Context manager that takes a project source directory, copies content to a temporary
directory, patches the `pyproject.toml` using the provided patch, or using the default
Expand Down Expand Up @@ -56,10 +55,7 @@ def subprocess_run(*args: str, **kwargs: Any) -> subprocess.CompletedProcess:
"""
Helper method to run a subprocess. Asserts for success.
"""
compat_kwargs = {"text" if PY37 else "universal_newlines": True}
result = subprocess.run(
args, **compat_kwargs, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs
)
result = subprocess.run(args, text=True, capture_output=True, **kwargs)
assert result.returncode == 0
return result

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
minversion = 3.3.0
isolated_build = True
envlist = py36, py37, py38, py39, pypy3, integration
envlist = py37, py38, py39, pypy3, integration

[testenv]
whitelist_externals = poetry
Expand Down
4 changes: 2 additions & 2 deletions vendors/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendors/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ classifiers = [
]

[tool.poetry.dependencies]
python = "^3.6"
python = "^3.7"

jsonschema = "^3.2.0"
lark-parser = "^0.9.0"
Expand Down

0 comments on commit b9b9580

Please sign in to comment.