From 2f4e318e2dc7fc2d7dd7f6a3248d1664314cc59b Mon Sep 17 00:00:00 2001 From: Ambuj Pawar Date: Fri, 26 Aug 2022 15:18:30 +0530 Subject: [PATCH 1/5] add warning when not in pandas dev and running stubtest --- scripts/run_stubtest.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/run_stubtest.py b/scripts/run_stubtest.py index 8cf5b81ba398c..f6b4046c2b5df 100644 --- a/scripts/run_stubtest.py +++ b/scripts/run_stubtest.py @@ -8,8 +8,10 @@ import pandas as pd +pd_version = getattr(pd, "__version_", "") + # fail early if pandas is not installed -if not getattr(pd, "__version__", ""): +if not pd_version: # fail on the CI, soft fail during local development warnings.warn("You need to install the development version of pandas") if pd.compat.is_ci_environment(): @@ -17,6 +19,13 @@ else: sys.exit(0) +# GH 48260 +if "dev" not in pd_version: + warnings.warn( + f"stubtest may fail as {pd_version} is not a dev version." + f"Please install a pandas dev version or see [] on how to skip the stubtest" + ) + _ALLOWLIST = [ # should be empty # TODO (child classes implement these methods) From 4e2850af150cae67cda9e59e81492a593ad05377 Mon Sep 17 00:00:00 2001 From: Ambuj Pawar Date: Fri, 26 Aug 2022 15:48:17 +0530 Subject: [PATCH 2/5] add url to the warning --- scripts/run_stubtest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/run_stubtest.py b/scripts/run_stubtest.py index f6b4046c2b5df..b0b10347d0c74 100644 --- a/scripts/run_stubtest.py +++ b/scripts/run_stubtest.py @@ -23,7 +23,9 @@ if "dev" not in pd_version: warnings.warn( f"stubtest may fail as {pd_version} is not a dev version." - f"Please install a pandas dev version or see [] on how to skip the stubtest" + f"Please install a pandas dev version or see " + f"on how to skip the stubtest" ) From 889d76ec893d55bc92df65ead9db6d8346e2da71 Mon Sep 17 00:00:00 2001 From: Ambuj Pawar Date: Fri, 26 Aug 2022 16:37:11 +0530 Subject: [PATCH 3/5] add trailing underscore in version --- scripts/run_stubtest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/run_stubtest.py b/scripts/run_stubtest.py index b0b10347d0c74..5eafb96be1e41 100644 --- a/scripts/run_stubtest.py +++ b/scripts/run_stubtest.py @@ -8,7 +8,7 @@ import pandas as pd -pd_version = getattr(pd, "__version_", "") +pd_version = getattr(pd, "__version__", "") # fail early if pandas is not installed if not pd_version: From 83bbe7dfabd66d10321a7f198b77a5eb1a68c0fb Mon Sep 17 00:00:00 2001 From: Ambuj Pawar Date: Fri, 26 Aug 2022 18:59:17 +0530 Subject: [PATCH 4/5] Format the warning message --- scripts/run_stubtest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/run_stubtest.py b/scripts/run_stubtest.py index 5eafb96be1e41..1b2a580f4d0ec 100644 --- a/scripts/run_stubtest.py +++ b/scripts/run_stubtest.py @@ -22,10 +22,10 @@ # GH 48260 if "dev" not in pd_version: warnings.warn( - f"stubtest may fail as {pd_version} is not a dev version." + f"stubtest may fail as {pd_version} is not a dev version. " f"Please install a pandas dev version or see " - f"on how to skip the stubtest" + f"/pandas/blob/main/doc/source/development/contributing_codebase.rst" + f"#validating-type-hints> on how to skip the stubtest" ) From d5b48b8167eda7cf98bc84b486fa0cfd36d5599a Mon Sep 17 00:00:00 2001 From: Ambuj Pawar Date: Sat, 27 Aug 2022 00:53:47 +0530 Subject: [PATCH 5/5] resolve review comments --- scripts/run_stubtest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/run_stubtest.py b/scripts/run_stubtest.py index 1b2a580f4d0ec..d90f8575234e8 100644 --- a/scripts/run_stubtest.py +++ b/scripts/run_stubtest.py @@ -23,9 +23,9 @@ if "dev" not in pd_version: warnings.warn( f"stubtest may fail as {pd_version} is not a dev version. " - f"Please install a pandas dev version or see on how to skip the stubtest" + f"Please install a pandas dev version or see https://pandas.pydata.org/" + f"pandas-docs/stable/development/contributing_codebase.html" + f"#validating-type-hints on how to skip the stubtest" )