Repository: scipy/scipy

Issue:
BUG: cannot import ODEintWarning from scipy.integrate
### Describe your issue.

Since SciPy 1.8.0, importing ODEintWarning from scipy.integrate.odepack raises the following warning:

> DeprecationWarning: Please use `ODEintWarning` from the `scipy.integrate` namespace, the `scipy.integrate.odepack` namespace is deprecated.

However, importing ODEintWarning from scipy.integrate fails. I think the solution is to add ODEintWarning to `scipy.integrate._odepack_py.__all__`, but I want to check if I'm misunderstanding something obvious before I attempt a PR.

### Reproducing Code Example

```python
from scipy.integrate import ODEintWarning
```


### Error message

```shell
ImportError: cannot import name 'ODEintWarning' from 'scipy.integrate' (C:\Anaconda3\lib\site-packages\scipy\integrate\__init__.py)
```


### SciPy/NumPy/Python version information

1.9.3 1.23.4 sys.version_info(major=3, minor=9, micro=12, releaselevel='final', serial=0)


Discussion:
Hi @ahawryluk thank you for reporting. Yes we have some automatic warning which are a bit buggy and advise such things. Here it looks like this class was removed from the public API.

@ev-br I see this class defined in both `_odepack_py` and `odepack`. In `odepack` it is present in `__all__` while in the other it is not. Not sure what should be the behaviour. Do we want this class to be public?
xref: #17572, #17671
@tupui I don't have an opinion here. I'm on record with the "just dump it to the main namespace and forget" suggestion, there seems to be a preference for a more principled approach, and I don't have an opinion on this particular part of scipy. 
Oh thanks, I thought integrate was on your watch too. Who is our current resident here?
No really, I'm not very familiar with details here and have only cursory understanding of the ODE solving part of it.  I would defer to Warren's opinion. 
@WarrenWeckesser what do you think?
Sorry this issue dropped off my radar.  I'd say, if we create a custom warning and raise it in public functions--so users will be exposed to that warning--then the warning itself should also be available as part of the public API.  So I think we should update the API so that `from scipy.integrate import ODEintWarning` works.  This would be consistent with other warnings that are currently in public namespaces, such as `scipy.integrate.IntegrationWarning`, `scipy.stats.ConstantInputWarning`, `scipy.optimize.OptimizationWarning`, etc.


Ok let's reopen for other cases (https://github.com/scipy/scipy/issues/17572) it was agreed just to deprecate but I see the logic here

Resolving patch:
diff --git a/scipy/integrate/__init__.py b/scipy/integrate/__init__.py
--- a/scipy/integrate/__init__.py
+++ b/scipy/integrate/__init__.py
@@ -77,6 +77,7 @@
    odeint        -- General integration of ordinary differential equations.
    ode           -- Integrate ODE using VODE and ZVODE routines.
    complex_ode   -- Convert a complex-valued ODE to real-valued and integrate.
+   ODEintWarning -- Warning raised during the execution of `odeint`.
 
 
 Solving boundary value problems for ODE systems
diff --git a/scipy/integrate/_odepack_py.py b/scipy/integrate/_odepack_py.py
--- a/scipy/integrate/_odepack_py.py
+++ b/scipy/integrate/_odepack_py.py
@@ -1,6 +1,6 @@
 # Author: Travis Oliphant
 
-__all__ = ['odeint']
+__all__ = ['odeint', 'ODEintWarning']
 
 import numpy as np
 from . import _odepack
@@ -9,6 +9,7 @@
 
 
 class ODEintWarning(Warning):
+    """Warning raised during the execution of `odeint`."""
     pass
 
 


Test patch: