git: 36730b285c55 - main - misc/py-polars: correct dependencies; add tests

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 13 Oct 2026 19:24:18 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=36730b285c55049758bd02b96fca4bde88456dca

commit 36730b285c55049758bd02b96fca4bde88456dca
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2026-10-13 06:44:22 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-10-13 19:24:13 +0000

    misc/py-polars: correct dependencies; add tests
---
 misc/py-polars/Makefile         | 22 ++++++++++++++++++++--
 misc/py-polars/files/example.py | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/misc/py-polars/Makefile b/misc/py-polars/Makefile
index 61e7573a6391..b564048d52d5 100644
--- a/misc/py-polars/Makefile
+++ b/misc/py-polars/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	polars
 DISTVERSIONPREFIX=	py-
 DISTVERSION=	2.0.0
+PORTREVISION=	1
 CATEGORIES=	misc
 #MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -20,8 +21,13 @@ RUN_DEPENDS+=	${PYTHON_PKGNAMEPREFIX}polars-runtime-${runtime}==${DISTVERSION}:m
 # optional dependencies
 RUN_DEPENDS+=	${PYTHON_PKGNAMEPREFIX}altair>=5.4.0:graphics/py-altair@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}cloudpickle>0:devel/py-cloudpickle@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}great-tables>0:devel/py-great-tables@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}gevent>0:devel/py-gevent@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}great-tables>=0.8.0:devel/py-great-tables@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}matplotlib>0:math/py-matplotlib@${PY_FLAVOR}
+TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}deltalake>0:databases/py-deltalake@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}moto>0:devel/py-moto@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pyiceberg>0:databases/py-pyiceberg@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytest-xdist>0:devel/py-pytest-xdist@${PY_FLAVOR}
 
 USES=		python
 USE_PYTHON=	pep517 autoplist pytest
@@ -32,7 +38,14 @@ GH_ACCOUNT=	pola-rs
 WRKSRC_SUBDIR=	py-polars
 
 TEST_ENV=	${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
-TEST_WRKSRC=	${CARGO_WRKSRC}/tests
+TEST_ARGS=	--disable-plugin-autoload \
+		-p moto \
+		-p xdist
+TEST_WRKSRC=	${WRKSRC}/tests
+TEST_ARGS+=	--ignore=unit/io/test_delta_deletion_vector.py # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=299351
+TEST_ARGS+=	--ignore=unit/io/test_iceberg.py # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=299351
+TEST_ARGS+=	--ignore=unit/operations/test_comparison.py # https://github.com/pola-rs/polars/issues/29906
+TEST_ARGS+=	--ignore=unit/operations/test_join.py # https://github.com/pola-rs/polars/issues/29906
 
 BINARY_ALIAS=	python3=${PYTHON_CMD}
 
@@ -40,4 +53,9 @@ NO_ARCH=	yes
 
 PORTSCOUT=	limit:^py-
 
+test-quick: stage
+	@cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} ${FILESDIR}/example.py
+
+# tests as of 2.0.0: 270 failed, 40160 passed, 67 skipped, 13 xfailed in 892.77s (0:14:52) # see https://github.com/pola-rs/polars/issues/29907 about failing tests
+
 .include <bsd.port.mk>
diff --git a/misc/py-polars/files/example.py b/misc/py-polars/files/example.py
new file mode 100644
index 000000000000..b515c2905142
--- /dev/null
+++ b/misc/py-polars/files/example.py
@@ -0,0 +1,32 @@
+import polars as pl
+
+# Create a DataFrame
+data = {'Name': ['Alice', 'Bob', 'Charlie', 'David'],
+        'Age': [25, 30, 22, 28],
+        'City': ['New York', 'London', 'Paris', 'Tokyo']}
+
+df = pl.DataFrame(data)
+
+# Print the DataFrame
+print("Original DataFrame:")
+print(df)
+
+# Select columns
+names_ages = df.select(['Name', 'Age'])
+print("\nSelected columns (Name and Age):")
+print(names_ages)
+
+# Filter rows
+adults = df.filter(pl.col('Age') >= 25)
+print("\nRows where Age is greater than or equal to 25:")
+print(adults)
+
+# Add a new column
+df = df.with_columns(pl.col('Age') * 2).rename({'Age': 'Double_Age'})
+print("\nDataFrame with a new column (Double_Age):")
+print(df)
+
+# Group by and aggregate
+average_age_by_city = df.group_by('City').agg(pl.mean('Double_Age'))
+print("\nAverage Double_Age by City:")
+print(average_age_by_city)