Skip to content

Commit

Permalink
feat: drop Python 3.7, pre-commit.ci autoupdate (#428)
Browse files Browse the repository at this point in the history
* chore(deps): pre-commit.ci autoupdate

updates:
- [github.com/asottile/setup-cfg-fmt: v2.2.0 → v2.4.0](asottile/setup-cfg-fmt@v2.2.0...v2.4.0)
- [github.com/asottile/pyupgrade: v3.4.0 → v3.10.1](asottile/pyupgrade@v3.4.0...v3.10.1)
- [github.com/psf/black: 23.3.0 → 23.7.0](psf/black@23.3.0...23.7.0)
- [github.com/PyCQA/flake8: 6.0.0 → 6.1.0](PyCQA/flake8@6.0.0...6.1.0)
- [github.com/pre-commit/mirrors-mypy: v1.2.0 → v1.5.0](pre-commit/mirrors-mypy@v1.2.0...v1.5.0)
- [github.com/codespell-project/codespell: v2.2.4 → v2.2.5](codespell-project/codespell@v2.2.4...v2.2.5)

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

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

* feat: drop Python 3.7 support

* chore: conform flake8

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: andrzejnovak <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and andrzejnovak authored Aug 17, 2023
1 parent f7e219e commit 2b61de1
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
strategy:
matrix:
runs-on: [ubuntu-latest]
python-version: ["3.7", "3.8", "3.10", "3.11"]
python-version: ["3.8", "3.10", "3.11"]
include:
- runs-on: macOS-latest
python-version: "3.7"
python-version: "3.8"
- runs-on: macOS-latest
python-version: "3.11"

Expand Down
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/asottile/setup-cfg-fmt
rev: "v2.2.0"
rev: "v2.4.0"
hooks:
- id: setup-cfg-fmt
args: ["--include-version-classifiers", "--max-py-version=3.11"]
Expand All @@ -29,39 +29,39 @@ repos:
args: ["-a", "from __future__ import annotations"]

- repo: https://github.com/asottile/pyupgrade
rev: v3.4.0
rev: v3.10.1
hooks:
- id: pyupgrade
args: ["--py37-plus"]
args: ["--py38-plus"]

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
hooks:
- id: nbqa-pyupgrade
additional_dependencies: [pyupgrade==2.31.0]
args: ["--py37-plus"]
args: ["--py38-plus"]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.3.0
hooks:
- id: black-jupyter

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.2.0
rev: v1.5.0
hooks:
- id: mypy
files: src
additional_dependencies: ["uhi~=0.3.1", "numpy~=1.24.0", "matplotlib>3.4"]
args: [--show-error-codes]

- repo: https://github.com/codespell-project/codespell
rev: "v2.2.4"
rev: "v2.2.5"
hooks:
- id: codespell
args: ["-L", "hist,heros"]
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sphinx:

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
version: 3.8
install:
- requirements: docs/requirements.txt
- method: pip
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ write_to = "src/mplhep/_version.py"
pyupgrade = 1

[tool.nbqa.addopts]
pyupgrade = ["--py37-plus"]
pyupgrade = ["--py38-plus"]


[tools.mypy]
files = ["src"]
python_version = 3.7
python_version = 3.8
warn_unused_configs = true

allow_redefinition = true
Expand Down
5 changes: 2 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ author_email = "[email protected]"
maintainer = Scikit-HEP
maintainer_email = [email protected]
license = MIT
license_file = LICENSE
license_files = LICENSE
classifiers =
Framework :: Matplotlib
Intended Audience :: Science/Research
License :: OSI Approved :: MIT License
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Expand All @@ -31,7 +30,7 @@ install_requires =
numpy>=1.16.0
packaging
uhi>=0.2.0
python_requires = >=3.7
python_requires = >=3.8
include_package_data = True
package_dir =
=src
Expand Down
6 changes: 3 additions & 3 deletions src/mplhep/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def iterable_not_string(arg):
# Check if iterable
if iterable_not_string(kwargs[kwarg]):
# Check if tuple (can be used for colors)
if type(kwargs[kwarg]) == tuple:
if isinstance(kwargs[kwarg], tuple):
for i in range(len(_chunked_kwargs)):
_chunked_kwargs[i][kwarg] = kwargs[kwarg]
else:
Expand Down Expand Up @@ -946,7 +946,7 @@ def _draw_text_bbox(ax):
Draw legend() and fetch it's bbox
"""
fig = ax.figure
textboxes = [k for k in ax.get_children() if type(k) == AnchoredText]
textboxes = [k for k in ax.get_children() if isinstance(k, AnchoredText)]
if len(textboxes) > 1:
print("Warning: More than one textbox found")
for box in textboxes:
Expand Down Expand Up @@ -1179,7 +1179,7 @@ def hist_legend(ax=None, **kwargs):

handles, labels = ax.get_legend_handles_labels()
new_handles = [
Line2D([], [], c=h.get_edgecolor()) if type(h) == mpl.patches.Polygon else h
Line2D([], [], c=h.get_edgecolor()) if isinstance(h, mpl.patches.Polygon) else h
for h in handles
]
ax.legend(handles=new_handles[::-1], labels=labels[::-1], **kwargs)
Expand Down

0 comments on commit 2b61de1

Please sign in to comment.