Skip to main content

pytuik

CI PyPI Python License: MIT

Unofficial Python client for the Turkish Statistical Institute (TUIK) public data portals. A faithful rewrite of the R package emraher/tuikr.

Disclaimer: This package is not affiliated with or endorsed by TUIK. It is an independent tool for research use. API design derived from emraher/tuikr.

Documentation: https://gohnjalt.github.io/pytuik/

Install

pip install pytuik           # core
pip install "pytuik[geo]"    # + geopandas for boundary geometries

Requires Python ≥ 3.10.

What you get

Service Functions
Statistical portal (veriportali) get_themes, get_resources, get_tables, get_databases
SDMX NSI service (nsiws) get_data, get_data_structure
Geographic portal (cip) geo_variables, geo_data, geo_map

The cookie "session dance" the statistical portal demands, retries with backoff on 5xx and timeouts, an in-memory TTL cache, and the repair of TUIK's invalid, array-wrapped GeoJSON are all handled for you. Every tabular result is a pandas.DataFrame using the same column names as tuikr.

Usage

import pytuik

pytuik.get_themes()                                    # theme_name, theme_id
pytuik.get_tables(theme=101)                           # dataflow + istab tables
pytuik.get_data("TR,DF_ADNKS_T26,1.0", start="2020")   # tidy long observations
pytuik.get_data("TR,DF_ADNKS_T26,1.0", labels=False)   # skip the structure request
pytuik.get_data_structure("TR,DF_ADNKS_T26,1.0")       # dimensions + codelists

Heads-up: as of 2026-08-10 TUIK's SDMX service (nsiws.tuik.gov.tr) returns 401 Unauthorized to anonymous callers, so get_data / get_data_structure raise TuikSDMXError. The portal and geographic functions are unaffected. See known limitations.

Geographic portal (geometry=True needs pip install "pytuik[geo]"):

pytuik.geo_variables()                     # indicator catalog
pytuik.geo_data("1000", level=3)           # long form: code, date, <indicator>
pytuik.geo_map(level=3)                    # GeoDataFrame of the 81 provinces
pytuik.geo_map(level=3, geometry=False)    # attributes only, plain pandas

For connection reuse and configuration, use the client the module-level functions delegate to:

from pytuik import TuikClient

with TuikClient(lang="tr", timeout=60.0, retries=5) as client:
    df = client.get_data("TR,DF_ADNKS_T26,1.0", start="2020")

Full walkthroughs: statistical data · geographic data.

Development

pip install -e ".[dev,geo,docs]"
pytest                # unit + mocked client tests (network excluded by default)
pytest -m contract    # opt-in live-network tests
ruff check .
mypy
mkdocs serve          # docs at http://127.0.0.1:8000

See CONTRIBUTING.md for the architecture rules and release process, and DESIGN.md for the upstream API contracts and the reasoning behind each deviation from tuikr.

Citing

If you use pytuik in research, cite it via CITATION.cff — and please cite tuikr as well.

License

MIT — see LICENSE. tuikr is likewise MIT licensed.

Metadata

Release files for pytuik 0.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 pytuik 0.1.0
File Size Uploaded
pytuik-0.1.0.tar.gz 54.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytuik 0.1.0
File Interpreter ABI Platform
pytuik-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 78.9 kB

Release files / pytuik-0.1.0.tar.gz

Download URL pytuik-0.1.0.tar.gz
Size 54.7 kB
Tags Source
SHA-256 checksum
How to use checksums
52c2b65df2f013836892dd131473f59bbef8af0eb74532b2da6c51c4369d91b3
BLAKE2b-256 checksum
How to use checksums
615c676bf54f3fa4a0e576107784fc4ee23eb452feaad2cd733cf1e99f9face5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 10, 2026.

Transparency log

Release files / pytuik-0.1.0-py3-none-any.whl

Download URL pytuik-0.1.0-py3-none-any.whl
Size 24.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
febebb527b43630c7ec9cc75dd489491c70920a28ec501849ea12b53b4d170b8
BLAKE2b-256 checksum
How to use checksums
ae56e0bc93caeeee832af83eb96722447dd0b8b24ef7e98a00e852013969692f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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