A Pythonic interface for Polish GUS Local Data Bank datasets.
Project description
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
Optional visualization dependencies used in notebooks and examples:
pip install "pyBDL[viz]"
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
Full documentation is built with Sphinx. To build locally:
make docs
# or: cd docs && make html
The built HTML is written to docs/_build/html/.
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
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 pybdl-1.0.0.tar.gz.
File metadata
- Download URL: pybdl-1.0.0.tar.gz
- Upload date:
- Size: 279.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62cc2178fac5a471ff901b5033bdeb792db21d71f3f8e0928e21b582eb4276c6
|
|
| MD5 |
47d7169e8b346eba34b50c3bd0b71d7c
|
|
| BLAKE2b-256 |
231a4c9bf9aade52632182e8bfd0f3f675d86873c784c6d85b7bfb9dce817df3
|
Provenance
The following attestation bundles were made for pybdl-1.0.0.tar.gz:
Publisher:
release.yml on AN0DA/pyBDL
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pybdl-1.0.0.tar.gz -
Subject digest:
62cc2178fac5a471ff901b5033bdeb792db21d71f3f8e0928e21b582eb4276c6 - Sigstore transparency entry: 1191592486
- Sigstore integration time:
-
Permalink:
AN0DA/pyBDL@2b146c27a8bcada6df6e447fde30e72da22f92cb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AN0DA
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2b146c27a8bcada6df6e447fde30e72da22f92cb -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pybdl-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pybdl-1.0.0-py3-none-any.whl
- Upload date:
- Size: 51.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 |
7a67571390608302435907daa6d8e94e4e61bb0f459b3c349f3a1848252fdfe3
|
|
| MD5 |
50d54fdf4b935edc82fd477d0e9438aa
|
|
| BLAKE2b-256 |
1cec0d2691439261982cc3dedd8d0f2f8dcfa048e8fd8216f46d59aa4ded1f92
|
Provenance
The following attestation bundles were made for pybdl-1.0.0-py3-none-any.whl:
Publisher:
release.yml on AN0DA/pyBDL
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pybdl-1.0.0-py3-none-any.whl -
Subject digest:
7a67571390608302435907daa6d8e94e4e61bb0f459b3c349f3a1848252fdfe3 - Sigstore transparency entry: 1191592488
- Sigstore integration time:
-
Permalink:
AN0DA/pyBDL@2b146c27a8bcada6df6e447fde30e72da22f92cb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AN0DA
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2b146c27a8bcada6df6e447fde30e72da22f92cb -
Trigger Event:
workflow_dispatch
-
Statement type: