Skip to content

Commit 3418af7

Browse files
authored
Merge branch 'main' into testing
2 parents ffdf634 + 71cc5b0 commit 3418af7

File tree

9 files changed

+261
-28
lines changed

9 files changed

+261
-28
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
# To get started with Dependabot version updates, you'll need to specify which
2-
# package ecosystems to update and where the package manifests are located.
31
# Please see the documentation for all configuration options:
42
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
53

64
version: 2
75
updates:
8-
- package-ecosystem: "pip" # See documentation for possible values
6+
- package-ecosystem: "pip"
97
directory: "/" # Location of package manifests
108
schedule:
11-
interval: "weekly"
9+
interval: "monthly"
10+
- package-ecosystem: "github-actions"
11+
directory: "/"
12+
schedule:
13+
interval: "monthly"
14+
groups:
15+
actions:
16+
patterns:
17+
- "*"

.github/workflows/main.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,39 @@ on:
1111
defaults:
1212
run:
1313
shell: bash -l {0}
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
1417

1518
jobs:
1619
run:
1720
runs-on: ${{ matrix.os }}
21+
timeout-minutes: 3
1822

1923
strategy:
2024
fail-fast: false
2125
matrix:
2226
os: [ubuntu-latest]
2327
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.13t", "3.14-dev"]
24-
2528
steps:
2629
- name: Checkout
27-
uses: actions/checkout@v2
30+
uses: actions/checkout@v5
2831

29-
- name: Setup conda
30-
uses: conda-incubator/setup-miniconda@v2
32+
- name: Setup Python ${{ matrix.python-version }}
33+
uses: actions/setup-python@v6
3134
with:
3235
python-version: ${{ matrix.python-version }}
33-
mamba-version: "*"
34-
auto-activate-base: false
35-
channels: conda-forge
3636

37-
- name: Install dependencies
38-
run: mamba install ipython matplotlib flake8
37+
- name: Install package with test dependencies
38+
run: pip install .[test]
3939

40-
- name: Install package
41-
run: pip install .
40+
- name: Test installation with nbdime
41+
if: ${{ matrix.python-version != "3.9" }}
42+
run: pytest -v --nbdime
4243

43-
- name: Test installation
44-
run: python -c 'from matplotlib_inline.backend_inline import show'
44+
- name: Test installation without nbdime
45+
if: ${{ matrix.python-version == "3.9" }}
46+
run: pytest -v
4547

4648
- name: Test flake8
4749
run: flake8 matplotlib_inline --ignore=E501,W504,W503

.github/workflows/publish.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: "Publish Wheel"
2+
on:
3+
push:
4+
tags:
5+
- '*'
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
pypi-publish:
11+
name: Upload release to PyPI
12+
runs-on: ubuntu-latest
13+
environment:
14+
name: pypi
15+
url: https://pypi.org/project/matplotlib-inline
16+
permissions:
17+
id-token: write
18+
steps:
19+
- uses: actions/checkout@v5
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v6
23+
with:
24+
python-version: '3.x'
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install build
29+
- name: Install built wheel
30+
run: pip install dist/*
31+
- name: Build package
32+
run: python -m build
33+
- name: Echo current tag
34+
run: echo ${{ github.ref }}
35+
- name: Get package version
36+
run: |
37+
PACKAGE_VERSION=$(python -c 'import matplotlib_inline; print(matplotlib_inline.__version__)')
38+
echo "Package version: $PACKAGE_VERSION"
39+
40+
- name: Check tag and package version match
41+
run: |
42+
if [ "$GITHUB_REF" != "refs/tags/$PACKAGE_VERSION" ]; then
43+
echo "Tag and package version do not match. Aborting."
44+
exit 1
45+
fi
46+
# - name: Publish package
47+
# uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc
48+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
dist
33
build
44
__pycache__
5+
.ipynb_checkpoints

matplotlib_inline/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
from . import backend_inline, config # noqa
2-
__version__ = "0.1.7" # noqa
2+
3+
__version__ = "0.1.7"
4+
5+
# we can't ''.join(...) otherwise finding the version number at build time requires
6+
# import which introduces IPython and matplotlib at build time, and thus circular
7+
# dependencies.
8+
version_info = tuple(int(s) for s in __version__.split(".")[:3])

matplotlib_inline/backend_inline.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,14 @@ def configure_inline_support(shell, backend):
208208

209209
def _enable_matplotlib_integration():
210210
"""Enable extra IPython matplotlib integration when we are loaded as the matplotlib backend."""
211-
from matplotlib import get_backend
212211
ip = get_ipython()
213-
backend = get_backend()
212+
213+
import matplotlib
214+
if matplotlib.__version_info__ >= (3, 10):
215+
backend = matplotlib.get_backend(auto_select=False)
216+
else:
217+
backend = matplotlib.rcParams._get("backend")
218+
214219
if ip and backend in ('inline', 'module://matplotlib_inline.backend_inline'):
215220
from IPython.core.pylabtools import activate_matplotlib
216221
try:

pyproject.toml

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ authors = [
1111
classifiers = [
1212
"Development Status :: 5 - Production/Stable",
1313
"Framework :: IPython",
14-
"Framework :: Jupyter",
15-
"Framework :: Jupyter :: JupyterLab",
1614
"Framework :: Jupyter :: JupyterLab :: 3",
1715
"Framework :: Jupyter :: JupyterLab :: 4",
16+
"Framework :: Jupyter :: JupyterLab",
17+
"Framework :: Jupyter",
1818
"Intended Audience :: Developers",
1919
"Intended Audience :: Science/Research",
20-
"License :: OSI Approved :: BSD License",
21-
"Programming Language :: Python",
22-
"Programming Language :: Python :: 3",
23-
"Programming Language :: Python :: 3.8",
24-
"Programming Language :: Python :: 3.9",
20+
"License-Expression: BSD-3-Clause",
2521
"Programming Language :: Python :: 3.10",
2622
"Programming Language :: Python :: 3.11",
2723
"Programming Language :: Python :: 3.12",
24+
"Programming Language :: Python :: 3.13",
25+
"Programming Language :: Python :: 3.9",
26+
"Programming Language :: Python :: 3",
27+
"Programming Language :: Python",
2828
"Topic :: Multimedia :: Graphics",
2929
]
3030
dependencies = ["traitlets"]
@@ -37,13 +37,38 @@ keywords = [
3737
]
3838
license = {file = "LICENSE"}
3939
readme = "README.md"
40-
requires-python = ">=3.8"
40+
requires-python = ">=3.9"
4141

4242
[project.entry-points."matplotlib.backend"]
4343
inline = "matplotlib_inline.backend_inline"
4444

45+
[project.optional-dependencies]
46+
test = [
47+
"flake8",
48+
"matplotlib",
49+
"nbdime",
50+
"nbval",
51+
"notebook",
52+
"pytest",
53+
]
54+
4555
[project.urls]
4656
Homepage = "https://github.com/ipython/matplotlib-inline"
4757

4858
[tool.setuptools.dynamic]
4959
version = {attr = "matplotlib_inline.__version__"}
60+
61+
[tool.pytest.ini_options]
62+
xfail_strict = true
63+
log_cli_level = "info"
64+
addopts = [
65+
"--nbval",
66+
"--ignore=tests/notebooks/.ipynb_checkpoints/*",
67+
"--strict-config",
68+
"-ra",
69+
"--strict-markers",
70+
]
71+
filterwarnings = ["error"]
72+
testpaths = [
73+
"tests",
74+
]

tests/notebooks/mpl_inline.ipynb

Lines changed: 137 additions & 0 deletions
Large diffs are not rendered by default.

tests/test_import.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def test_import():
2+
from matplotlib_inline.backend_inline import show
3+
show()

0 commit comments

Comments
 (0)