diff --git a/erddapy/core/url.py b/erddapy/core/url.py index 37d4b72c..8446f4ed 100644 --- a/erddapy/core/url.py +++ b/erddapy/core/url.py @@ -9,7 +9,7 @@ import httpx import pytz -from pandas._libs.tslibs.parsing import parse_time_string +from pandas import to_datetime ListLike = Union[List[str], Tuple[str]] OptionalStr = Optional[str] @@ -113,7 +113,11 @@ def _check_substrings(constraint): return any([True for substring in substrings if substring in str(constraint)]) -def parse_dates(date_time: Union[datetime, str]) -> float: +def parse_dates( + date_time: Union[datetime, str], + dayfirst=False, + yearfirst=False, +) -> float: """ Parse dates to ERDDAP internal format. @@ -123,9 +127,11 @@ def parse_dates(date_time: Union[datetime, str]) -> float: """ if isinstance(date_time, str): - # pandas returns a tuple with datetime, dateutil, and string representation. - # we want only the datetime obj. - parse_date_time = parse_time_string(date_time)[0] + parse_date_time = to_datetime( + date_time, + dayfirst=dayfirst, + yearfirst=yearfirst, + ).to_pydatetime() else: parse_date_time = date_time diff --git a/pyproject.toml b/pyproject.toml index 37c48144..f28981b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,7 @@ dependencies = {file = ["requirements.txt"]} [tool.setuptools_scm] write_to = "erddapy/_version.py" write_to_template = "__version__ = '{version}'" +tag_regex = "^(?Pv)?(?P[^\\+]+)(?P.*)?$" [tool.pytest.ini_options] markers = [ @@ -41,7 +42,7 @@ markers = [ "serial: marks tests that cannot be run in parallel (deselect with '-m \"not serial\"')", ] filterwarnings = [ - "error", + "error:::erddapy.*", "ignore::UserWarning", "ignore::RuntimeWarning", ] diff --git a/requirements-dev.txt b/requirements-dev.txt index 963ada17..660dcd8c 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -5,6 +5,7 @@ geopandas interrogate joblib jupyter +nbconvert<7.3.0 nbsphinx netcdf4 pendulum>=2.0.1 diff --git a/requirements.txt b/requirements.txt index 67762a5d..5ac97ab3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ httpx -pandas>=0.20.3 +pandas>=0.25.2,<3 pytz