Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
name: build - Python ${{ matrix.python-version }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}

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

## 0.68.0 - 2025-12-09

This release adds support for Python 3.14.

#### Enhancements
- Added support for Python 3.14
- Functions which accept a path as an argument now expand user directories
- Upgraded `databento-dbn` to 0.45.0
- Added support for Python 3.14

## 0.67.0 - 2025-12-02

#### Enhancements
Expand Down Expand Up @@ -351,7 +361,7 @@ was preventing `ts_out` from being correctly decoded in the Python DBNDecoder

## 0.45.0 - 2024-11-12

This release adds support for Python v3.13.
This release adds support for Python 3.13.

#### Enhancements
- Added support for Python 3.13
Expand Down Expand Up @@ -675,7 +685,7 @@ This release adds support for transcoding DBN data into Apache parquet.

## 0.24.0 - 2023-11-23

This release adds support for DBN v2 as well as Python v3.12.
This release adds support for DBN v2 as well as Python 3.12.

DBN v2 delivers improvements to the `Metadata` header symbology, new `stype_in` and `stype_out` fields for `SymbolMappingMsg`, and extends the symbol field length for `SymbolMappingMsg` and `InstrumentDefMsg`. The entire change notes are available [here](https://github.com/databento/dbn/releases/tag/v0.14.0). Users who wish to convert DBN v1 files to v2 can use the `dbn-cli` tool available in the [databento-dbn](https://github.com/databento/dbn/) crate. On a future date, the Databento live and historical APIs will stop serving DBN v1.

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 distributions of Anaconda 2023.x and above.
The minimum dependencies as found in the `pyproject.toml` are also listed below:
- python = "^3.10"
- aiohttp = "^3.8.3"
- databento-dbn = "~0.44.0"
- databento-dbn = "~0.45.0"
- numpy = ">=1.23.5"
- pandas = ">=1.5.3"
- pip-system-certs = ">=4.0" (Windows only)
Expand Down
9 changes: 5 additions & 4 deletions databento/common/dbnstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
from databento.common.validation import validate_enum
from databento.common.validation import validate_file_write_path
from databento.common.validation import validate_maybe_enum
from databento.common.validation import validate_path


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -138,15 +139,15 @@ class FileDataSource(DataSource):
The name of the file.
nbytes : int
The size of the data in bytes; equal to the file size.
path : PathLike[str] or str
path : Path
The path of the file.
reader : IO[bytes]
A `BufferedReader` for this file-backed data.

"""

def __init__(self, source: PathLike[str] | str):
self._path = Path(source)
def __init__(self, source: Path):
self._path = source

if not self._path.is_file() or not self._path.exists():
raise FileNotFoundError(source)
Expand Down Expand Up @@ -653,7 +654,7 @@ def from_file(cls, path: PathLike[str] | str) -> DBNStore:
If an empty file is specified.

"""
return cls(FileDataSource(path))
return cls(FileDataSource(validate_path(path, "path")))

@classmethod
def from_bytes(cls, data: BytesIO | bytes | IO[bytes]) -> DBNStore:
Expand Down
5 changes: 3 additions & 2 deletions databento/common/symbology.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from databento_dbn import SymbolMappingMsgV1

from databento.common.parsing import datetime_to_unix_nanoseconds
from databento.common.validation import validate_path


class MappingInterval(NamedTuple):
Expand All @@ -49,15 +50,15 @@ def _validate_path_pair(
in_file: PathLike[str] | str,
out_file: PathLike[str] | str | None,
) -> tuple[Path, Path]:
in_file_valid = Path(in_file)
in_file_valid = validate_path(in_file, "in_file")

if not in_file_valid.exists():
raise ValueError(f"{in_file_valid} does not exist")
if not in_file_valid.is_file():
raise ValueError(f"{in_file_valid} is not a file")

if out_file is not None:
out_file_valid = Path(out_file)
out_file_valid = validate_path(out_file, "out_file")
else:
out_file_valid = in_file_valid.with_name(
f"{in_file_valid.stem}_mapped{in_file_valid.suffix}",
Expand Down
4 changes: 2 additions & 2 deletions databento/common/types.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import datetime as dt
import logging
import pathlib
import warnings
from collections.abc import Callable
from os import PathLike
Expand All @@ -13,6 +12,7 @@
import pandas as pd

from databento.common.error import BentoWarning
from databento.common.validation import validate_file_write_path


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -110,7 +110,7 @@ def __init__(
is_managed = False

if isinstance(stream, (str, PathLike)):
stream = pathlib.Path(stream).open("xb")
stream = validate_file_write_path(stream, "stream", False).open("xb")
is_managed = True

if not hasattr(stream, "write"):
Expand Down
11 changes: 9 additions & 2 deletions databento/common/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

def validate_path(value: PathLike[str] | str, param: str) -> Path:
"""
Validate whether the given value is a valid path.
Validate whether the given value is a valid path. This also expands user
directories to form valid paths.

Parameters
----------
Expand All @@ -38,10 +39,12 @@ def validate_path(value: PathLike[str] | str, param: str) -> Path:
------
TypeError
If value is not a valid path.
RuntimeError
If a user's home directory cannot be expanded.

"""
try:
return Path(value)
return Path(value).expanduser()
except TypeError:
raise TypeError(
f"The `{param}` was not a valid path type. " "Use any of [PathLike[str], str].",
Expand Down Expand Up @@ -72,6 +75,10 @@ def validate_file_write_path(

Raises
------
TypeError
If value is not a valid path.
RuntimeError
If a user's home directory cannot be expanded.
IsADirectoryError
If path is a directory.
FileExistsError
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.67.0"
__version__ = "0.68.0"
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "databento"
version = "0.67.0"
version = "0.68.0"
description = "Official Python client library for Databento"
readme = "README.md"
requires-python = ">=3.10"
Expand All @@ -10,7 +10,7 @@ dynamic = [ "classifiers" ]
dependencies = [
"aiohttp>=3.8.3,<4.0.0; python_version < '3.12'",
"aiohttp>=3.9.0,<4.0.0; python_version >= '3.12'",
"databento-dbn~=0.44.0",
"databento-dbn~=0.45.0",
"numpy>=1.23.5; python_version < '3.12'",
"numpy>=1.26.0; python_version >= '3.12'",
"pandas>=1.5.3",
Expand Down Expand Up @@ -42,7 +42,7 @@ classifiers = [
]

[tool.poetry.dependencies]
python = ">=3.10,<3.14"
python = ">=3.10,<3.15"

[tool.poetry.group.dev.dependencies]
black = "^23.9.1"
Expand Down