Skip to content

Migrating from 0.5.x

Jasper Quillweld edited this page Oct 20, 2026 · 1 revision

Migrating from 0.5.x

Version 1.0.0 is a ground-up rewrite. The 0.5.x line was a hand-maintained textX/astropy/PyYAML parser; 1.0.0 is a purely-generated, pure-standard-library library. See the README for the full story. This page is the practical "what do I change in my code?"

For the complete, authoritative migration note, read migration-0.5-to-1.0.md in the sysml2py-lab repo.

What changed

  • Engine: textX-backed parser → generated AST/builder library.
  • No runtime deps: pip install sysml2py now pulls only the standard library. The old line bundled astropy; 1.0.0 does not.
  • Provenance: every install records the generating inputs (see Provenance).

What you need to do

  1. Upgrade

    pip install -U sysml2py
  2. Units / astropy: if you used astropy.units or units in attributes, add astropy to your own project deps and import astropy.units as u where needed. It is no longer bundled.

  3. Builder API: the friendly names you remember are preserved — Part, Attribute, Item, Port — but the Builder/Usage/Definition suffixes are dropped. Usage vs. definition is now chosen at creation:

    Part('Stage_1')                  # part Stage_1;
    Part('Stage_1', kind='definition')  # part def Stage_1;

    add() appends children (pkg.add(part)). Container names that collide with AST node classes keep the *Builder suffix (PackageBuilder, etc.), and definition-less kinds reject kind='definition' with a ValueError.

  4. set_value is gone: pass value= / unit= to the builder constructor instead:

    # 0.5.x
    a = Attribute()._set_name('mass')
    a.set_value(100 * u.kg)
    
    # 1.0.0
    Attribute('mass', value=100, unit='kg')

Rollback

If a 0.5.x behaviour is genuinely missing, pin <1.0.0 and file the gap on the sysml2py-lab repo — it is generator error, not a license to hand-edit the generated library.

Clone this wiki locally