Skip to content

Commit

Permalink
Add deprecation warning to inject
Browse files Browse the repository at this point in the history
  • Loading branch information
callumforrester committed Oct 18, 2024
1 parent ecc1a20 commit 057f098
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/dodal/common/coordination.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import uuid
import warnings
from textwrap import dedent
from typing import Any

from dodal.common.types import Group
Expand Down Expand Up @@ -37,4 +39,20 @@ def scan(x: Movable = inject("stage_x"), start: float = 0.0 ...)
"""

warnings.warn(
dedent("""
Inject is deprecated, users are now expected to call the device factory
functions in dodal directly, these will cache devices as singletons after
they have been called once. For example:
import i22
+ def my_plan(detector: Readable = i22.saxs()) -> MsgGenerator:
...
Where previously the default would have been inject("saxs")
"""),
DeprecationWarning,
stacklevel=2,
)
return name

0 comments on commit 057f098

Please sign in to comment.