Add pathlib.Path support to all IO and SQL functions - #339
Conversation
…ks#190) All read_*/scan_*/register_*/write_*/sink_*/describe_* methods now accept Union[str, Path] instead of just str. Conversion str(path) is applied at the FFI boundary in _read_file, _write_file, _write_bam_file, and each describe_* method. Tests added in TestIOPathInputs covering read, scan, and register variants for BAM, BED, VCF, FASTQ, FASTA, and GFF formats. https://claude.ai/code/session_01VKPcoBGRifVhJt8gR29aFt
02cdc93 to
347cecf
Compare
|
@claude pls review |
|
@codex pls review |
|
I'll analyze this and get back to you. |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
I'll analyze this and get back to you. |
|
@mwiewior Something to fix here or we can merge? |
|
Need to review it first. |
|
@codex pls review |
|
Codex Review: Didn't find any major issues. Keep it up! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |

Summary
This PR adds support for
pathlib.Pathobjects across all IO and SQL functions in polars-bio, resolving issue #190. Previously, only string paths were accepted; now users can passPathobjects directly to any read, scan, or register function.Key Changes
polars_bio/io.pyto acceptUnion[str, Path]for all read/scan functions (read_bam, scan_bam, read_bed, scan_bed, read_vcf, scan_vcf, read_fastq, scan_fastq, read_fasta, scan_fasta, read_gff, scan_gff, read_table, scan_table, describe_vcf)polars_bio/sql.pyto acceptUnion[str, Path]for all register functions (register_bam, register_bed, register_vcf, register_gff, register_fastq)path = str(path)conversions at the entry points of internal functions (_read_file, _get_schema, describe_vcf, and all register functions) to ensure Path objects are converted to strings before being passed to underlying C++ bindingsfrom pathlib import Pathimports to both io.py and sql.pyImplementation Details
https://claude.ai/code/session_01VKPcoBGRifVhJt8gR29aFt