Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

- Remove deprecated configuration compatibility shims. Use jsonargparse for
typed construction and `Config.from_instance()` / `Config.load()` for
portable configuration recipes.

## [0.1.1](https://github.com/openvinotoolkit/physicalai/compare/v0.1.0...v0.1.1) (2026-06-02)

**Full Changelog**: [v0.1.0...v0.1.1](https://github.com/openvinotoolkit/physicalai/compare/v0.1.0...v0.1.1)
Expand Down
2 changes: 1 addition & 1 deletion src/physicalai/capture/transport/_shared_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class SharedCamera(Camera):
Opted into :func:`~physicalai.config.export_config` as a **construction
recipe** only (nested ``camera`` Config, ``service_name``,
``color_mode``, transport knobs). Publisher / iceoryx2 session / frame
state is never part of :func:`~physicalai.config.to_config`.
state is never part of :meth:`~physicalai.config.Config.from_instance`.

The publisher subprocess owns the device exclusively. Another connected
holder of the same hardware will cause open to fail; this API does not
Expand Down
24 changes: 2 additions & 22 deletions src/physicalai/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
and :func:`instantiate` for trusted local recipes (robots, cameras, exported
components).

Legacy helpers in :mod:`physicalai.config.loading` and
:mod:`physicalai.config.mixin` remain for compatibility and emit
:class:`DeprecationWarning`; prefer jsonargparse for known types and
Use jsonargparse directly for known types and
:meth:`Config.from_instance` / :meth:`Config.save` for export.

Opt-in export:
Expand All @@ -24,25 +22,17 @@
modules.
"""

from ._envelope import (
normalize_config,
validate_envelope,
)
from ._errors import ConfigError, ConfigImportError
from ._export import (
export_config,
is_config_exportable,
resolve_public_class_path,
to_config,
)
from ._importing import import_dotted_path
from ._instantiate import instantiate as _strict_instantiate
from ._normalize import validate_config
from ._types import ConfigValue, JsonScalar, JsonValue
from ._yaml import load_yaml, save_yaml, to_yaml
from .base import Config
from .importing import import_dotted_path
from .loading import import_class, instantiate_obj
from .mixin import FromConfig, from_config

instantiate = _strict_instantiate # ruff: ignore[RUF067]

Expand All @@ -51,22 +41,12 @@
"ConfigError",
"ConfigImportError",
"ConfigValue",
"FromConfig",
"JsonScalar",
"JsonValue",
"export_config",
"from_config",
"import_class",
"import_dotted_path",
"instantiate",
"instantiate_obj",
"is_config_exportable",
"load_yaml",
"normalize_config",
"resolve_public_class_path",
"save_yaml",
"to_config",
"to_yaml",
"validate_config",
"validate_envelope",
]
17 changes: 0 additions & 17 deletions src/physicalai/config/_deprecate.py

This file was deleted.

146 changes: 0 additions & 146 deletions src/physicalai/config/_envelope.py

This file was deleted.

25 changes: 6 additions & 19 deletions src/physicalai/config/_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from typing import TYPE_CHECKING, TypeVar, overload

from ._errors import ConfigError
from ._importing import import_dotted_path
from ._normalize import (
normalize_value,
snapshot_captured_value,
Expand All @@ -26,7 +27,6 @@
JsonValue,
ValidatedConfigDict,
)
from .importing import import_dotted_path

if TYPE_CHECKING:
from collections.abc import Callable, Sequence
Expand All @@ -37,7 +37,7 @@


class _NonScalarVarKwarg:
"""Poison value so ``to_config`` rejects non-scalar ``**kwargs`` entries.
"""Poison value so export rejects non-scalar ``**kwargs`` entries.

Used when ``@export_config(scalar_var_kwargs=True)`` seals flattened
var-keyword arguments to JSON scalars only.
Expand Down Expand Up @@ -245,19 +245,6 @@ def _export_instance(
return {"class_path": class_path, "init_args": init_args}


def to_config(value: object) -> Config:
"""Return the canonical recipe for an ``@export_config`` instance.

.. deprecated::
Use :meth:`~physicalai.config.Config.from_instance` instead.
"""
from ._deprecate import deprecate # noqa: PLC0415
from .base import Config # noqa: PLC0415

deprecate("physicalai.config.to_config", "Config.from_instance")
return Config.from_instance(value)


def _validate_replayable_signature(cls: type, signature: inspect.Signature) -> None:
for param in signature.parameters.values():
if param.name == "self":
Expand Down Expand Up @@ -294,7 +281,7 @@ def _flatten_var_kwargs(
msg = f"{cls_name}: **{var_kw_name} keys must be strings"
raise TypeError(msg)
if scalar_var_kwargs and not _is_json_scalar(value):
# Seal so normalize fails at to_config (no silent JSON nest).
# Seal so normalize fails during export (no silent JSON nest).
supplied[key] = _NonScalarVarKwarg(key)
else:
supplied[key] = snapshot_captured_value(value)
Expand Down Expand Up @@ -462,7 +449,7 @@ def export_config(
scalar_var_kwargs: bool = False,
config_args: Sequence[str] | None = None,
) -> _T | Callable[[_T], _T]:
"""Opt a concrete class into constructor-config export via :func:`to_config`.
"""Opt a concrete class into constructor-config export via :meth:`Config.from_instance`.

Remembers caller-supplied ``__init__`` arguments (not defaults). Rejects
constructors that declare positional-only parameters or ``*args``.
Expand All @@ -485,7 +472,7 @@ class InferenceModel: ...

Pass ``scalar_var_kwargs=True`` when flattened ``**kwargs`` must export as
JSON scalars only (``None`` / ``bool`` / ``int`` / ``float`` / ``str``).
Non-scalar var-keyword values then fail at :func:`to_config` instead of
Non-scalar var-keyword values then fail during export instead of
being normalized as nested JSON. Requires a ``**kwargs`` parameter.

Nested non-component domain values (for example calibration objects) may
Expand Down Expand Up @@ -513,7 +500,7 @@ class InferenceModel: ...
class_path: Optional stable public import path for export. Verified on
export to resolve exactly to the decorated class.
scalar_var_kwargs: When ``True``, seal flattened ``**kwargs`` to JSON
scalars so non-scalars fail at :func:`to_config`.
scalars so non-scalars fail during export.
config_args: Init-arg names the class consumes as Config
*data*. :func:`instantiate` passes these through as plain mappings
instead of constructing the nested component — use it for spawn
Expand Down
2 changes: 1 addition & 1 deletion src/physicalai/config/_instantiate.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@

from ._errors import ConfigError, ConfigImportError
from ._export import declared_config_args
from ._importing import import_dotted_path
from ._normalize import validate_config
from ._path import format_path
from ._typed_wire import enum_from_wire
from ._types import _MAX_CONFIG_DEPTH, JsonValue
from .base import Config, parse_class_config
from .importing import import_dotted_path

_T = TypeVar("_T")

Expand Down
Loading
Loading