# Migrating a project A kibo 1.2 project generates with a script: a `generate.py` of its own, or `dsm_util.py create_python_package` / `create_node_package`. A kibo 2 project states its generation in a `kibo.toml`, and [kibo-project](../kibo/kibo-project.md) runs it. This page turns the first into the second. The generated code changes too: code written against it moves as [Migrating application code](application.md) says. A project that renders templates of its own moves them as [Migrating a template pack](template-pack.md) says. ## Before you start - Python 3.11 or later with `dsviper` (on Python 3.10, also `tomli`), and Java 17. - `kibo_project.py`, the kibo 2 jar and the kibo-template-viper 2 pack. In the DevKit they are `tools/kibo_project.py`, `kibo-2/tools/kibo-2.*.jar` and `kibo-2/templates/`, where kibo-project finds them on its own. Elsewhere, set `KIBO_JAR` and `KIBO_TEMPLATES` ([Where the generator comes from](../kibo/kibo-project.md#where-the-generator-comes-from)). - If the project has templates of its own, render their *before* now, while the kibo 1.2 jar, pack and `.dsm.json` are still in place ([the method](template-pack.md#the-method-a-diff-you-can-account-for)). Until those templates are migrated, a target that renders them fails its validation: leave their features out of the target's `features` at first, and add them once migrated. - Then delete, or move aside, everything kibo 1.2 generated. A 1.2 module left in place still imports and hides a call not yet migrated. ## What the script did, and where it goes A kibo 1.2 script does the same few things, whatever its length. Each has a line in `kibo.toml`, or disappears. | The script | In kibo 2 | |---|---| | `DSMBuilder.assemble()`, then `parse()` and a report check | `[project] definitions = ""`: a `.dsm` file, a directory of them, or a list of either. Errors stop the generation. | | writes `.dsm.json` | Nothing: kibo-project writes it beside `kibo.toml`, named after `[project] infrastructure` whatever the targets set. Ignore it in version control. | | `-n ` | `[project] infrastructure = ""`. A target whose name differed (`Features` for C++, `features` for Python) sets its own `infrastructure`. | | finds the jar and checks the pack's line | `[generator] templates = "2"`. `KIBO_JAR` and `KIBO_TEMPLATES` still override where they are found. | | a list of template directories, one `java -jar` call each | `features = [...]` on a target: see [the table](#from-templates-to-features) below. | | `-c cpp` / `-c python` | the target's name, `[target.cpp]`, `[target.python]`, `[target.typescript]`, or `language = "..."`. TypeScript was rendered with `-c python`; it is now its own target. | | `-o ` | `output = ""`, with the changes below. | | writes `*_Resources.hpp`, `resources.py` or `resources.ts` | Nothing: the pack writes the embedded definitions, in the encoding it declares. Delete that code. | | a second call for `wheel/pyproject.toml.stg` or `typescript/project` | the `Wheel` (Python) or `Package` (TypeScript) feature. The `pyproject.toml` it writes keeps the name, the version, the packages and the `dsviper` dependency; authors, maintainers, a readme, classifiers and keywords are the packager's to add. | | `--cpp`, `--python`, `--typescript` flags | `kibo_project.py generate --target `; with no `--target`, every target. | Where each output lands changed: | Target | kibo 1.2 `-o` | kibo 2 `output` | |---|---|---| | C++ | a directory of `_