In masoniteorm/helpers/misc.py, the deprecated decorator calls warnings.simplefilter("default", DeprecationWarning) at module level (line 7). Because simplefilter inserts at the front of the filter list, this
unconditionally enables ALL DeprecationWarning for the entire Python process as soon as any code transitively imports masoniteorm.helpers.misc.
Python’s default behavior is to ignore DeprecationWarning from non-main modules. This line overrides that default globally, so every downstream project that depends on masonite-orm suddenly sees DeprecationWarning
from every library in its stack — Django, asyncio, sqlalchemy, you name it — regardless of the project’s own warning configuration.
masoniteorm/helpers/misc.py (current)
def deprecated(message):
warnings.simplefilter("default", DeprecationWarning) # ← module-level side effect
...
Steps to Reproduce
- Install masonite-orm (pip install masonite-orm==3.0.0.post1)
- In any Python project that imports masonite-orm, run:
import warnings
Simulate a DeprecationWarning from an unrelated library
warnings.warn("This should be hidden by default", DeprecationWarning)
- Observe that the warning is displayed, even though Python’s default filter says DeprecationWarning should be ignored everywhere except main.
In masoniteorm/helpers/misc.py, the deprecated decorator calls warnings.simplefilter("default", DeprecationWarning) at module level (line 7). Because simplefilter inserts at the front of the filter list, this
unconditionally enables ALL DeprecationWarning for the entire Python process as soon as any code transitively imports masoniteorm.helpers.misc.
Python’s default behavior is to ignore DeprecationWarning from non-main modules. This line overrides that default globally, so every downstream project that depends on masonite-orm suddenly sees DeprecationWarning
from every library in its stack — Django, asyncio, sqlalchemy, you name it — regardless of the project’s own warning configuration.
masoniteorm/helpers/misc.py (current)
def deprecated(message):
warnings.simplefilter("default", DeprecationWarning) # ← module-level side effect
...
Steps to Reproduce
import warnings
Simulate a DeprecationWarning from an unrelated library
warnings.warn("This should be hidden by default", DeprecationWarning)