Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
persist-credentials: false

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.x'
- name: Install dependencies
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/zizmor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: GitHub Actions Security Analysis with zizmor

on:
push:
branches: [ main, 7.x, 8.x ]
pull_request:
branches: [ main, 7.x, 8.x ]

permissions:
contents: read

jobs:
zizmor:
runs-on: ubuntu-latest
permissions:
contents: read
# Needed to upload the results to the code-scanning dashboard.
security-events: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
- name: Run zizmor
id: zizmor
run: uvx zizmor --format=sarif . > results.sarif
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload SARIF results
if: always()
uses: github/codeql-action/upload-sarif@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9
with:
sarif_file: results.sarif
category: zizmor
- name: Fail if zizmor found problems
if: steps.zizmor.outcome == 'failure'
run: exit 1
10 changes: 5 additions & 5 deletions matplotlib_inline/backend_inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,25 +124,25 @@ def flush_figures():
# ignore the tracking, just draw and close all figures
try:
return show(True)
except Exception as e:
except Exception:
# safely show traceback if in IPython, else raise
ip = get_ipython()
if ip is None:
raise e
raise
else:
ip.showtraceback()
return

# exclude any figures that were closed:
active = set([fm.canvas.figure for fm in Gcf.get_all_fig_managers()])
active = {fm.canvas.figure for fm in Gcf.get_all_fig_managers()}
for fig in [fig for fig in show._to_draw if fig in active]:
try:
display(fig, metadata=_fetch_figure_metadata(fig))
except Exception as e:
except Exception:
# safely show traceback if in IPython, else raise
ip = get_ipython()
if ip is None:
raise e
raise
else:
ip.showtraceback()
return
Expand Down
5 changes: 2 additions & 3 deletions matplotlib_inline/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ def _update_figure_formatters(self):
)

def _figure_formats_changed(self, name, old, new):
if "jpg" in new or "jpeg" in new:
if not pil_available():
raise TraitError("Requires PIL/Pillow for JPG figures")
if ("jpg" in new or "jpeg" in new) and not pil_available():
raise TraitError("Requires PIL/Pillow for JPG figures")
self._update_figure_formatters()

figure_format = Unicode(
Expand Down
5 changes: 3 additions & 2 deletions tests/notebooks/config_InlineBackend.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
" 'optimize': True}}\n",
"\n",
"import matplotlib.pyplot as plt\n",
"from matplotlib_inline.backend_inline import set_matplotlib_formats\n",
"from traitlets.config import get_config"
"from traitlets.config import get_config\n",
"\n",
"from matplotlib_inline.backend_inline import set_matplotlib_formats"
]
},
{
Expand Down
Loading