pyBDL
pyBDL is a Python client for the Polish GUS Local Data Bank (Bank Danych Lokalnych, BDL).
It offers two complementary interfaces:
BDLaccess layer: convenientpandas.DataFrameresults for exploratory analysis.BDL.apilayer: low-level endpoint clients that return raw JSON-compatible dictionaries.
Installation
pip install pyBDL
Quick Start
from pybdl import BDL, BDLConfig
with BDL(BDLConfig(api_key="your-api-key")) as bdl:
levels = bdl.levels.list_levels()
variables = bdl.variables.search_variables(
name="population",
enrich=["levels", "subjects"],
)
data = bdl.data.get_data_by_variable(
variable_id="3643",
years=[2022, 2023],
unit_level=2,
enrich=["units", "attributes"],
)
Configuration
BDLConfig supports direct constructor arguments and environment variables:
BDL_API_KEYBDL_LANGUAGEBDL_FORMATBDL_USE_CACHEBDL_CACHE_EXPIRYBDL_PROXY_URLBDL_PROXY_USERNAMEBDL_PROXY_PASSWORDBDL_PAGE_SIZEBDL_REQUEST_RETRIESBDL_RETRY_BACKOFF_FACTORBDL_MAX_RETRY_DELAYBDL_RETRY_STATUS_CODES
Explicit constructor arguments take precedence over environment variables.
API Layers
Access Layer
Use the default BDL attributes for DataFrame output:
from pybdl import BDL
bdl = BDL()
subjects = bdl.subjects.list_subjects()
data, metadata = bdl.data.get_data_by_variable_with_metadata(
variable_id="3643",
max_pages=1,
)
Raw API Layer
Use bdl.api when you want direct control over the underlying payloads:
from pybdl import BDL
bdl = BDL()
payload = bdl.api.data.get_data_by_variable(
variable_id="3643",
max_pages=1,
)
payload_with_meta = bdl.api.data.get_data_by_variable_with_metadata(
variable_id="3643",
max_pages=1,
)
Highlights
- Automatic pagination helpers for collection endpoints
- Sync and async endpoint clients
- Built-in rate limiting with persistent quota tracking
- Configurable retry/backoff for transient HTTP failures
- Reference-data enrichment via
enrich=[...] - Context-manager support for clean session lifecycle management
Documentation
Documentation uses MkDocs Material with
mkdocstrings and mike for versioned
GitHub Pages (gh-pages branch). To build locally:
uv sync --group docs
make docs
# or: uv run mkdocs serve # live reload at http://127.0.0.1:8000
The static site is written to site/ (gitignored). On GitHub Pages (gh-pages branch, / root):
- Pushes to
mainupdate themainmike version (tip-of-tree docs). - A successful Release workflow run deploys
{semver}and moves thelatestalias to that release; the site root redirects tolatest.
Key documentation pages:
- Main client — BDL client, access vs API layer, context manager, async
- Access layer — DataFrame interface, enrichment, pagination, metadata
- API clients — Low-level raw-JSON clients
- Configuration — All options and environment variables
- Rate limiting — Quotas, retry, custom limits
- Examples — Jupyter notebook with real-world examples
- Changelog — Release history
Metadata
Release files for pyBDL 1.1.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 | Provenance | Actions |
|---|---|---|---|---|
| pybdl-1.1.0.tar.gz | 254.9 kB | With provenance | Details for pybdl-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pybdl-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for pybdl-1.1.0-py3-none-any.whl |
Total release size: 307.2 kB
Release files / pybdl-1.1.0.tar.gz
| Download URL | pybdl-1.1.0.tar.gz |
|---|---|
| Size | 254.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
160a8f53713a18c9707c4ee9e8ce0f31d8d910acfee1af8743cecb52e15a8e78
|
|
BLAKE2b-256 checksum How to use checksums |
79398dd7407e05bafde976cb324efda7cb6fdfc6f8b51787b83fb8c7be1c76b8
|
| 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 Jun 26, 2026.
Transparency logRelease files / pybdl-1.1.0-py3-none-any.whl
| Download URL | pybdl-1.1.0-py3-none-any.whl |
|---|---|
| Size | 52.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
77c597822f51fc50a1b0e60d31d3de1d0f01ec5ba2e31dda24594a34435378fc
|
|
BLAKE2b-256 checksum How to use checksums |
5f722af23dd32943fb3e05cbcdba9f49227061d1ab60fbce22df9725bd72c3b9
|
| 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 Jun 26, 2026.
Transparency logSecurity for pyBDL 1.1.0
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 2 files in this release have been uploaded with provenance metadata.
Attestation for pybdl-1.1.0.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 Jun 26, 2026.
Transparency logA 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.