Skip to main content

pyBDL

pyBDL is a Python client for the Polish GUS Local Data Bank (Bank Danych Lokalnych, BDL). It offers two complementary interfaces:

  • BDL access layer: convenient pandas.DataFrame results for exploratory analysis.
  • BDL.api layer: 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_KEY
  • BDL_LANGUAGE
  • BDL_FORMAT
  • BDL_USE_CACHE
  • BDL_CACHE_EXPIRY
  • BDL_PROXY_URL
  • BDL_PROXY_USERNAME
  • BDL_PROXY_PASSWORD
  • BDL_PAGE_SIZE
  • BDL_REQUEST_RETRIES
  • BDL_RETRY_BACKOFF_FACTOR
  • BDL_MAX_RETRY_DELAY
  • BDL_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 main update the main mike version (tip-of-tree docs).
  • A successful Release workflow run deploys {semver} and moves the latest alias to that release; the site root redirects to latest.

Key documentation pages:

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)

Source distribution for pyBDL 1.1.0
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)

Table of built distributions (wheels) for pyBDL 1.1.0
File Interpreter ABI Platform Actions
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 log

Release 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 log

Security 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.

Select from 2 files

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 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

1.1.0 This release

2 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