Skip to content

Commit

Permalink
VER: Release 0.45.0
Browse files Browse the repository at this point in the history
See release notes.
  • Loading branch information
nmacholl authored Nov 12, 2024
2 parents e6ea548 + 10f25ca commit d073957
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
name: build - Python ${{ matrix.python-version }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}

Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 0.45.0 - 2024-11-12

This release adds support for Python v3.13.

#### Enhancements
- Added support for Python 3.13
- Added new IntelligentCross venues `ASPN`, `ASMT`, and `ASPI`
- Upgraded `databento-dbn` to 0.23.1
- Fixed `pretty_activation` getter in `databento_dbn` returning `expiration` instead
- Fixed some `pretty_` getters in `databento_dbn` didn't correctly handle `UNDEF_PRICE`

#### Deprecations
- Deprecated `packaging` parameter for `Historical.batch.submit_job` which will be removed in a future release

## 0.44.1 - 2024-10-29

#### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.0"
- databento-dbn = "0.23.1"
- numpy= ">=1.23.5"
- pandas = ">=1.5.3"
- pip-system-certs = ">=4.0" (Windows only)
Expand Down
27 changes: 27 additions & 0 deletions databento/common/publishers.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ class Venue(StringyMixin, str, Enum):
Long-Term Stock Exchange, Inc..
XOFF
Off-Exchange Transactions - Listed Instruments.
ASPN
IntelligentCross ASPEN Intelligent Bid/Offer.
ASMT
IntelligentCross ASPEN Maker/Taker.
ASPI
IntelligentCross ASPEN Inverted.
"""

Expand Down Expand Up @@ -148,6 +154,9 @@ class Venue(StringyMixin, str, Enum):
SPHR = "SPHR"
LTSE = "LTSE"
XOFF = "XOFF"
ASPN = "ASPN"
ASMT = "ASMT"
ASPI = "ASPI"

@classmethod
def from_int(cls, value: int) -> Venue:
Expand Down Expand Up @@ -240,6 +249,12 @@ def from_int(cls, value: int) -> Venue:
return Venue.LTSE
if value == 43:
return Venue.XOFF
if value == 44:
return Venue.ASPN
if value == 45:
return Venue.ASMT
if value == 46:
return Venue.ASPI
raise ValueError(f"Integer value {value} does not correspond with any Venue variant")

def to_int(self) -> int:
Expand Down Expand Up @@ -332,6 +347,12 @@ def to_int(self) -> int:
return 42
if self == Venue.XOFF:
return 43
if self == Venue.ASPN:
return 44
if self == Venue.ASMT:
return 45
if self == Venue.ASPI:
return 46
raise ValueError("Invalid Venue")

@property
Expand Down Expand Up @@ -425,6 +446,12 @@ def description(self) -> str:
return "Long-Term Stock Exchange, Inc."
if self == Venue.XOFF:
return "Off-Exchange Transactions - Listed Instruments"
if self == Venue.ASPN:
return "IntelligentCross ASPEN Intelligent Bid/Offer"
if self == Venue.ASMT:
return "IntelligentCross ASPEN Maker/Taker"
if self == Venue.ASPI:
return "IntelligentCross ASPEN Inverted"
raise ValueError("Unexpected Venue value")


Expand Down
13 changes: 12 additions & 1 deletion databento/historical/api/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
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
Expand All @@ -39,6 +40,7 @@
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
Expand Down Expand Up @@ -73,7 +75,7 @@ def submit_job(
split_symbols: bool = False,
split_duration: SplitDuration | str = "day",
split_size: int | None = None,
packaging: Packaging | str | 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",
Expand Down Expand Up @@ -148,6 +150,15 @@ 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),
Expand Down
2 changes: 1 addition & 1 deletion databento/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.44.1"
__version__ = "0.45.0"
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "databento"
version = "0.44.1"
version = "0.45.0"
description = "Official Python client library for Databento"
authors = [
"Databento <support@databento.com>",
Expand All @@ -27,12 +27,12 @@ repository = "https://github.com/databento/databento-python"
"Bug Tracker" = "https://github.com/databento/databento-python/issues"

[tool.poetry.dependencies]
python = ">=3.9,<3.13"
python = ">=3.9,<3.14"
aiohttp = [
{version = "^3.8.3", python = "<3.12"},
{version = "^3.9.0", python = "^3.12"}
]
databento-dbn = "0.23.0"
databento-dbn = "0.23.1"
numpy = [
{version = ">=1.23.5", python = "<3.12"},
{version = ">=1.26.0", python = "^3.12"}
Expand Down
4 changes: 3 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,6 @@ async def fixture_live_client(
with mock_live_server.test_context():
yield test_client

test_client.stop()
if test_client.is_connected():
test_client.stop()
await test_client.wait_for_close()
7 changes: 6 additions & 1 deletion tests/mockliveserver/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ def _command_active_count(self, *_: str) -> None:
"""
Log the number of active connections.
"""
count = self._server._active_count # type: ignore [attr-defined]
# _active_count was removed in Python 3.13
if hasattr(self._server, "_active_count"):
count = self._server._active_count
else:
count = len(self._server._clients) # type: ignore [attr-defined]

logger.info("active connections: %d", count)

def _command_add_key(self, key: str) -> None:
Expand Down
28 changes: 15 additions & 13 deletions tests/test_historical_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import databento as db
import pytest
import requests
from databento.common.error import BentoDeprecationWarning
from databento.historical.client import Historical


Expand Down Expand Up @@ -63,19 +64,20 @@ def test_batch_submit_job_sends_expected_request(
monkeypatch.setattr(requests, "post", mocked_post := MagicMock())

# Act
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",
)
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",
)

# Assert
call = mocked_post.call_args.kwargs
Expand Down

0 comments on commit d073957

Please sign in to comment.