WiktionaryPythonAPI
Synchronous Python client for the Wiktionary REST API and related Commons Core media downloads.
PyPI: wiktionary-api · Import: wikt
Covers all 41 path patterns in the live OpenAPI spec (?spec), plus PDF rendering and Commons helpers. See docs/ENDPOINTS.md for the full path → method map.
Install
Works with any PEP 517 installer:
pip install wiktionary-api
uv add wiktionary-api
poetry add wiktionary-api
Requires Python 3.10+.
Quick start
Wikimedia requires a descriptive User-Agent with your application name and a contact email or URL.
from wikt import Wiktionary
wiki = Wiktionary("MyApp", "you@example.com")
# Definitions (Wiktionary-specific)
print(wiki.get_definition("hello"))
# HTML / revision metadata
print(wiki.get_html("hello")[:200])
print(wiki.get_revision("hello"))
# Math (check → render)
checked = wiki.check_math("tex", "E=mc^2")
svg = wiki.render_math("svg", checked["resource_location"])
API surface (summary)
| Area | Examples |
|---|---|
| Page content | page, get_definition, get_html, get_lint, get_mobile_html, get_revision, get_media_file_list, get_pdf |
| Data / mobile | get_citation, get_mobile_css, get_mobile_javascript, get_i18n |
| Reading lists | get_lists, create_list, update_list, delete_list, entry CRUD, setup/teardown |
| Transforms | transform_wikitext_to_html, transform_html_to_wikitext, transform_wikitext_to_lint, transform_wikitext_to_mobile_html |
| Math | check_math, get_math_formula, render_math |
| Commons helpers | get_media_files, download_media_files |
Method docstrings document parameters, return types, and REST paths. Official sandbox: https://en.wiktionary.org/api/rest_v1/#/
Development
pip install -e ".[dev]"
# or: uv sync --all-extras
ruff check src tests
ruff format src tests
pytest tests/ -v
Publishing
Releases publish to PyPI on v* tags via trusted publishing. See .github/PYPI_PUBLISHING.md.
License
MIT — see LICENSE.
Release files for wiktionary-api 0.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 | |
|---|---|---|---|
| wiktionary_api-0.1.0.tar.gz | 16.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wiktionary_api-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.8 kB
Release files / wiktionary_api-0.1.0.tar.gz
| Download URL | wiktionary_api-0.1.0.tar.gz |
|---|---|
| Size | 16.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
115f126939e799593e7ddbd37cb5552d53197debf5a7085f39b293c4e3facd3b
|
|
BLAKE2b-256 checksum How to use checksums |
df7aa60a12fa7815572408d18fcc2cefc189948a12cc21932f45a790fa7e0a83
|
| 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 Sep 26, 2026.
Transparency logRelease files / wiktionary_api-0.1.0-py3-none-any.whl
| Download URL | wiktionary_api-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
40b579f81b6eb1c27dfd12b85ac59362f9b38bb97c3b6f5b5608d74ac49df1ea
|
|
BLAKE2b-256 checksum How to use checksums |
8a6d2f38547ca588a026336f36361276c47299527852a291044b36430c4b2ace
|
| 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 Sep 26, 2026.
Transparency log