“contexte” Python package: load a resource in one line
The “contexte” package loads any public resource of the catalogue into your Python code: the rows of a dataset, a prompt to fill, a context ready for a chat API. It only uses the standard library and needs no account and no key.
Installation
pip install contexte
Load a resource
A resource is referenced as “author/name”, by its identifier or by its short code (end of its URL, for example jr6t0n). “code#v2” or version=2 loads a fixed version.
import contexte
ds = contexte.load("13n9ym0") # dataset → ds.rows
print(len(ds), ds[0])
p = contexte.load("jr6t0n") # prompt
print(p.variables)
texte = p.fill(produit="…", caracteristiques="…", public="…")
c = contexte.load("contextetech/anonymisation-rgpd") # contexte
messages = c.messages("Text to process")
v1 = contexte.load("13n9ym0#v1") # fixed version | Object | What it gives |
|---|---|
Dataset | rows (list of rows), len(), for loop |
Prompt | template, variables, fill(**values) |
Context | system_prompt(), examples, messages(text) |
Resource | Any other resource, as a dictionary |
Search and estimate the cost
contexte.search("customs code", kind="dataset", lang="en")
contexte.cost("13n9ym0") # tokens and euros per model Command line
The “contexte” command is installed with the package:
contexte get 13n9ym0 -o data/ contexte search gdpr --kind dataset --lang en contexte mcp # MCP server
In an AI assistant
The same package contains the MCP server: see the MCP documentation.