About

Upgrading from 0.9 to 0.10

In 0.10 topic lists come back in display order and topic entries gain an order field — the code it affects, with before-and-after code per language.

For: developers who list knowledge-pack topics or build topic entries in code

0.10 gives knowledge-pack topics a display order (order) and adds reading a topic at one horoscope layer. The new calls are additions; only the two changes below are incompatible, and code that neither lists topics nor builds topic entries with struct literals is unaffected.

x-iztro = "0.10"
pip install "x-iztro~=0.10.0"
go get github.com/x-haose/x-iztro/go/iztro@v0.10.0
npm install x-iztro@0.10

Topic lists come back in display order

Affected: KnowledgePack.topics() in Python and JavaScript. 0.9 returned slug order; 0.10 returns display order: ascending order, topics without one last, ties and topics without one by slug. A custom pack with no order gives the same result as 0.9; the default pack now lists overall, personality, career, wealth, romance, health, parents, children, siblings, friends, property, travel, spirit.

Rust and Go keep their existing calls as they were: Rust's pack.topics is still a slug-ordered BTreeMap and Go's Topics is still a map; for display order use the new topics_in_order() and TopicSlugs().

What to change: drop any topic order table you kept yourself and use topics() (Rust topics_in_order(), Go TopicSlugs()). Code that relied on alphabetical order, such as picking a topic by position, should look it up by slug with topic(slug).

JavaScript 0.9
const ORDER = ['overall', 'personality', 'career' /* … */];
const topics = pack.topics().sort((a, b) => ORDER.indexOf(a.slug) - ORDER.indexOf(b.slug));
JavaScript 0.10
const topics = pack.topics();

To set the order in your own pack, give topics an order. The default pack numbers in steps of 10, so an overlay with "order": 35 lands between career and wealth; see Knowledge packs · Topics.

Topic entries have one more field

Affected: Rust and Go code that builds topic entries with struct literals.

LanguageField in 0.10What to change
RustTopicEntry.order: Option<u32>Add order to the literal, or use ..Default::default()
GoTopicEntry.Order *uint32Turn unkeyed literals into keyed ones
PythonTopicEntry.order: int | None, the last fieldNothing
JavaScript / TypeScriptTopicEntry.order?: numberNothing
Rust 0.10
let topic = TopicEntry {
    title: Some("学业".into()),
    order: Some(35),
    surround: Some(vec!["careerPalace".into()]),
    ..TopicEntry::default()
};

An order that is not an integer from 0 to 4294967295 is a wrong_type error, and the pack is rejected.

Output that changes

  • The default pack's romance and spirit topics now say "the Soul palace reads the person, the Body palace where later effort goes"; the description under a topic text's title changes accordingly.
  • The default pack gains the glossary entry 亮度 (brightness, concepts.liang-du): 51 glossary entries instead of 50.

The new layer-level topic reading (topic_palaces, the horoscope's topic_to_text) is described in Text · A topic at one horoscope layer.

The full list is in the CHANGELOG.

On this page