Skip to content

INTPYTHON-609 Add support for PyArrow 20 #310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 9, 2025
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
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build:
- asdf install uv latest
- asdf global uv latest
install:
- cd bindings/python && uv sync --no-install-project --group docs
- cd bindings/python && uv sync --no-install-project --frozen --group docs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WIth frozen.. what problems were popping up?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When uv was updating the lock file it was trying to build the current project, but failed since libbson wasn't installed in the enironment.

build:
html:
- cd bindings/python && uv run --no-project sphinx-build -c docs -T -b html docs $READTHEDOCS_OUTPUT/html
- cd bindings/python && uv run --no-project --frozen sphinx-build -c docs -T -b html docs $READTHEDOCS_OUTPUT/html
4 changes: 4 additions & 0 deletions bindings/python/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

---

# Changes in Version 1.8.0 (2025/MM/YY)

- Add support for PyArrow 20.0.

# Changes in Version 1.7.2 (2025/04/23)

- Fix handling of empty embedded arrays.
Expand Down
10 changes: 5 additions & 5 deletions bindings/python/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ default:
@just --list

build-libbson:
uv sync --no-install-project --dev
uv sync --no-install-project --dev --frozen
bash build-libbson.sh

import-check:
Expand All @@ -27,18 +27,18 @@ test *args:
uv run pytest {{args}}

lint:
uv sync --no-install-project --dev
uv sync --no-install-project --dev --frozen
uv run --no-project pre-commit run --hook-stage manual --all-files
uv run --no-project check-manifest -v

docs:
uv sync --no-install-project --group docs
uv sync --no-install-project --group docs --frozen
uv run --no-project sphinx-build -T -b html {{sphinx_opts}} {{docs_build}}/html

docs-serve:
uv sync --no-install-project --group docs --group dev
uv sync --no-install-project --group docs --group dev --frozen
urn run --no-project sphinx-autobuild --watch ./pymongoarrow docs {{docs_build}}/html

docs-linkcheck *args:
uv sync --no-install-project --group docs
uv sync --no-install-project --group docs --frozen
PYTHONHASHSEED=0 uv run --no-project python -m sphinx -q -b linkcheck docs {{docs_build}}/linkcheck {{args}}
12 changes: 6 additions & 6 deletions bindings/python/pymongoarrow/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ class _BsonArrowTypes(enum.Enum):


class BSONExtensionScalar(ExtensionScalar):
def as_py(self):
def as_py(self, *args, **kwargs):
if self.value is None:
return None
return self._bson_class(self.value.as_py())
return self._bson_class(self.value.as_py(*args, **kwargs))


class ObjectIdScalar(BSONExtensionScalar):
Expand Down Expand Up @@ -101,10 +101,10 @@ def __arrow_ext_deserialize__(self, storage_type, serialized):


class Decimal128Scalar(ExtensionScalar):
def as_py(self):
def as_py(self, *args, **kwargs):
if self.value is None:
return None
return Decimal128.from_bid(self.value.as_py())
return Decimal128.from_bid(self.value.as_py(*args, **kwargs))


class Decimal128Type(ExtensionType):
Expand All @@ -131,11 +131,11 @@ def __arrow_ext_deserialize__(self, storage_type, serialized):


class BinaryScalar(ExtensionScalar):
def as_py(self):
def as_py(self, *args, **kwargs):
value = self.value
if value is None:
return None
return Binary(self.value.as_py(), self.type.subtype)
return Binary(self.value.as_py(*args, **kwargs), self.type.subtype)


class BinaryType(ExtensionType):
Expand Down
4 changes: 2 additions & 2 deletions bindings/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ requires = [
# Needed for numpy headers.
"numpy>=2.0",
# Must be kept in sync with "project.dependencies" below.
"pyarrow>=19.0,<19.1.0",
"pyarrow>=20.0,<20.1.0",
]

[project]
Expand Down Expand Up @@ -37,7 +37,7 @@ readme = "README.md"
requires-python = ">=3.9"
dependencies = [
# Must be kept in sync with "build_sytem.requires" above.
"pyarrow >=19.0,<19.1",
"pyarrow >=20.0,<20.1",
"pymongo >=4.4,<5",
"pandas >=1.3.5,<3",
"packaging >=23.2",
Expand Down
Loading