Skip to content

onlyworlds 0.19.0

Choose a tag to compare

@github-actions github-actions released this 22 Oct 09:32
· 508 commits to main since this release
  • The Notion door (onlyworlds.notion): import_notion(source, out_dir, plan_only=False) and python -m onlyworlds.notion EXPORT.zip OUT-DIR [--plan] read Notion's "Markdown & CSV" export, the zip or the directory it unzips to (inner part zips one level deep), into a world folder written through write_folder. No AI, no account. What it reads: a database whose title is one of the 22 types (singular or plural, any case) becomes elements of that type, or row by row when a Type column names one; a column becomes a field when its name, lowercased with spaces as underscores, is a field of that type (compared without case, so str finds STR), the title column name; a relation column becomes a link field of the same name, each target resolved by its Notion id and failing that by its exact title among the typed elements of the field's target type; _all.csv is read over the plain CSV, never both. Every other page becomes a Narrative (its Markdown the description, callout HTML kept as text, x_notion_parent the page it sits under), and so does each row of an untyped database (supertype notion, subtype the database's title). A page link in a Narrative's text to a page of another type also lands on Narrative's multi-link field for that type; the text keeps the link as written. What it keeps: every column not placed, verbatim, as x_notion_<column>; a value that does not fit its field's kind; an unresolved relation's cell; a row's page text as x_notion_body when a column filled description; the Notion id as x_notion_id; attachments a page links to, copied to media/notion/<path in the export> with the link rewritten. Ids are UUIDv5 of the Notion id in a fixed namespace (NOTION_NAMESPACE), so the same export twice gives byte-equal folders and a later export of the same workspace finds the same elements; a file with no id takes its path's. world.json carries producer {"tool": "onlyworlds", "version": ..., "input": "notion-export"} (a word for the folder spec's list). What it reports (ImportReport, printed at the end of a run and by --plan, which writes nothing): what became what with counts, the untyped databases, every column not placed (database, column, why, the key it was kept as), every link not resolved (the element, the column or body, the target as written, why), every id taken from a path, the attachments copied and anything skipped. Built on the documented shape; a real export is the fixture to come, and every name the door believes is listed in the module's docstring and parsed in one place.
  • The folder it writes passes the dist's folder lint, and read_folder then write_folder gives it back byte for byte.