Skip to content

Commit

Permalink
Add deprecation warnings when import ecl.ecl or import ert.ecl
Browse files Browse the repository at this point in the history
  • Loading branch information
oysteoh committed Jan 28, 2020
1 parent cffaf3e commit 539b836
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
7 changes: 6 additions & 1 deletion python/ecl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@
import sys

import warnings
warnings.simplefilter('always', DeprecationWarning) # see #1437

warnings.filterwarnings(
action='always',
category=DeprecationWarning,
module=r'ecl|ert',
)

from cwrap import load as cwrapload
from cwrap import Prototype
Expand Down
8 changes: 8 additions & 0 deletions python/ecl/ecl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,12 @@
# Both of these legacy forms are controlled by the cmake switch
# INSTALL_ERT_LEGACY.

import warnings

warnings.warn(
"Importing from ert.ecl, ecl.ecl or ert is deprecated and will not be available in python3." \
" For eclipse functionality use \'from ecl import\', for ert workflow tooling use \'from res import\'.",
DeprecationWarning
)

from ert.ecl import *
8 changes: 8 additions & 0 deletions python/ert/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
import warnings

warnings.filterwarnings(
action='always',
category=DeprecationWarning,
module=r'ecl|ert|res',
)

try:
from .local import *
except ImportError:
Expand Down
9 changes: 9 additions & 0 deletions python/ert/ecl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import warnings

from ecl import EclFileEnum, EclFileFlagEnum, EclPhaseEnum, EclUnitTypeEnum , EclUtil
from ecl import EclTypeEnum, EclDataType
from ecl.summary import EclSumVarType
Expand All @@ -24,3 +26,10 @@
from ecl.summary import EclNPV , NPVPriceVector
from ecl.summary import EclCmp
from ecl.grid import EclGridGenerator


warnings.warn(
"Importing from ert.ecl, ecl.ecl or ert is deprecated and will not be available in python3." \
" For eclipse functionality use \'from ecl import\', for ert workflow tooling use \'from res import\'.",
DeprecationWarning
)

0 comments on commit 539b836

Please sign in to comment.