@@ -23,15 +23,15 @@ def __init__(self):
2323 @property
2424 def bigquery_installed_version (self ):
2525 import google .cloud .bigquery
26- import pkg_resources
26+ import packaging . version
2727
2828 if self ._bigquery_installed_version is not None :
2929 return self ._bigquery_installed_version
3030
31- self ._bigquery_installed_version = pkg_resources . parse_version (
31+ self ._bigquery_installed_version = packaging . version . parse (
3232 google .cloud .bigquery .__version__
3333 )
34- bigquery_minimum_version = pkg_resources . parse_version (BIGQUERY_MINIMUM_VERSION )
34+ bigquery_minimum_version = packaging . version . parse (BIGQUERY_MINIMUM_VERSION )
3535
3636 if self ._bigquery_installed_version < bigquery_minimum_version :
3737 raise ImportError (
@@ -45,68 +45,68 @@ def bigquery_installed_version(self):
4545
4646 @property
4747 def bigquery_has_accurate_timestamp (self ):
48- import pkg_resources
48+ import packaging . version
4949
50- min_version = pkg_resources . parse_version (BIGQUERY_ACCURATE_TIMESTAMP_VERSION )
50+ min_version = packaging . version . parse (BIGQUERY_ACCURATE_TIMESTAMP_VERSION )
5151 return self .bigquery_installed_version >= min_version
5252
5353 @property
5454 def bigquery_has_bignumeric (self ):
55- import pkg_resources
55+ import packaging . version
5656
57- min_version = pkg_resources . parse_version (BIGQUERY_SUPPORTS_BIGNUMERIC_VERSION )
57+ min_version = packaging . version . parse (BIGQUERY_SUPPORTS_BIGNUMERIC_VERSION )
5858 return self .bigquery_installed_version >= min_version
5959
6060 @property
6161 def bigquery_has_from_dataframe_with_csv (self ):
62- import pkg_resources
62+ import packaging . version
6363
64- bigquery_from_dataframe_version = pkg_resources . parse_version (
64+ bigquery_from_dataframe_version = packaging . version . parse (
6565 BIGQUERY_FROM_DATAFRAME_CSV_VERSION
6666 )
6767 return self .bigquery_installed_version >= bigquery_from_dataframe_version
6868
6969 @property
7070 def bigquery_needs_date_as_object (self ):
71- import pkg_resources
71+ import packaging . version
7272
73- max_version = pkg_resources . parse_version (BIGQUERY_NO_DATE_AS_OBJECT_VERSION )
73+ max_version = packaging . version . parse (BIGQUERY_NO_DATE_AS_OBJECT_VERSION )
7474 return self .bigquery_installed_version < max_version
7575
7676 @property
7777 def pandas_installed_version (self ):
7878 import pandas
79- import pkg_resources
79+ import packaging . version
8080
8181 if self ._pandas_installed_version is not None :
8282 return self ._pandas_installed_version
8383
84- self ._pandas_installed_version = pkg_resources . parse_version (pandas .__version__ )
84+ self ._pandas_installed_version = packaging . version . parse (pandas .__version__ )
8585 return self ._pandas_installed_version
8686
8787 @property
8888 def pandas_has_deprecated_verbose (self ):
89- import pkg_resources
89+ import packaging . version
9090
9191 # Add check for Pandas version before showing deprecation warning.
9292 # https://github.com/pydata/pandas-gbq/issues/157
93- pandas_verbosity_deprecation = pkg_resources . parse_version (
93+ pandas_verbosity_deprecation = packaging . version . parse (
9494 PANDAS_VERBOSITY_DEPRECATION_VERSION
9595 )
9696 return self .pandas_installed_version >= pandas_verbosity_deprecation
9797
9898 @property
9999 def pandas_has_boolean_dtype (self ):
100- import pkg_resources
100+ import packaging . version
101101
102- desired_version = pkg_resources . parse_version (PANDAS_BOOLEAN_DTYPE_VERSION )
102+ desired_version = packaging . version . parse (PANDAS_BOOLEAN_DTYPE_VERSION )
103103 return self .pandas_installed_version >= desired_version
104104
105105 @property
106106 def pandas_has_parquet_with_lossless_timestamp (self ):
107- import pkg_resources
107+ import packaging . version
108108
109- desired_version = pkg_resources . parse_version (
109+ desired_version = packaging . version . parse (
110110 PANDAS_PARQUET_LOSSLESS_TIMESTAMP_VERSION
111111 )
112112 return self .pandas_installed_version >= desired_version
0 commit comments