uniprotlib
Note: This library was vibe coded with Claude. It works, it's tested, but review accordingly.
Python library for parsing UniProt XML files. Handles both single-entry downloads and multi-GB gzip-compressed database dumps with bounded memory usage.
Installation
pip install uniprotlib
Or with uv:
uv add uniprotlib
Usage
from uniprotlib import parse_xml
# single file
for entry in parse_xml("Q9Y261.xml"):
print(entry.primary_accession, entry.protein_name)
# gzipped bulk download
for entry in parse_xml("uniprot_sprot.xml.gz"):
print(entry.gene.primary, entry.organism.scientific_name)
# multiple files
for entry in parse_xml("human.xml.gz", "mouse.xml.gz"):
print(entry.primary_accession)
parse_xml() returns an iterator that yields UniProtEntry objects. Gzip detection is automatic based on the .gz extension. Memory stays bounded regardless of file size.
Parsed fields
| Model | Fields |
|---|---|
UniProtEntry |
primary_accession, accessions, entry_name, dataset, protein_name, gene, organism, sequence, keywords, db_references |
Gene |
primary, synonyms, ordered_locus_names, orf_names |
Organism |
scientific_name, common_name, tax_id, lineage |
Sequence |
value, length, mass, checksum |
DbReference |
type, id, molecule, properties |
All model classes are dataclasses with full type annotations and py.typed support.
Development
Requires Python >= 3.12 and uv.
uv sync
uv run pytest tests/ -v
License
MIT
Metadata
Release files for uniprotlib 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| uniprotlib-0.2.0.tar.gz | 93.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| uniprotlib-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 100.8 kB
Release files / uniprotlib-0.2.0.tar.gz
| Download URL | uniprotlib-0.2.0.tar.gz |
|---|---|
| Size | 93.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b06c0a0fcb533c41f9f23d8bc774ab059185f151c14037a5aacc5fa49780072a
|
|
BLAKE2b-256 checksum How to use checksums |
9ad9cb395465c719163bee53aff75bb8f35d6628fa664502d3b4e56304033dd3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 2, 2026.
Transparency logRelease files / uniprotlib-0.2.0-py3-none-any.whl
| Download URL | uniprotlib-0.2.0-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
030b7083232e9a0dc6a10a3b3bcc193dabbddde4f8b11d27f5d26b0aaffe77b6
|
|
BLAKE2b-256 checksum How to use checksums |
ee28a16af47aa870800e8fa79f9fa93651defa0d5c733b60a1314a7efd7ace95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 2, 2026.
Transparency log