From b3a7c5fa7a0323987d5166c970219b0733ec94fe Mon Sep 17 00:00:00 2001 From: Chris Sellers Date: Tue, 26 Nov 2024 15:57:04 +1100 Subject: [PATCH 1/5] MOD: Upgrade ruff --- databento/__init__.py | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/databento/__init__.py b/databento/__init__.py index a15195e..8e68bb2 100644 --- a/databento/__init__.py +++ b/databento/__init__.py @@ -56,49 +56,48 @@ __all__ = [ "API_VERSION", - "DBNStore", - "DBNRecord", + "BBOMsg", "BentoClientError", "BentoError", "BentoHttpError", "BentoServerError", + "CBBOMsg", "Compression", - "Publisher", + "DBNRecord", + "DBNStore", "Dataset", - "Venue", "Delivery", "Encoding", + "ErrorMsg", "FeedMode", - "RecordFlags", "Historical", "HistoricalGateway", + "ImbalanceMsg", + "InstrumentDefMsg", "InstrumentMap", "Live", - "Reference", + "MBOMsg", + "MBP1Msg", + "MBP10Msg", + "Metadata", + "OHLCVMsg", "Packaging", + "Publisher", "ReconnectPolicy", + "RecordFlags", + "Reference", "RollRule", + "SType", "Schema", "SplitDuration", - "StatType", - "SType", - "SymbologyResolution", - # DBN Record Types - "Metadata", - "BBOMsg", - "CBBOMsg", - "ErrorMsg", - "ImbalanceMsg", - "InstrumentDefMsg", - "MBOMsg", - "MBP1Msg", - "MBP10Msg", - "OHLCVMsg", "StatMsg", + "StatType", "StatusMsg", "SymbolMappingMsg", + "SymbologyResolution", "SystemMsg", "TradeMsg", + "Venue", ] # Setup logging From f645e724e6fa5e753f9394c0bfbe8189f2edd3f6 Mon Sep 17 00:00:00 2001 From: Zach Banks Date: Mon, 9 Dec 2024 14:28:55 +0000 Subject: [PATCH 2/5] FIX: Fix type annotation for mypy --- databento/common/dbnstore.py | 2 +- pyproject.toml | 1 + scripts/lint.sh | 5 ++--- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/databento/common/dbnstore.py b/databento/common/dbnstore.py index 117dad1..ec3839e 100644 --- a/databento/common/dbnstore.py +++ b/databento/common/dbnstore.py @@ -1331,7 +1331,7 @@ def __init__( count: int | None = None, ) -> None: self._reader = reader - self._dtype = np.dtype(dtype) + self._dtype: np.typing.DTypeLike = np.dtype(dtype) self._offset = offset self._count = count self._close_on_next = False diff --git a/pyproject.toml b/pyproject.toml index bb6f54e..e2091a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -73,6 +73,7 @@ no_strict_optional = true warn_no_return = true warn_unused_configs = true warn_unused_ignores = true +plugins = ["numpy.typing.mypy_plugin"] [tool.pytest.ini_options] testpaths = ["tests"] diff --git a/scripts/lint.sh b/scripts/lint.sh index 50165e0..1b24336 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash -echo $(mypy --version) -echo Running mypy... -poetry run mypy databento examples tests +echo "Running $(poetry run mypy --version)..." +poetry run mypy . From dbb0ed4db07ef066f412d828553b994caaa93346 Mon Sep 17 00:00:00 2001 From: Nick Macholl Date: Tue, 10 Dec 2024 13:27:34 -0800 Subject: [PATCH 3/5] MOD: Update databento_dbn to 0.24.0 --- CHANGELOG.md | 6 ++++++ README.md | 2 +- pyproject.toml | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d333595..101f21f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.46.0 - TBD + +#### Enhancements +- Upgraded `databento-dbn` to 0.24.0 + - Added handling for `UNDEF_TIMESTAMP` in `pretty_` timestamp getters for Python. They now return `None` in the case of `UNDEF_TIMESTAMP` + ## 0.45.0 - 2024-11-12 This release adds support for Python v3.13. diff --git a/README.md b/README.md index e99d2ac..61ad7f8 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ The library is fully compatible with the latest distribution of Anaconda 3.9 and The minimum dependencies as found in the `pyproject.toml` are also listed below: - python = "^3.9" - aiohttp = "^3.8.3" -- databento-dbn = "0.23.1" +- databento-dbn = "0.24.0" - numpy= ">=1.23.5" - pandas = ">=1.5.3" - pip-system-certs = ">=4.0" (Windows only) diff --git a/pyproject.toml b/pyproject.toml index e2091a9..5a6521e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ aiohttp = [ {version = "^3.8.3", python = "<3.12"}, {version = "^3.9.0", python = "^3.12"} ] -databento-dbn = "0.23.1" +databento-dbn = "0.24.0" numpy = [ {version = ">=1.23.5", python = "<3.12"}, {version = ">=1.26.0", python = "^3.12"} From 748b26d7435d02700f88c76d4e76694a5cce7df4 Mon Sep 17 00:00:00 2001 From: Nick Macholl Date: Mon, 9 Dec 2024 16:58:26 -0800 Subject: [PATCH 4/5] DEL: Remove packaging for batch.submit_job --- CHANGELOG.md | 1 + databento/historical/api/batch.py | 17 ----------------- tests/test_historical_batch.py | 28 ++++++++++++---------------- 3 files changed, 13 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 101f21f..098fb74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 0.46.0 - TBD #### Enhancements +- Removed deprecated `packaging` parameter from `Historical.batch.submit_job`. Job files can be downloaded individually or as zip files after the job completes - Upgraded `databento-dbn` to 0.24.0 - Added handling for `UNDEF_TIMESTAMP` in `pretty_` timestamp getters for Python. They now return `None` in the case of `UNDEF_TIMESTAMP` diff --git a/databento/historical/api/batch.py b/databento/historical/api/batch.py index e75ece8..4778272 100644 --- a/databento/historical/api/batch.py +++ b/databento/historical/api/batch.py @@ -27,9 +27,7 @@ from databento.common import API_VERSION from databento.common.constants import HTTP_STREAMING_READ_SIZE from databento.common.enums import Delivery -from databento.common.enums import Packaging from databento.common.enums import SplitDuration -from databento.common.error import BentoDeprecationWarning from databento.common.error import BentoError from databento.common.error import BentoHttpError from databento.common.error import BentoWarning @@ -40,7 +38,6 @@ from databento.common.parsing import optional_values_list_to_string from databento.common.parsing import symbols_list_to_list from databento.common.publishers import Dataset -from databento.common.types import Default from databento.common.validation import validate_enum from databento.common.validation import validate_path from databento.common.validation import validate_semantic_string @@ -75,7 +72,6 @@ def submit_job( split_symbols: bool = False, split_duration: SplitDuration | str = "day", split_size: int | None = None, - packaging: Packaging | str | None = Default(None), # type: ignore [assignment] delivery: Delivery | str = "download", stype_in: SType | str = "raw_symbol", stype_out: SType | str = "instrument_id", @@ -127,8 +123,6 @@ def submit_job( split_size : int, optional The maximum size (bytes) of each batched data file before being split. Must be an integer between 1e9 and 10e9 inclusive (1GB - 10GB). - packaging : Packaging or str {'none', 'zip', 'tar'}, optional - The archive type to package all batched data files in. delivery : Delivery or str {'download', 's3', 'disk'}, default 'download' The delivery mechanism for the processed batched data files. stype_in : SType or str, default 'raw_symbol' @@ -151,14 +145,6 @@ def submit_job( stype_in_valid = validate_enum(stype_in, SType, "stype_in") symbols_list = symbols_list_to_list(symbols, stype_in_valid) - if isinstance(packaging, Default): - packaging = packaging.value - else: - warnings.warn( - message="The `packaging` parameter is deprecated and will be removed in a future release.", - category=BentoDeprecationWarning, - ) - data: dict[str, object | None] = { "dataset": validate_semantic_string(dataset, "dataset"), "start": datetime_to_string(start), @@ -178,9 +164,6 @@ def submit_job( "split_duration": str( validate_enum(split_duration, SplitDuration, "split_duration"), ), - "packaging": ( - str(validate_enum(packaging, Packaging, "packaging")) if packaging else None - ), "delivery": str(validate_enum(delivery, Delivery, "delivery")), } diff --git a/tests/test_historical_batch.py b/tests/test_historical_batch.py index 4bb2584..d91212e 100644 --- a/tests/test_historical_batch.py +++ b/tests/test_historical_batch.py @@ -5,7 +5,6 @@ import databento as db import pytest import requests -from databento.common.error import BentoDeprecationWarning from databento.historical.client import Historical @@ -64,20 +63,18 @@ def test_batch_submit_job_sends_expected_request( monkeypatch.setattr(requests, "post", mocked_post := MagicMock()) # Act - with pytest.warns(BentoDeprecationWarning): - historical_client.batch.submit_job( - dataset="GLBX.MDP3", - symbols="ESH1", - schema="trades", - start="2020-12-28T12:00", - end="2020-12-29", - encoding="csv", - split_duration="day", - split_size=10000000000, - packaging="none", - delivery="download", - compression="zstd", - ) + historical_client.batch.submit_job( + dataset="GLBX.MDP3", + symbols="ESH1", + schema="trades", + start="2020-12-28T12:00", + end="2020-12-29", + encoding="csv", + split_duration="day", + split_size=10000000000, + delivery="download", + compression="zstd", + ) # Assert call = mocked_post.call_args.kwargs @@ -100,7 +97,6 @@ def test_batch_submit_job_sends_expected_request( "map_symbols": False, "split_symbols": False, "split_duration": "day", - "packaging": "none", "delivery": "download", "split_size": "10000000000", } From f18c02a2140078615a7068edf675d3645a8bee13 Mon Sep 17 00:00:00 2001 From: Nick Macholl Date: Tue, 10 Dec 2024 14:30:13 -0800 Subject: [PATCH 5/5] VER: Release 0.46.0 --- CHANGELOG.md | 2 +- databento/version.py | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 098fb74..8bcb570 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 0.46.0 - TBD +## 0.46.0 - 2024-12-10 #### Enhancements - Removed deprecated `packaging` parameter from `Historical.batch.submit_job`. Job files can be downloaded individually or as zip files after the job completes diff --git a/databento/version.py b/databento/version.py index 4d8afa5..6f70987 100644 --- a/databento/version.py +++ b/databento/version.py @@ -1 +1 @@ -__version__ = "0.45.0" +__version__ = "0.46.0" diff --git a/pyproject.toml b/pyproject.toml index 5a6521e..fe3a276 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "databento" -version = "0.45.0" +version = "0.46.0" description = "Official Python client library for Databento" authors = [ "Databento ",