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

Require importlib_resources for testing on Python < 3.10 #7016

Merged
merged 5 commits into from
Aug 23, 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
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
# used by the jupyterlab/maintainer-tools base-setup action
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we test on all Python versions? Or maybe the lowest and highest versions (and 3.12) would be enough, like here?

python: ['3.8', '3.11', '3.12']

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mostly to help reduce the number of CI jobs if they are not strictly necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's up to you, but #7014 would not have been caught by your proposed set of pythons:

There was

importlib-resources>=5.0;python_version<\"3.9\"",

and the failure was only with Python 3.9. For 3.8 we already have the backport and for python 3.10 the included stdlib is okay.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok then we can keep all versions and see how it goes with CI over time.

steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ classifiers = [
]
dependencies = [
"jupyter_server>=2.4.0,<3",
"importlib-resources>=5.0;python_version<\"3.9\"",
"jupyterlab>=4.0.2,<5",
"jupyterlab_server>=2.22.1,<3",
"notebook_shim>=0.2,<0.3",
Expand Down Expand Up @@ -59,6 +58,7 @@ test = [
"ipykernel",
"jupyter_server[test]>=2.4.0,<3",
"jupyterlab_server[test]>=2.22.1,<3",
"importlib-resources>=5.0;python_version<\"3.10\"",
]
docs = [
"myst_parser",
Expand Down Expand Up @@ -203,7 +203,8 @@ filterwarnings = [
"error",
"ignore:There is no current event loop:DeprecationWarning",
"ignore:make_current is deprecated; start the event loop first",
"ignore:clear_current is deprecated"
"ignore:clear_current is deprecated",
"ignore:datetime.utc.* is deprecated",
]

[tool.coverage.report]
Expand Down
7 changes: 4 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
import os.path as osp
import pathlib
import shutil
import sys

try:
if sys.version_info < (3, 10):
from importlib_resources import files
else:
from importlib.resources import files
except ImportError:
from importlib_resources import files # type:ignore

import pytest

Expand Down
Loading