Repository: jupyter/jupyter_core

Issue:
`__version__` attribute no longer available
It seems like `__version__` has been removed from the main namespace in jupyter_core 3.6. I have noted that this had led to issues in at least two other applications that rely on being able to read the version number from `__version__`, see https://github.com/conda-forge/quarto-feedstock/issues/34#issuecomment-1871421353 and https://gitlab.com/joelostblom/session_info/-/issues/14 for details. Would it be possible to reintroduce the `__version__` attribute (or at least mark it as deprecated for a while), or is there a reason for not using it any longer? From my understanding it is more common to have `__version__` as an attribute on the main module rather than in a `version.__version__` submodule, but there might very well be good reasons for the latter that I am not aware of.

I believe it happened in this PR https://github.com/jupyter/jupyter_core/pull/376 so cc @blink1073.

Discussion:

Patch:
diff --git a/jupyter_core/__init__.py b/jupyter_core/__init__.py
index e69de29..5e86847 100644
--- a/jupyter_core/__init__.py
+++ b/jupyter_core/__init__.py
@@ -0,0 +1,3 @@
+from __future__ import annotations
+
+from .version import __version__, version_info  # noqa: F401
diff --git a/pyproject.toml b/pyproject.toml
index d7f6156..9a224e6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -185,10 +185,9 @@ ignore = [
   "RUF012"  # Mutable class attributes should be annotated
 ]
 unfixable = [
-  # Don't touch print statements
-  "T201",
-  # Don't touch noqa lines
-  "RUF100",
+  "T201", # Don't touch print statements
+  "RUF100", # Don't touch noqa lines
+  "F401"  # Unused imports
 ]
 isort.required-imports = ["from __future__ import annotations"]
 


Test patch:
diff --git a/tests/test_command.py b/tests/test_command.py
index ff8731c..7a0b899 100644
--- a/tests/test_command.py
+++ b/tests/test_command.py
@@ -10,6 +10,7 @@ from unittest.mock import patch
 
 import pytest
 
+from jupyter_core import __version__
 from jupyter_core.command import list_subcommands
 from jupyter_core.paths import (
     jupyter_config_dir,
@@ -248,3 +249,7 @@ print(sys.argv[0])
 
     # Make sure the first argv is the full path to the executing script
     assert f"{jupyter}-witness".encode() in out
+
+
+def test_version():
+    assert isinstance(__version__, str)