Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require Python 3.7.2 #1542

Merged
merged 5 commits into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Require Python 3.7.2
  • Loading branch information
jacobtylerwalls committed May 4, 2022
commit f8a5a717f7e3aeeaab2ac9ed89c297532c93c718
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
python-version: [3.7, 3.8, 3.9, "3.10"]
outputs:
python-key: ${{ steps.generate-python-key.outputs.key }}
steps:
Expand Down Expand Up @@ -233,7 +233,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
python-version: [3.7, 3.8, 3.9, "3.10"]
steps:
- name: Set temp directory
run: echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
Expand Down Expand Up @@ -282,7 +282,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["pypy-3.6", "pypy-3.7", "pypy-3.8"]
python-version: ["pypy-3.7", "pypy-3.8"]
steps:
- name: Check out code from GitHub
uses: actions/checkout@v3.0.2
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ repos:
hooks:
- id: pyupgrade
exclude: tests/testdata
args: [--py36-plus]
args: [--py37-plus]
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
Expand Down
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ What's New in astroid 2.12.0?
=============================
Release date: TBA

* ``astroid`` now requires Python 3.7.2 to run.

* Fix ``re`` brain on Python ``3.11``. The flags now come from ``re._compile``.

* Build ``nodes.Module`` for frozen modules which have location information in their
Expand Down
1 change: 0 additions & 1 deletion astroid/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import enum
import sys

PY36 = sys.version_info[:2] == (3, 6)
PY38 = sys.version_info[:2] == (3, 8)
PY37_PLUS = sys.version_info >= (3, 7)
PY38_PLUS = sys.version_info >= (3, 8)
Expand Down
20 changes: 2 additions & 18 deletions astroid/rebuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import ast
import sys
import token
import tokenize
from io import StringIO
from tokenize import TokenInfo, generate_tokens
from typing import (
Expand All @@ -29,7 +28,7 @@

from astroid import nodes
from astroid._ast import ParserModule, get_parser_module, parse_function_type_comment
from astroid.const import IS_PYPY, PY36, PY38, PY38_PLUS, PY39_PLUS, Context
from astroid.const import IS_PYPY, PY38, PY38_PLUS, PY39_PLUS, Context
from astroid.manager import AstroidManager
from astroid.nodes import NodeNG
from astroid.nodes.utils import Position
Expand Down Expand Up @@ -148,12 +147,6 @@ def _get_position_info(
keyword_tokens: Tuple[int, ...] = (token.NAME,)
if isinstance(parent, nodes.AsyncFunctionDef):
search_token = "async"
if PY36:
# In Python 3.6, the token type for 'async' was 'ASYNC'
# In Python 3.7, the type was changed to 'NAME' and 'ASYNC' removed
# Python 3.8 added it back. However, if we use it unconditionally
# we would break 3.7.
keyword_tokens = (token.NAME, token.ASYNC)
elif isinstance(parent, nodes.FunctionDef):
search_token = "def"
else:
Expand Down Expand Up @@ -200,12 +193,7 @@ def _fix_doc_node_position(self, node: NodesWithDocsType) -> None:

found_start, found_end = False, False
open_brackets = 0
skip_token: Set[int] = {token.NEWLINE, token.INDENT}
if PY36:
skip_token.update((tokenize.NL, tokenize.COMMENT))
else:
# token.NL and token.COMMENT were added in 3.7
skip_token.update((token.NL, token.COMMENT))
skip_token: Set[int] = {token.NEWLINE, token.INDENT, token.NL, token.COMMENT}

if isinstance(node, nodes.Module):
found_end = True
Expand Down Expand Up @@ -1294,10 +1282,6 @@ def _visit_functiondef(
position=self._get_position_info(node, newnode),
doc_node=self.visit(doc_ast_node, newnode),
)
if IS_PYPY and PY36 and newnode.position:
# PyPy: col_offset in Python 3.6 doesn't include 'async',
# use position.col_offset instead.
newnode.col_offset = newnode.position.col_offset
self._fix_doc_node_position(newnode)
self._global_names.pop()
return newnode
Expand Down
2 changes: 1 addition & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ unsafe-load-any-extension=no
extension-pkg-whitelist=

# Minimum supported python version
py-version = 3.6.2
py-version = 3.7.2


[REPORTS]
Expand Down
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ classifiers =
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Expand All @@ -43,7 +42,7 @@ install_requires =
setuptools>=20.0
typed-ast>=1.4.0,<2.0;implementation_name=="cpython" and python_version<"3.8"
typing-extensions>=3.10;python_version<"3.10"
python_requires = >=3.6.2
python_requires = >=3.7.2

[options.packages.find]
include =
Expand Down