A Python library for working with digital scholarly editions in polars dataframes.
Project description
dse_polars
Work with DSE triples in a polars dataframe
Publishing for marimo HTML-WASM
This package ships as a pure-Python wheel (py3-none-any), so it can be installed in
Pyodide-based marimo HTML-WASM notebooks as long as runtime package constraints are compatible.
Key compatibility choices in this project:
Requires-Python: >=3.13,<3.14polars>=1.18.0
Build and publish:
python -m pip install -U build twine
python -m build
python -m twine check dist/*
python -m twine upload --repository testpypi dist/*
python -m twine upload dist/*
You can sanity-check that the wheel is pure Python by inspecting the wheel metadata:
unzip -p dist/*.whl '*.dist-info/WHEEL'
and confirming it includes:
Tag: py3-none-any
ctsurn_contains usage
ctsurn_contains returns a Polars expression, so you can use it directly in filter/select.
import polars as pl
from dse_polars.texts import ctsurn_contains
df = pl.DataFrame(
{
"urn": [
"urn:cts:compnov:bible.genesis.sept_latin:1.1",
"urn:cts:compnov:bible.genesis.sept_latin:2.1",
"urn:cts:compnov:bible.exodus.sept_latin:1.1",
]
}
)
query = "urn:cts:compnov:bible.genesis:1"
matches = df.filter(ctsurn_contains(pl.col("urn"), query))
print(matches)
# quick boolean check with literals
is_contained = pl.select(
ctsurn_contains(
"urn:cts:compnov:bible.genesis.sept_latin:1.1",
"urn:cts:compnov:bible.genesis:1",
).alias("ok")
).item(0, 0)
print(is_contained) # True
ptinrect usage
ptinrect returns a Polars expression, so you can use it directly in filter/select.
import polars as pl
from dse_polars.images import ptinrect
rects = pl.DataFrame(
{
"label": ["A", "B"],
"x": [10.0, 100.0],
"y": [20.0, 200.0],
"w": [30.0, 20.0],
"h": [40.0, 20.0],
}
)
# filter rectangles containing a literal point (25, 35)
hits = rects.filter(ptinrect(25.0, 35.0))
print(hits)
# use point columns too
points = pl.DataFrame({"px": [25.0, 130.0], "py": [35.0, 210.0]})
checks = rects.with_columns(points).select(
pl.col("label"),
ptinrect(pl.col("px"), pl.col("py")).alias("contains_point"),
)
print(checks)
textcontents usage
textcontents returns a Python list of values in the text column, excluding nulls.
import polars as pl
from dse_polars.texts import textcontents
df = pl.DataFrame(
{
"urn": ["u1", "u2", "u3", "u4"],
"text": ["alpha", None, "beta", "alpha"],
}
)
contents = textcontents(df)
print(contents) # ['alpha', 'beta', 'alpha']
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dse_polars-0.6.1.tar.gz.
File metadata
- Download URL: dse_polars-0.6.1.tar.gz
- Upload date:
- Size: 8.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
661f1b5d6fdb565f4ac012c900d73182bb9fa01db29a55fc0fddfa693efff7c3
|
|
| MD5 |
62627070d5287649ae862b5fd2dea5ad
|
|
| BLAKE2b-256 |
a7ec9b700073b12598ad94a807fe3ec944914617ad74b8c4eddbd99cb0cf5663
|
Provenance
The following attestation bundles were made for dse_polars-0.6.1.tar.gz:
Publisher:
publish.yml on neelsmith/dse_polars
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dse_polars-0.6.1.tar.gz -
Subject digest:
661f1b5d6fdb565f4ac012c900d73182bb9fa01db29a55fc0fddfa693efff7c3 - Sigstore transparency entry: 1042976162
- Sigstore integration time:
-
Permalink:
neelsmith/dse_polars@bc1ddeab9aa610165d591cc253f354b1e2771c63 -
Branch / Tag:
refs/tags/v0.6.1 - Owner: https://github.com/neelsmith
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bc1ddeab9aa610165d591cc253f354b1e2771c63 -
Trigger Event:
release
-
Statement type:
File details
Details for the file dse_polars-0.6.1-py3-none-any.whl.
File metadata
- Download URL: dse_polars-0.6.1-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01983dd5222fbc2c2e9216d83e00eb2b4fbdc91c08e172d77f71f3fa44c5013d
|
|
| MD5 |
d1c47f784bb6c91d318099d3b9549d11
|
|
| BLAKE2b-256 |
9fac7c5fbc145e2cf8b72c8c835e2070a6b824a03f2c6304415901a598bd1fd5
|
Provenance
The following attestation bundles were made for dse_polars-0.6.1-py3-none-any.whl:
Publisher:
publish.yml on neelsmith/dse_polars
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dse_polars-0.6.1-py3-none-any.whl -
Subject digest:
01983dd5222fbc2c2e9216d83e00eb2b4fbdc91c08e172d77f71f3fa44c5013d - Sigstore transparency entry: 1042976169
- Sigstore integration time:
-
Permalink:
neelsmith/dse_polars@bc1ddeab9aa610165d591cc253f354b1e2771c63 -
Branch / Tag:
refs/tags/v0.6.1 - Owner: https://github.com/neelsmith
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bc1ddeab9aa610165d591cc253f354b1e2771c63 -
Trigger Event:
release
-
Statement type: