How do I silence experimental warnings? I use expe...
# ask-ai
e
How do I silence experimental warnings? I use experimental stuff all over the codebase and I want to silence it in one place instead of in every file? My code location is laid out like so (in YAML):
Copy code
package:
  __init__.py
  definitions.py # contains definitions
  module:
     __init__.py
     code.py
Where should I silence the warnings?
s
To silence experimental warnings in your Dagster codebase, you can use Python's
warnings
module to filter out the warnings. Since you want to apply this globally, you should place the warning filter at the entry point of your application, which is typically where your Dagster repository or pipelines are defined. Based on the structure of your codebase, it seems like
definitions.py
might be the file where you define your Dagster assets or pipelines. You can add the warning filter at the top of this file, before any other imports or code execution that might trigger the warnings. Here's how you can do it:
Copy code
python
import warnings
from dagster import ExperimentalWarning

warnings.filterwarnings("ignore", category=ExperimentalWarning)
By placing this code at the top of
definitions.py
, you ensure that the experimental warnings are ignored for the entire codebase when it is executed. This way, you don't need to repeat the warning filter in every file. Remember that silencing warnings should be done with caution, as it will suppress all experimental warnings, which are intended to inform you about features that may change in the future. Make sure you are willing to accept the risk of future changes to the experimental features you are using. How to silence the ExperimentalWarning? button Silence experimental warnings underneath... button experimental warnings for asset checks button experimental warning for group-based dep... button Thank you for your feedback!