Skip to content

feat: restructure runtime config and remove cerebrium. prefix#57

Open
elijah-rou wants to merge 5 commits intomainfrom
eli/cer-4772-cmd-and-entrypoint-bug-fixes
Open

feat: restructure runtime config and remove cerebrium. prefix#57
elijah-rou wants to merge 5 commits intomainfrom
eli/cer-4772-cmd-and-entrypoint-bug-fixes

Conversation

@elijah-rou
Copy link
Contributor

@elijah-rou elijah-rou commented Jan 22, 2026

Summary

  • Restructure runtime config to be generic for backend validation
  • Remove cerebrium. prefix requirement (backwards compatible with deprecation warnings)
  • Add _file_relative_path key for dependency files with file+inline merging
  • Maintain full backwards compatibility for all deprecated patterns

Changes

Runtime Config

  • Runtime config is now generic map[string]any passed to backend for validation
  • CLI no longer validates runtime-specific parameters (backend handles this)
  • Supports arbitrary runtime types for future extensibility

Config Format

  • New format without cerebrium. prefix is recommended
  • Legacy [cerebrium.*] format still works with deprecation warning
  • Both formats cannot be mixed in the same file

Dependencies

  • New: _file_relative_path key inside dependency maps (recommended)
    [dependencies.pip]
    _file_relative_path = "requirements.txt"
    torch = "2.0.0"  # inline deps merged on top of file
  • Deprecated: [dependencies.paths] section still works with warning
    [dependencies.paths]
    pip = "requirements.txt"
  • File contents parsed and merged with inline packages (inline wins per-package)
  • Both patterns work with and without cerebrium. prefix

Deprecation Warnings

Users see warnings for:

  • [cerebrium.*] prefix usage
  • [cerebrium.dependencies] / [dependencies] top-level section (should move to runtime)
  • [cerebrium.dependencies.paths] / [dependencies.paths] section
  • [runtime.custom] usage (migrate to [runtime.docker] or [runtime.python])
  • Deployment fields that moved to runtime section

Test Plan

  • All existing tests pass
  • New tests for deprecated paths parsing
  • New tests for _file_relative_path pattern
  • New tests for file+inline dependency merging
  • Tests verify both cerebrium. prefix and non-prefix formats
  • make build succeeds

…imes

Split [cerebrium.runtime.custom] into separate runtime types:
- [cerebrium.runtime.cortex] for Cerebrium managed Python (default)
- [cerebrium.runtime.python] for custom Python ASGI apps
- [cerebrium.runtime.docker] for custom Dockerfiles

Move runtime-specific params (python_version, docker_base_image_url,
shell_commands, pre_build_commands, use_uv) from [cerebrium.deployment]
to the appropriate runtime sections.

Backwards compatibility maintained:
- Deprecated [cerebrium.runtime.custom] still works with warnings
- Deprecated deployment fields still work with warnings
- Runtime section values take precedence over deprecated fields
Replace specific runtime structs (CortexRuntimeConfig, PythonRuntimeConfig,
DockerRuntimeConfig, etc.) with a single generic RuntimeConfig that accepts
any [cerebrium.runtime.<name>] section. The CLI now passes runtime parameters
through to the backend for validation, allowing new runtimes to be added
without CLI changes.

Key changes:
- RuntimeConfig now has Type (string) and Params (map[string]any)
- CLI only validates local requirements (file paths exist)
- Backend validates runtime-specific parameters
- Backwards compatible with deprecated deployment fields
Move dependencies from top-level [cerebrium.dependencies] to runtime-specific
sections [cerebrium.runtime.{type}.dependencies.*] while maintaining backwards
compatibility with deprecation warnings.

- Add GetDependencies() to RuntimeConfig to parse deps from runtime params
- Add GetEffectiveDependencies() to merge top-level and runtime deps (runtime wins)
- Add deprecation warning when top-level dependencies are used
- Update dependency file generation to use merged dependencies
- Add ValidateRuntime API endpoint to validate runtime config before deploy
- Include effective dependencies in runtime validation payload
- Add helper methods for shell_commands and pre_build_commands from runtime
@elijah-rou elijah-rou changed the title feat: restructure runtime config with cortex, python, and docker runtimes feat: restructure runtime config and remove cerebrium. prefix Jan 23, 2026
Support both formats for TOML configuration:
- New format: [deployment], [runtime.cortex], [hardware], etc.
- Legacy format: [cerebrium.deployment], [cerebrium.runtime.cortex], etc.

The legacy format with cerebrium. prefix is now deprecated and shows a
warning, but remains fully functional for backwards compatibility.
Mixing formats in the same file is not allowed.
@elijah-rou elijah-rou marked this pull request as draft January 27, 2026 20:53
- Add _file_relative_path key inside dependency maps (pip, conda, apt)
  as the new recommended way to specify requirements files
- Maintain backwards compatibility with deprecated [dependencies.paths]
  section - both patterns work, new key takes precedence
- Parse requirements.txt format and merge inline packages on top
  (inline wins per-package)
- Add deprecation warnings for [dependencies.paths] usage pointing
  users to the new _file_relative_path pattern
- Add comprehensive tests for both old and new patterns
@elijah-rou elijah-rou force-pushed the eli/cer-4772-cmd-and-entrypoint-bug-fixes branch from 151ca8e to 64c787d Compare January 28, 2026 14:23
@elijah-rou elijah-rou marked this pull request as ready for review January 28, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants