Skip to content

Add push() method for branch namespaces #1968

@shangyian

Description

@shangyian

There is no public method on DJClient for deploying local spec files to a branch namespace. The local development loop (edit specs, push to branch, validate, iterate) currently has no programmatic Python API, only a CLI path. This makes it impossible to drive the dev loop from notebooks, scripts, or CI without shelling out.

To support this, we can add a public push() method to DJ client:

  def push(self, namespace: str, spec_path: str) -> list[dict]:
      """
      Deploy local node specs to a branch namespace.

      Reads YAML spec files from spec_path and deploys them to the given namespace.
      The namespace must not be git_only (use sync_namespace_from_git for protected
  namespaces).

      Args:
          namespace: Full branch namespace name, e.g. "myproject.feature_x"
          spec_path: Path to a directory of YAML spec files or a single YAML file

      Returns:
          List of DeploymentResult dicts
      """

Note that this method is intended for branch namespaces only, and attempting to push to a git-only namespace will be rejected by the server (#1966) with a descriptive error

The spec format should match what the dj push CLI already produces, and spec_path is the directory (all .yaml/.yml files) with the nodes for this namespace.

dj.push("myproject.feature_x", "./nodes/") deploys all specs in the directory to that namespace

Attempting to push to a git-only namespace surfaces the server's 403 as a DJClientException

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions