diff --git a/databricks_cli/__init__.py b/databricks_cli/__init__.py index ccc04bd5..d38c0a7c 100644 --- a/databricks_cli/__init__.py +++ b/databricks_cli/__init__.py @@ -24,6 +24,28 @@ # pylint:disable=import-error # pylint:disable=bare-except +import warnings + + +_has_issued_warning = False + +def issue_deprecation_warning(): + global _has_issued_warning + if _has_issued_warning: + return + _has_issued_warning = True + # Don't print deprecation warning when running the CLI itself. + import sys + import os + if sys.argv and os.path.basename(sys.argv[0]) == 'databricks': + return + warnings.warn("the databricks_cli module is deprecated in favor of databricks-sdk-py. Python " + "3.12 will be the last version of Python supported by databricks-cli. Please " + "consult the documentation for the databricks-sdk-py at " + "https://databricks-sdk-py.readthedocs.io/en/latest/", + DeprecationWarning, stacklevel=3) + +issue_deprecation_warning() def initialize_cli_for_databricks_notebooks(): import IPython diff --git a/databricks_cli/cluster_policies/__init__.py b/databricks_cli/cluster_policies/__init__.py index e69de29b..40e1ce2d 100644 --- a/databricks_cli/cluster_policies/__init__.py +++ b/databricks_cli/cluster_policies/__init__.py @@ -0,0 +1,3 @@ +from databricks_cli import issue_deprecation_warning + +issue_deprecation_warning() diff --git a/databricks_cli/clusters/__init__.py b/databricks_cli/clusters/__init__.py index e69de29b..40e1ce2d 100644 --- a/databricks_cli/clusters/__init__.py +++ b/databricks_cli/clusters/__init__.py @@ -0,0 +1,3 @@ +from databricks_cli import issue_deprecation_warning + +issue_deprecation_warning() diff --git a/databricks_cli/configure/__init__.py b/databricks_cli/configure/__init__.py index b0c9feac..2bfcca65 100644 --- a/databricks_cli/configure/__init__.py +++ b/databricks_cli/configure/__init__.py @@ -20,3 +20,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + +from databricks_cli import issue_deprecation_warning + +issue_deprecation_warning() diff --git a/databricks_cli/dbfs/__init__.py b/databricks_cli/dbfs/__init__.py index b0c9feac..2bfcca65 100644 --- a/databricks_cli/dbfs/__init__.py +++ b/databricks_cli/dbfs/__init__.py @@ -20,3 +20,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + +from databricks_cli import issue_deprecation_warning + +issue_deprecation_warning() diff --git a/databricks_cli/groups/__init__.py b/databricks_cli/groups/__init__.py index e69de29b..40e1ce2d 100644 --- a/databricks_cli/groups/__init__.py +++ b/databricks_cli/groups/__init__.py @@ -0,0 +1,3 @@ +from databricks_cli import issue_deprecation_warning + +issue_deprecation_warning() diff --git a/databricks_cli/instance_pools/__init__.py b/databricks_cli/instance_pools/__init__.py index b0c9feac..2bfcca65 100644 --- a/databricks_cli/instance_pools/__init__.py +++ b/databricks_cli/instance_pools/__init__.py @@ -20,3 +20,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + +from databricks_cli import issue_deprecation_warning + +issue_deprecation_warning() diff --git a/databricks_cli/jobs/__init__.py b/databricks_cli/jobs/__init__.py index e69de29b..40e1ce2d 100644 --- a/databricks_cli/jobs/__init__.py +++ b/databricks_cli/jobs/__init__.py @@ -0,0 +1,3 @@ +from databricks_cli import issue_deprecation_warning + +issue_deprecation_warning() diff --git a/databricks_cli/libraries/__init__.py b/databricks_cli/libraries/__init__.py index b0c9feac..2bfcca65 100644 --- a/databricks_cli/libraries/__init__.py +++ b/databricks_cli/libraries/__init__.py @@ -20,3 +20,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + +from databricks_cli import issue_deprecation_warning + +issue_deprecation_warning() diff --git a/databricks_cli/oauth/__init__.py b/databricks_cli/oauth/__init__.py index dfe79e90..d8d8c017 100644 --- a/databricks_cli/oauth/__init__.py +++ b/databricks_cli/oauth/__init__.py @@ -20,3 +20,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + +from databricks_cli import issue_deprecation_warning + +issue_deprecation_warning() diff --git a/databricks_cli/pipelines/__init__.py b/databricks_cli/pipelines/__init__.py index e69de29b..40e1ce2d 100644 --- a/databricks_cli/pipelines/__init__.py +++ b/databricks_cli/pipelines/__init__.py @@ -0,0 +1,3 @@ +from databricks_cli import issue_deprecation_warning + +issue_deprecation_warning() diff --git a/databricks_cli/repos/__init__.py b/databricks_cli/repos/__init__.py index 0fd9f1e6..2bfcca65 100644 --- a/databricks_cli/repos/__init__.py +++ b/databricks_cli/repos/__init__.py @@ -19,4 +19,8 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and -# limitations under the License. \ No newline at end of file +# limitations under the License. + +from databricks_cli import issue_deprecation_warning + +issue_deprecation_warning() diff --git a/databricks_cli/runs/__init__.py b/databricks_cli/runs/__init__.py index e69de29b..40e1ce2d 100644 --- a/databricks_cli/runs/__init__.py +++ b/databricks_cli/runs/__init__.py @@ -0,0 +1,3 @@ +from databricks_cli import issue_deprecation_warning + +issue_deprecation_warning() diff --git a/databricks_cli/sdk/__init__.py b/databricks_cli/sdk/__init__.py index 9025b6f1..fb253a64 100644 --- a/databricks_cli/sdk/__init__.py +++ b/databricks_cli/sdk/__init__.py @@ -53,3 +53,7 @@ """ from .service import * from .api_client import ApiClient + +from databricks_cli import issue_deprecation_warning + +issue_deprecation_warning() diff --git a/databricks_cli/secrets/__init__.py b/databricks_cli/secrets/__init__.py index b0c9feac..2bfcca65 100644 --- a/databricks_cli/secrets/__init__.py +++ b/databricks_cli/secrets/__init__.py @@ -20,3 +20,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + +from databricks_cli import issue_deprecation_warning + +issue_deprecation_warning() diff --git a/databricks_cli/stack/__init__.py b/databricks_cli/stack/__init__.py index e69de29b..40e1ce2d 100644 --- a/databricks_cli/stack/__init__.py +++ b/databricks_cli/stack/__init__.py @@ -0,0 +1,3 @@ +from databricks_cli import issue_deprecation_warning + +issue_deprecation_warning() diff --git a/databricks_cli/tokens/__init__.py b/databricks_cli/tokens/__init__.py index b0c9feac..2bfcca65 100644 --- a/databricks_cli/tokens/__init__.py +++ b/databricks_cli/tokens/__init__.py @@ -20,3 +20,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + +from databricks_cli import issue_deprecation_warning + +issue_deprecation_warning() diff --git a/databricks_cli/unity_catalog/__init__.py b/databricks_cli/unity_catalog/__init__.py index e69de29b..40e1ce2d 100644 --- a/databricks_cli/unity_catalog/__init__.py +++ b/databricks_cli/unity_catalog/__init__.py @@ -0,0 +1,3 @@ +from databricks_cli import issue_deprecation_warning + +issue_deprecation_warning() diff --git a/databricks_cli/workspace/__init__.py b/databricks_cli/workspace/__init__.py index e69de29b..40e1ce2d 100644 --- a/databricks_cli/workspace/__init__.py +++ b/databricks_cli/workspace/__init__.py @@ -0,0 +1,3 @@ +from databricks_cli import issue_deprecation_warning + +issue_deprecation_warning()