Description
Following the discussions below, this is now a documentation issue. We should describe to users how to import containers from other packages without encountering the entry point conflict.
In short, if you wanted to use package.happi.containers.MyContainer in another package, you should do something similar to:
import package.happi.containers
class NewContainer(package.happi.containers.MyContainer):
pass
Context
The conflict shows itself as:
(pcds-5.4.1)roberttk@psbuild-rhel7-01:~/devrepos/pcdsdevices(enh_lp_mixin +)$ happi container-registry
File "/cds/home/r/roberttk/devrepos/happi/happi/containers.py", line 208, in load
self._safe_add(entry_name, var)
File "/cds/home/r/roberttk/devrepos/happi/happi/containers.py", line 173, in _safe_add
raise RuntimeError(f"Duplicated entry found. Keys: {key} "
RuntimeError: Duplicated entry found. Keys: pcdsdevices.happi.containers.LightpathItem and lightpath.happi.containers.LightpathItem point to same class: <class 'lightpath.happi.containers.LightpathItem'>
When you import from lightpath.happi.containers import LightpathItem in pcdsdevices.happi.containers
It seems the container gets collected once in lightpath and again in pcdsdevices under different keys, since they're being collected from different entrypoints. I can add an issue for it
Originally posted by @tangkong in pcdshub/lightpath#133 (comment)
Description
Following the discussions below, this is now a documentation issue. We should describe to users how to import containers from other packages without encountering the entry point conflict.
In short, if you wanted to use
package.happi.containers.MyContainerin another package, you should do something similar to:Context
The conflict shows itself as:
When you import
from lightpath.happi.containers import LightpathIteminpcdsdevices.happi.containersIt seems the container gets collected once in lightpath and again in pcdsdevices under different keys, since they're being collected from different entrypoints. I can add an issue for it
Originally posted by @tangkong in pcdshub/lightpath#133 (comment)