diff --git a/Cargo.lock b/Cargo.lock index a6a9c37..cb49c62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1410,7 +1410,7 @@ dependencies = [ [[package]] name = "pyfusion" -version = "1.4.0" +version = "1.4.1-dev0" dependencies = [ "bincode", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 72beec1..98e2ffd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyfusion" -version = "1.4.0" +version = "1.4.1-dev0" edition = "2021" diff --git a/py_src/fusion/__init__.py b/py_src/fusion/__init__.py index b86463d..a9c851f 100644 --- a/py_src/fusion/__init__.py +++ b/py_src/fusion/__init__.py @@ -2,7 +2,7 @@ __author__ = """Fusion Devs""" __email__ = "fusion_developers@jpmorgan.com" -__version__ = "1.4.0" +__version__ = "1.4.1-dev0" from fusion._fusion import FusionCredentials from fusion.fs_sync import fsync diff --git a/py_src/fusion/fusion.py b/py_src/fusion/fusion.py index 25a7ba6..ac830ed 100644 --- a/py_src/fusion/fusion.py +++ b/py_src/fusion/fusion.py @@ -613,36 +613,38 @@ def _resolve_distro_tuples( f"Check that a valid dataset identifier and date/date range has been set." ) + if dt_str == "latest": - dt_str = datasetseries_list.iloc[ - datasetseries_list["createdDate"].to_numpy().argmax() - ]["identifier"] - - parsed_dates = normalise_dt_param_str(dt_str) - if len(parsed_dates) == 1: - parsed_dates = (parsed_dates[0], parsed_dates[0]) - - if parsed_dates[0]: - datasetseries_list = datasetseries_list[ - pd.Series( - [ - pd.to_datetime(i, errors="coerce") - for i in datasetseries_list["identifier"] - ] - ) - >= pd.to_datetime(parsed_dates[0]) - ].reset_index() - - if parsed_dates[1]: - datasetseries_list = datasetseries_list[ - pd.Series( - [ - pd.to_datetime(i, errors="coerce") - for i in datasetseries_list["identifier"] - ] - ) - <= pd.to_datetime(parsed_dates[1]) - ].reset_index() + dt_str = datasetseries_list[ + datasetseries_list["createdDate"]==datasetseries_list["createdDate"].to_numpy().max() + ].sort_values(by="identifier").iloc[-1]["identifier"] + datasetseries_list = datasetseries_list[datasetseries_list["identifier"] == dt_str] + else: + parsed_dates = normalise_dt_param_str(dt_str) + if len(parsed_dates) == 1: + parsed_dates = (parsed_dates[0], parsed_dates[0]) + + if parsed_dates[0]: + datasetseries_list = datasetseries_list[ + pd.Series( + [ + pd.to_datetime(i, errors="coerce") + for i in datasetseries_list["identifier"] + ] + ) + >= pd.to_datetime(parsed_dates[0]) + ].reset_index() + + if parsed_dates[1]: + datasetseries_list = datasetseries_list[ + pd.Series( + [ + pd.to_datetime(i, errors="coerce") + for i in datasetseries_list["identifier"] + ] + ) + <= pd.to_datetime(parsed_dates[1]) + ].reset_index() if len(datasetseries_list) == 0: raise APIResponseError( # pragma: no cover @@ -677,7 +679,8 @@ def download( # noqa: PLR0912, PLR0913 dataset (str): A dataset identifier dt_str (str, optional): Either a single date or a range identified by a start or end date, or both separated with a ":". Defaults to 'latest' which will return the most recent - instance of the dataset. + instance of the dataset. If more than one series member exists on the latest date, the + series member identifiers will be sorted alphabetically and the last one will be downloaded. dataset_format (str, optional): The file format, e.g. CSV or Parquet. Defaults to 'parquet'. catalog (str, optional): A catalog identifier. Defaults to 'common'. n_par (int, optional): Specify how many distributions to download in parallel. diff --git a/pyproject.toml b/pyproject.toml index 40bcde9..9805ea3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pyfusion" -version = "1.4.0" +version = "1.4.1-dev0" homepage = "https://github.com/jpmorganchase/fusion" description = "JPMC Fusion Developer Tools" @@ -92,7 +92,7 @@ dev-dependencies = [ "auditwheel>=6.0.0; sys_platform=='linux'", "bump-my-version", "cffi>=1.16.0; sys_platform=='darwin'", - "freezegun>=1.4.0", + "freezegun>=1.4.1-dev0", "ipython", "maturin>=1.6,<2.0", "moto[s3]>=5.0.5", @@ -224,7 +224,7 @@ omit = [ [tool.bumpversion] -current_version = "1.4.0" +current_version = "1.4.1-dev0" parse = '(?P\d+)\.(?P\d+)\.(?P\d+)(?:-(?P[a-z]+)(?P\d+))?' serialize = [ '{major}.{minor}.{patch}-{release}{candidate}',