pyMetadataEditor
A Python client for Metadata Editor: create, edit, and manage metadata for microdata, indicators, geospatial data, documents, scripts, images, and videos.
Installation
This project uses Poetry:
pip install poetry
cd pymetadataeditor
poetry install
The LLM-assisted metadata features (OpenAI, tiktoken, markitdown) are optional: poetry install --extras llm, or pip install "pymetadataeditor[llm]".
For development (pytest, pre-commit):
poetry install --with dev
poetry run pre-commit install
Quick start
from pymetadataeditor import MetadataEditor
import os
me = MetadataEditor(
api_url=os.getenv("METADATA_API_URL"), # e.g. https://host/index.php/api
api_key=os.getenv("METADATA_API_KEY"),
verify_ssl=False, # set True when SSL is verified on your server
)
List projects
list returns one page (summary fields, no metadata) plus the server total:
response = me.projects.list(limit=10, metadata_type="indicator", keywords="literacy rate")
print(response["total"])
for project in response["projects"]:
print(project["id"], project["type"], project["title"])
Filters: keywords, metadata_type, collection (+ exclude_collections=True), tag, ownership, users,
created_by, changed_by, date_start / date_end (last changed), sort_by. List filters accept Python lists.
me.projects.facets() returns the available types, collections and their counts.
To go through every matching project, iterate instead of loading everything at once:
for project in me.projects.iter_all(metadata_type="indicator", page_size=500):
...
me.projects.count(collection=12) # just the number
me.projects.list_all(metadata_type="table") # everything in memory: {"projects": [...], "total": n}
iter_all pages in id order, so projects edited while you iterate are neither skipped nor repeated. Other large
listings have the same pattern: me.collections.iter_projects, me.jobs.iter_all, me.codelists.iter_all,
me.codelists.iter_codes, me.data_structures.iter_all, me.indicators.iter_data_rows.
Create a project (template-aware)
demo_name = "my_indicator_demo"
metadata = {
"idno": demo_name,
"series_description": {
"idno": demo_name,
"name": "Version 1",
},
}
project_id = me.metadata.create(
metadata,
metadata_type_or_template_uid="indicator",
)
Read metadata back
model = me.metadata.get(project_id, output_mode="pydantic")
model.pretty_print()
API overview (v2)
Thin clients return raw API JSON (dict). Workflow helpers on me.metadata handle validation and Pydantic/Excel conversion.
| Client | Role |
|---|---|
me.projects |
List, get, create, update, patch, delete projects |
me.metadata |
Template-aware create, update, get (dict / pydantic / excel) |
me.collections |
Collections and membership |
me.templates |
Template CRUD |
me.resources |
External resources (reports, questionnaires, files) |
me.jobs |
Background jobs (publish to NADA, indicator data import, poll, list) |
me.publish |
Publish metadata and indicator DSD/data to NADA (synchronous) |
me.uploads |
Resumable (chunked) file uploads |
me.data_structures |
Data structure (DSD) registry: structures, components, CSV/JSON/SDMX import, export |
me.codelists |
Codelist registry: codelists, codes, translations, import/export |
me.indicators |
Indicator projects: bind a DSD, load/export data, chart data, notes, publish |
me.api |
Generic get / post / put / delete for any path |
API errors raise ApiError (status_code, message, errors), a subclass of requests HTTPError.
Methods still on me directly include make_metadata_outline, read_metadata_from_excel, draft_metadata_from_files, and related helpers.
Breaking change: v1 flat methods (list_projects, create_project_log, …) were removed. See legacy-migration.MD.
Direct HTTP (me.api)
For endpoints without a typed wrapper yet:
me.api.get("/editor", params={"limit": 5})
me.api.post("/collections/add_projects", json={"collections": [1], "id_format": "id", "projects": [101]})
POST body styles:
json={...}— JSON API payloadsdata={...}— form fieldsdata={...}+files={...}— multipart uploads
Many deletes use POST in restricted networks (e.g. me.projects.delete, me.collections.delete), not HTTP DELETE.
Publish to NADA
me.publish.* publishes now and returns NADA's answers; me.jobs.queue_* methods queue a job on the
editor's worker and return its uuid (pass wait=True to block until it finishes). Both take the same steps:
options = {"overwrite": "yes", "published": 1, "access_policy": "licensed", "repositoryid": "MY_COLLECTION"}
# now: {"results": {...}, "errors": {...}} per step
me.publish.project(123, catalog_connection_id=1, publish_thumbnail=False, options=options)
# background job
job = me.jobs.queue_publish_to_nada(123, catalog_connection_id=1, publish_thumbnail=False, options=options)
result = me.jobs.wait(job["uuid"], timeout_seconds=3600)
Single steps: me.publish.metadata, indicator_data, thumbnail, resources, resource, delete_nada_resources.
Step-by-step notebook: demo/publish_to_nada_jobs.ipynb.
Guides
- Indicators — data structures, loading data, notes, publishing to NADA, pandas helpers
- Metadata workflows — outlines, Pydantic, Excel, retrieving metadata
- LLM-assisted metadata — draft and augment from documents and URLs
- API examples — collections, copying projects, and common tasks
- Migrating from v1 — old → new method mapping
- API reference — regenerate with
python make_docs.py
Contributing
Poetry troubleshooting (Windows)
If NumPy or path-length errors occur:
- Enable long paths in Windows, or
- Run
poetry config virtualenvs.in-project truethenpoetry install
Tests
poetry run pytest tests/test_interface.py -q
API documentation
python make_docs.py # demo notebooks -> docs/*.md, and docs/API_Reference.md
python make_docs.py --api-only # only docs/API_Reference.md
Notes
Parts of this codebase were written with the assistance of ChatGPT, in keeping with World Bank Group practice.
Metadata
Release files for pymetadataeditor 0.5.1
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 |
|---|---|---|---|---|
| pymetadataeditor-0.5.1.tar.gz | 60.3 kB | With provenance | Details for pymetadataeditor-0.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pymetadataeditor-0.5.1-py3-none-any.whl | Python 3 | none | any | Details for pymetadataeditor-0.5.1-py3-none-any.whl |
Total release size: 129.7 kB
Release files / pymetadataeditor-0.5.1.tar.gz
| Download URL | pymetadataeditor-0.5.1.tar.gz |
|---|---|
| Size | 60.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e59a60a515fbb19a9eeb9c5470e606a00993a52bda9fe2e65990ebbb15830903
|
|
BLAKE2b-256 checksum How to use checksums |
2ba47a3f7b0782225e03f0c72d7e719fe28c4c96350175fde6f7684120ba0c4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 12, 2026.
Transparency logRelease files / pymetadataeditor-0.5.1-py3-none-any.whl
| Download URL | pymetadataeditor-0.5.1-py3-none-any.whl |
|---|---|
| Size | 69.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
23dca3acdb6715a072cc2e21a5b80af541507fd9e520912b9e7d3c2e70301f60
|
|
BLAKE2b-256 checksum How to use checksums |
537ba877bbc2e22d16e230419057d812ecaf0d3d8dac0424ec195de8a14ddc76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 12, 2026.
Transparency logSecurity for pymetadataeditor 0.5.1
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
Both files in this release have been uploaded with provenance metadata.
Attestation for pymetadataeditor-0.5.1.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 Nov 12, 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.