@@ -25,6 +25,9 @@ the following procedure should be used:
25
25
#. Merge the transfer branch back to the regular issue branch using
26
26
``--no-ff `` to preserve the transfer branch name in the merge commit.
27
27
28
+ #. Make the appropriate changes to support continued import of public interfaces from the origin
29
+ repository with a deprecation warning. See :ref: `providing-stable-interfaces ` for more details.
30
+
28
31
#. In the destination repository:
29
32
30
33
#. Create the usual ``tickets/DM-XXXX `` issue branch.
@@ -70,3 +73,52 @@ See `RFC-33`_ for the motivation and discussion behind this policy.
70
73
71
74
.. _RFC-33 : https://jira.lsstcorp.org/browse/rfc-33
72
75
.. _DM Stack Package History : https://confluence.lsstcorp.org/display/DM/DM+Stack+Package+History
76
+
77
+
78
+ .. _providing-stable-interfaces :
79
+
80
+ Providing Stable Interfaces
81
+ ===========================
82
+
83
+ Transferring code between packages is a breaking change and stable interfaces should be provided on a
84
+ best-effort basis to support external users.
85
+ If the origin repository is downstream of the destination (as is typically the case),
86
+ this can be achieved by importing code from the destination repository with an alias,
87
+ trivially repackaging it following the deprecation procedure described in
88
+ :doc: `Deprecating Interfaces <deprecating-interfaces >`.
89
+
90
+ As an example, if a Python class ``ConfigurableAction `` is moved from package ``analysis_tools `` (downstream) to ``pex_config `` (upstream),
91
+
92
+ .. code-block :: python
93
+
94
+ from lsst.pex.config import ConfigurableAction as ConfigurableActionNew
95
+ from depecated.sphinx import deprecated
96
+
97
+ __all__ = [" ConfigurableAction" ]
98
+
99
+ @deprecated (reason = " Moved to lsst.pex.config" ,
100
+ version = " v22.0" ,
101
+ category = FutureWarning )
102
+ class ConfigurableAction (ConfigurableActionNew ):
103
+ pass
104
+
105
+ In the relative less common case of moving code downstream, the following pattern can be used:
106
+
107
+ .. code-block :: python
108
+
109
+ import warnings
110
+
111
+ try :
112
+ from lsst.drp.tasks.assemble_coadd import * # noqa: F401, F403
113
+ except ImportError as error:
114
+ error.msg += " . Please import the coaddition tasks from drp_tasks package."
115
+ raise error
116
+ finally :
117
+ warnings.warn(" lsst.pipe.tasks.assembleCoadd is deprecated and will be removed after v27; "
118
+ " Please use lsst.drp.tasks.assemble_coadd instead." ,
119
+ DeprecationWarning ,
120
+ stacklevel = 2
121
+ )
122
+
123
+ This allows the code to be imported from the old location (with a deprecation warning) with a fully built
124
+ version of the Science Pipelines, but does not introduces cyclic dependencies during the build process.
0 commit comments