Skip to main content

load_sidecar

Function load_sidecar 

Source
pub fn load_sidecar(py_path: &Path) -> Result<Option<MigrationSpec>>
Expand description

Load the sidecar spec for a given .py migration path.

Derives the sidecar path by replacing the .py extension with .json (same stem, sibling file).

  • If the .json sibling does not exist โ†’ Ok(None). The caller should fall back to the trusted-import Python path for this file.
  • If it exists โ†’ read, deserialize, and return Ok(Some(spec)).
  • If it exists but is malformed โ†’ Err(MigrationError::Loader { .. }).

ยงErrors

Returns MigrationError::Loader when the sidecar exists but cannot be read or deserialized.