Skip to content

Commit

Permalink
Excluded black from dev for Python 3.7 (#267)
Browse files Browse the repository at this point in the history
We excluded black from development dependencies for Python 3.7 as black
dropped support for Python 3.7 (due to its EOL) and only supports Python
versions from 3.8 on.
  • Loading branch information
mristin committed Sep 15, 2023
1 parent a3061d2 commit 14c228b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 27 deletions.
60 changes: 34 additions & 26 deletions precommit.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,42 @@ def main() -> int:

repo_root = pathlib.Path(__file__).parent

print("Reformatting...")
reformat_targets = [
"tests",
"icontract",
"setup.py",
"precommit.py",
"benchmark.py",
"benchmarks",
"tests_with_others",
]

if sys.version_info >= (3, 6):
reformat_targets.append("tests_3_6")

if sys.version_info >= (3, 7):
reformat_targets.append("tests_3_7")

if sys.version_info >= (3, 8, 5):
reformat_targets.append("tests_3_8")

if overwrite:
subprocess.check_call(
[sys.executable, "-m", "black"] + reformat_targets, cwd=str(repo_root)
if sys.version_info < (3, 8):
print(
"Our formatter, black, supports only Python versions from 3.8 on. "
"However, you are running Python {}. Hence, the reformatting step "
"will be skipped.".format(sys.version_info)
)
else:
subprocess.check_call(
[sys.executable, "-m", "black"] + reformat_targets, cwd=str(repo_root)
)
print("Reformatting...")

reformat_targets = [
"tests",
"icontract",
"setup.py",
"precommit.py",
"benchmark.py",
"benchmarks",
"tests_with_others",
]

if sys.version_info >= (3, 6):
reformat_targets.append("tests_3_6")

if sys.version_info >= (3, 7):
reformat_targets.append("tests_3_7")

if sys.version_info >= (3, 8, 5):
reformat_targets.append("tests_3_8")

if overwrite:
subprocess.check_call(
[sys.executable, "-m", "black"] + reformat_targets, cwd=str(repo_root)
)
else:
subprocess.check_call(
[sys.executable, "-m", "black"] + reformat_targets, cwd=str(repo_root)
)

if sys.version_info < (3, 8):
print(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
extras_require={
"dev": [
"pylint==2.13.9",
"black==23.9.1",
"tox>=3.0.0",
"pydocstyle>=6.1.1,<7",
"coverage>=4.5.1,<5",
Expand All @@ -66,6 +65,7 @@
"numpy>=1,<2",
]
+ (["mypy==1.5.1"] if sys.version_info >= (3, 8) else [])
+ (["black==23.9.1"] if sys.version_info >= (3, 8) else [])
+ (["deal==4.23.3"] if sys.version_info >= (3, 8) else [])
+ (["asyncstdlib==3.9.1"] if sys.version_info >= (3, 8) else []),
},
Expand Down

0 comments on commit 14c228b

Please sign in to comment.