Adding Your First Package
This tutorial walks through adding an existing package from Sysand Index to a
SysML v2 or KerML project for the first time. You will find a published
package on the index, add it as a usage in .project.json, and import an
element from it into your model.
For detailed sysand command-line usage, use
the Sysand client documentation. This tutorial
focuses on the Sysand Index parts that matter when consuming a published
package.
Before You Start¶
You need:
the
sysandclient installed (install instructions)a SysML v2 or KerML project that you can edit (see the
sysandclient tutorial for setting one up from scratch)
You do not need a Sysand Index account to add public packages — only the package’s Sysand project ID.
Find the Package¶
Browse the Sysand Index project list to find a published package, or open the project page directly if you already know the publisher and name:
https://sysand.com/projects/<publisher-id>/<name-id>/At the top of every project page is a ready-to-copy sysand add command, for
example:
sysand add alice/teapot-modelsThe alice/teapot-models segment is the package’s Sysand project ID. Copy
the whole command (or just the project ID) — you will use it in the next
step. The same page also shows the published versions, README, and license.
Replace alice/teapot-models throughout this tutorial with the project ID of
the package you want to add.
Add the Package as a Usage¶
From your project directory, run the command shown at the top of the project page:
sysand add alice/teapot-modelsThe client adds an entry to the usage field of .project.json and
downloads the package contents so that imported elements resolve.
To pin a specific version or version range, and for other command flags, see
the sysand add reference.
Import an Element¶
In one of your .sysml files, import an element from the added package. The
package’s bundled README is usually the best place to find good entry points
— published packages typically suggest which elements to import.
For example:
package MyKitchen {
private import TeapotModels::Teapot;
part myTeapot : Teapot;
}Verify the Package Resolved¶
Confirm that the package is recorded as a usage and resolves correctly:
Open
.project.jsonand check that the new entry appears underusage.Re-run your usual build or check command from your SysML v2 tool; the import should resolve without errors.
If resolution fails, the most common causes are a typo in the project ID, a version that does not exist on the index, or a network error while fetching the package. The client error message usually identifies which.