From 23a3c7a393a630b853635344ea6232b3452c5fd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 11 Nov 2024 18:38:55 +0100 Subject: [PATCH 1/7] CONF: adding pytest config to fail on deprecationwarnings --- pyproject.toml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 6a62fa0e..3619c038 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -149,3 +149,12 @@ ignore = [ [tool.ruff.lint.isort] force-sort-within-sections = true + +[tool.pytest.ini_options] +filterwarnings = [ + "error", +] + +markers = [ + "sphinx_params", +] From 515c9db816413a1fb93da268aa96dd686407b311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 11 Nov 2024 19:11:44 +0100 Subject: [PATCH 2/7] DEP: remove deprecated sphinx usage --- myst_nb/core/read.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/myst_nb/core/read.py b/myst_nb/core/read.py index 8fc2bb67..45527a00 100644 --- a/myst_nb/core/read.py +++ b/myst_nb/core/read.py @@ -58,7 +58,7 @@ def create_nb_reader( or None if the input cannot be read as a notebook. """ # the import is here so this module can be loaded without sphinx - from sphinx.util import import_object + from importlib import import_module # get all possible readers readers = nb_config.custom_formats.copy() @@ -71,7 +71,7 @@ def create_nb_reader( if str(Path(path)).endswith(suffix): if isinstance(reader, str): # attempt to load the reader as an object path - reader = import_object(reader) + reader = import_module(reader) if commonmark_only: # Markdown cells should be read as Markdown only md_config = dc.replace(md_config, commonmark_only=True) From f7325046df8d32efba3c35bf9ddbbf2dd8c75f54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Tue, 12 Nov 2024 12:01:52 +0100 Subject: [PATCH 3/7] DEP: workaround deprecation --- myst_nb/core/read.py | 9 ++++++--- pyproject.toml | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/myst_nb/core/read.py b/myst_nb/core/read.py index 45527a00..9bf6befb 100644 --- a/myst_nb/core/read.py +++ b/myst_nb/core/read.py @@ -57,8 +57,11 @@ def create_nb_reader( :returns: the notebook reader, and the (potentially modified) MdParserConfig, or None if the input cannot be read as a notebook. """ - # the import is here so this module can be loaded without sphinx - from importlib import import_module + + try: + from sphinx.util._importer import import_object + except ImportError: + from sphinx.util import import_object # get all possible readers readers = nb_config.custom_formats.copy() @@ -71,7 +74,7 @@ def create_nb_reader( if str(Path(path)).endswith(suffix): if isinstance(reader, str): # attempt to load the reader as an object path - reader = import_module(reader) + reader = import_object(reader) if commonmark_only: # Markdown cells should be read as Markdown only md_config = dc.replace(md_config, commonmark_only=True) diff --git a/pyproject.toml b/pyproject.toml index 3619c038..b9de3265 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -131,6 +131,7 @@ show_error_codes = true check_untyped_defs = true strict_equality = true no_implicit_optional = true +ignore_missing_imports = true warn_unused_ignores = true [[tool.mypy.overrides]] From 2aeaf2d9def30848f62fce4f2385bb02e6d1375e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Tue, 12 Nov 2024 14:43:44 +0100 Subject: [PATCH 4/7] CONF: adding more deprecation warnings to ignore that are triggered upstream --- pyproject.toml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b9de3265..d5fd8bb4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -153,7 +153,18 @@ force-sort-within-sections = true [tool.pytest.ini_options] filterwarnings = [ - "error", + 'error', + 'ignore:unclosed database in:ResourceWarning', + # from asyncio triggered by jupyter_client + 'ignore:There is no current event loop:DeprecationWarning', + 'ignore:Parsing dates involving a day of month without a year specified is ambiguious:DeprecationWarning', + # from jupyter_core + 'ignore:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning', + # nbclient + 'ignore:Parsing dates involving a day of month without a year specified is ambiguious:DeprecationWarning:nbclient', + # From dateutil in sqlalchemy and jupyter_cache + 'ignore:datetime.datetime.utcnow\(\) is deprecated:DeprecationWarning:sqlalchemy', + 'ignore:datetime.datetime.utcnow\(\) is deprecated:DeprecationWarning:jupyter_cache', ] markers = [ From 456bdeeb8f6c8f1c913c0e185b72f15d45b725c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Sat, 16 Nov 2024 17:22:33 +0100 Subject: [PATCH 5/7] CI: bump myst-parser dependency to avoid the deprecationwarning that gets triggered with the used version combo --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 484c7dbf..d004c61c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -41,7 +41,7 @@ jobs: - os: ubuntu-latest python-version: "3.11" sphinx: "==7.0.0" - myst-parser: "==2.0.0" + myst-parser: "==3.0.0" # Newest known-compatible dependencies - os: ubuntu-latest python-version: "3.12" From 81c58d98e076d2bc8ca700dde2a9687a2dc1a5e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Sat, 16 Nov 2024 17:25:46 +0100 Subject: [PATCH 6/7] Remove typoed upstream word to make codespell happy --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d5fd8bb4..5edc8068 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -157,11 +157,11 @@ filterwarnings = [ 'ignore:unclosed database in:ResourceWarning', # from asyncio triggered by jupyter_client 'ignore:There is no current event loop:DeprecationWarning', - 'ignore:Parsing dates involving a day of month without a year specified is ambiguious:DeprecationWarning', + 'ignore:Parsing dates involving a day of month without a year specified is :DeprecationWarning', # from jupyter_core 'ignore:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning', # nbclient - 'ignore:Parsing dates involving a day of month without a year specified is ambiguious:DeprecationWarning:nbclient', + 'ignore:Parsing dates involving a day of month without a year specified is :DeprecationWarning:nbclient', # From dateutil in sqlalchemy and jupyter_cache 'ignore:datetime.datetime.utcnow\(\) is deprecated:DeprecationWarning:sqlalchemy', 'ignore:datetime.datetime.utcnow\(\) is deprecated:DeprecationWarning:jupyter_cache', From 816ea291b3ad22e3dc10fd0b453e49f9cb972c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Tue, 26 Nov 2024 13:13:46 +0100 Subject: [PATCH 7/7] CI: ignore warnings triggered only on windows --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 5edc8068..b80ede9f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -165,6 +165,8 @@ filterwarnings = [ # From dateutil in sqlalchemy and jupyter_cache 'ignore:datetime.datetime.utcnow\(\) is deprecated:DeprecationWarning:sqlalchemy', 'ignore:datetime.datetime.utcnow\(\) is deprecated:DeprecationWarning:jupyter_cache', + # Windows issues, some may need to be fixed in MyST-NB, others are upstream + 'ignore:Proactor event loop does not implement add_reader:RuntimeWarning:zmq', ] markers = [