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

Remove support for Python 3.7 due to end-of-life #1034

Merged
merged 1 commit into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.8

- name: Install dependencies
run: pip install wheel
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.8

- name: Install dependencies
run: pip install wheel
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
python-version: [3.8]
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
python-version: [3.8]
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -47,7 +47,7 @@ jobs:
strategy:
matrix:
python-version: [
["3.7", "37"], ["3.8", "38"], ["3.9", "39"], ["3.10", "310"], ["3.11", "311"]
["3.8", "38"], ["3.9", "39"], ["3.10", "310"], ["3.11", "311"]
]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ repos:
rev: v3.9.0
hooks:
- id: reorder-python-imports
args: [--application-directories, '.:src', --py37-plus]
args: [--application-directories, '.:src', --py38-plus]
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
args: [--line-length=79, --target-version=py37]
args: [--line-length=79, --target-version=py38]
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.2
hooks:
- id: pyupgrade
args: [--py37-plus]
args: [--py38-plus]
- repo: https://github.com/jorisroovers/gitlint
rev: v0.19.1
hooks:
Expand Down
2 changes: 1 addition & 1 deletion bandit/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def calc_linerange(node):

def linerange(node):
"""Get line number range from a node."""
if sys.version_info >= (3, 8) and hasattr(node, "lineno"):
if hasattr(node, "lineno"):
return list(range(node.lineno, node.end_lineno + 1))
else:
if hasattr(node, "_bandit_linerange_stripped"):
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ classifier =
Operating System :: MacOS :: MacOS X
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
import setuptools

setuptools.setup(
python_requires=">=3.7", setup_requires=["pbr>=2.0.0"], pbr=True
python_requires=">=3.8", setup_requires=["pbr>=2.0.0"], pbr=True
)
22 changes: 2 additions & 20 deletions tests/functional/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,18 +461,6 @@ def test_multiline_sql_statements(self):
severity_medium_tests = 26
nosec_tests = 7
skipped_tests = 8
if sys.version_info[:2] <= (3, 7):
# In the case of implicit concatenation in python 3.7,
# we know only the first line of multi-line string.
# Thus, cases like:
# query = ("SELECT * "
# "FROM foo " # nosec
# f"WHERE id = {identifier}")
# are not skipped but reported as errors.
confidence_low_tests = 17
severity_medium_tests = 30
nosec_tests = 5
skipped_tests = 6
expect = {
"SEVERITY": {
"UNDEFINED": 0,
Expand Down Expand Up @@ -790,19 +778,13 @@ def test_multiline_code(self):
issues[0].fname.endswith("examples/multiline_statement.py")
)
self.assertEqual(1, issues[0].lineno)
if sys.version_info >= (3, 8):
self.assertEqual(list(range(1, 2)), issues[0].linerange)
else:
self.assertEqual(list(range(1, 3)), issues[0].linerange)
self.assertEqual(list(range(1, 2)), issues[0].linerange)
self.assertIn("subprocess", issues[0].get_code())
self.assertEqual(5, issues[1].lineno)
self.assertEqual(list(range(3, 6 + 1)), issues[1].linerange)
self.assertIn("shell=True", issues[1].get_code())
self.assertEqual(11, issues[2].lineno)
if sys.version_info >= (3, 8):
self.assertEqual(list(range(8, 13 + 1)), issues[2].linerange)
else:
self.assertEqual(list(range(8, 12 + 1)), issues[2].linerange)
self.assertEqual(list(range(8, 13 + 1)), issues[2].linerange)
self.assertIn("shell=True", issues[2].get_code())

def test_code_line_numbers(self):
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
minversion = 3.2.0
envlist = py37,pep8
envlist = py38,pep8

[testenv]
usedevelop = True
Expand Down