Skip to main content

pgen-polars

Rust-native reader for PLINK 2 .pgen, PLINK 1 .bed, and BGEN v1.2 genotype files, with Python and Polars integration.

Python package installation

Create or activate a Python 3.10 or newer virtual environment, then install the package from PyPI. Because the project is alpha software, pin the exact version in applications and reproducible environments:

python -m venv .venv
source .venv/bin/activate  # Windows PowerShell: .venv\Scripts\Activate.ps1
python -m pip install "pgen-polars==0.1.1"

With uv:

uv add "pgen-polars==0.1.1"

Verify the installation:

python -c "import pgen_polars; print(pgen_polars.__version__)"

Published wheels support CPython 3.10 and newer on Linux (x86-64 and ARM64), macOS (Intel and Apple Silicon), and 64-bit Windows. Building from the source distribution requires Rust 1.85 or newer. pgen-polars currently supports Polars 1.31 through 1.42.

Status: eager and lazy/chunked .bed, .pgen, and BGEN Layout 2 reading is implemented, including ordered sample/variant selection and long or samples-by-variants wide output. Statistics remain deferred. See the roadmap and product specification for details.

Python API

from pgen_polars import read_bgen, read_pgen, scan_bgen, scan_pgen

# read_pgen also accepts PLINK 1 .bed files and auto-detects sidecars.
features = read_pgen(
    "cohort.pgen",
    samples=["sample_42", "sample_7"],
    variants=["variant_1", "variant_2"],
)

lazy = scan_pgen("cohort.pgen", variants=["variant_1", "variant_2"])
selected = lazy.select("ID", "variant_2").collect()

# BGEN v1.2 Layout 2 requires an Oxford .sample file. BGEN does not
# identify the reference allele, so ref_allele must be explicit.
bgen_features = read_bgen(
    "cohort.bgen",
    ref_allele="last",
    samples=["sample_42", "sample_7"],
    rsids=["rs123", "rs456"],
)
bgen_lazy = scan_bgen("cohort.bgen", ref_allele="last")

Metadata readers are also available as read_psam, read_pvar, read_fam, read_bim, and read_sample. Eager readers return Polars DataFrames; scan functions return Polars LazyFrames. Wide output is the default, and output_format="long" enables row-oriented output.

Development

Development requires Rust, uv, and Python 3.10 or newer.

cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
uv venv --python 3.10
uv pip install -e '.[dev]'
uv run pytest tests/python -q

Releases

The package version comes from Cargo.toml. A matching tag such as v0.1.1 builds and tests platform wheels and a source distribution, then publishes them to PyPI through Trusted Publishing.

Metadata

Release files for pgen-polars 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pgen-polars 0.1.1
File Size Uploaded Provenance Actions
pgen_polars-0.1.1.tar.gz 133.8 kB With provenance Details for pgen_polars-0.1.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pgen-polars 0.1.1
File Actions
pgen_polars-0.1.1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for pgen_polars-0.1.1-cp310-abi3-win_amd64.whl
pgen_polars-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for pgen_polars-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
pgen_polars-0.1.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for pgen_polars-0.1.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
pgen_polars-0.1.1-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for pgen_polars-0.1.1-cp310-abi3-macosx_11_0_arm64.whl
pgen_polars-0.1.1-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for pgen_polars-0.1.1-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 107.4 MB

Release files / pgen_polars-0.1.1.tar.gz

Download URL pgen_polars-0.1.1.tar.gz
Size 133.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9d79484d924ffed6b11935a4174339ad38d05270d8c9324f0b5b7f39f1e4df6b
BLAKE2b-256 checksum
How to use checksums
866a07cd9114911155c7344acb14441bb32df4325f47d9648f70147671c64551
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 16, 2026.

Transparency log

Release files / pgen_polars-0.1.1-cp310-abi3-win_amd64.whl

Download URL pgen_polars-0.1.1-cp310-abi3-win_amd64.whl
Size 20.0 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
73511cc1567da2fb64d878acad17b954f63213baea218b2e12420734cb6a34a8
BLAKE2b-256 checksum
How to use checksums
11ad51df73264fea2b0a7db7c18f2ae7062200835d952767d2a55b85d0f07e92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 16, 2026.

Transparency log

Release files / pgen_polars-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pgen_polars-0.1.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 21.6 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
c543712397f6b5e1c51247cb86c54cc11ca44f1c57f4fb3ed6c7360b577ab2a4
BLAKE2b-256 checksum
How to use checksums
6473d94b0d6e190e71ba42cc31ee80a1a6bb7d42ad348145ebd9b465868ea0a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 16, 2026.

Transparency log

Release files / pgen_polars-0.1.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pgen_polars-0.1.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 23.7 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
356eb6fdc2b7fdaee0651cf87c35d44163d806622cfbd6c5666ed9eca48cdf2f
BLAKE2b-256 checksum
How to use checksums
4c2621c90a10bb793d1e3f3e0333c55f14d5f127040baef29ce678a49f2d3a28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 16, 2026.

Transparency log

Release files / pgen_polars-0.1.1-cp310-abi3-macosx_11_0_arm64.whl

Download URL pgen_polars-0.1.1-cp310-abi3-macosx_11_0_arm64.whl
Size 20.5 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
62fe0ea320118ea2ecc5f106b09b6dc5bf27e90993f6b8541f269ea53d467471
BLAKE2b-256 checksum
How to use checksums
a8a4704c2710e28c34bd109dc76d1e339d3f420d10d5b88408de175c3b72ab94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 16, 2026.

Transparency log

Release files / pgen_polars-0.1.1-cp310-abi3-macosx_10_12_x86_64.whl

Download URL pgen_polars-0.1.1-cp310-abi3-macosx_10_12_x86_64.whl
Size 21.6 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
729f9cfbc9f620baf290993629e83519a905e979b0b5dad3380434529bc53888
BLAKE2b-256 checksum
How to use checksums
11604058f89b52253374b4c3061813534565b7b341f0eb5323d97716fb1e3d01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 16, 2026.

Transparency log

Security for pgen-polars 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for pgen_polars-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

6 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page