Skip to content

Versioning

All cards follow a semver version format (major.minor.patch). By default, a minor increment is used whenever a card is registered. If a version is provided, it overrides the default version type.

For more information on the versioning scheme, please refer to the Semver documentation. In addition, opsml leverages the semver crate to ensure semver compliance.

Card versions can also be assigned pre and build tags.

  • Pre tag for a release candidate -> major.minor.patch-rc.{#} -> 1.0.0-rc.1 -> version_type: "pre"

  • Build tag -> major.minor.patch+build.{#} -> 1.0.0+build.1 -> version_type: "build"

Allowed types of versioning:

  • major: Major version increment
  • minor: Minor version increment (default)
  • patch: Patch version increment
  • pre: Pre-release version increment
  • build: Build version increment
  • pre_build: Pre-release and build version increment
from opsml import CardRegistry, VersionType

registry = CardRegistry("model")

# skipping logic

# major
registry.register_card(card=card, version_type=VersionType.Major)
# minor
registry.register_card(card=card, version_type=VersionType.Minor)
# patch
registry.register_card(card=card, version_type=VersionType.Patch)
# pre
registry.register_card(card=card, version_type=VersionType.Pre)
# build
registry.register_card(card=card, version_type=VersionType.Build)
# pre_build
registry.register_card(card=card, version_type=VersionType.PreBuild)
Recommended Usage

The ability to provide a version is only an option to enable flexibility; it is not required. The recommended approach if you don't need release candidates or extra flexibility is to create a Card and specify the version_type when registering a card, which will allow OpsML to handle the versioning for you.

What happens when I register a card?

When you register a card, opsml will search for the most recent version of the card, and depending on the version types and any pre and/or build tags you provide, it will increment the version accordingly.

card = ModelCard(**kwargs, version="1.0.0")
registry.register_card(card=card, version_type=VersionType.Pre, pre_tag="foo")
# 1.0.0-foo

In a normal workflow (like on model retraining), it's recommended to let opsml use it's defaults to increment the version.

# model training
registry.register_card(card=card)
# 1.0.0

# model retraining
registry.register_card(card=card)
# 1.1.0

# model retraining
registry.register_card(card=card)
# 1.2.0