As epicscorelibs maintains its own libca, it provides the option to set the 'CATOOLS_LIBCA_PATH' before using cothread. This can be found here. This mechanism does not appear to be ideal.
For example, softioc uses this mechanism here. The problem comes when another program attempts to use both softioc and cothread itself. A simple program such as the following:
#! /usr/bin/env python3
import cothread.catools
import softioc
will result in the following error (and potentially problematic behaviour):
$ ./test_imports.py
/path/to/pipenv/environment/lib/python3.7/site-packages/epicscorelibs/path/cothread.py:18: UserWarning: epicscorelibs.path.cothread must be imported before cothread.catools to have effect
warnings.warn("epicscorelibs.path.cothread must be imported before cothread.catools to have effect")
There are two problems:
- It is not immediately clear what is causing the error
- If using standard tools such as isort, you need to manually force a particular order of imports to avoid this error. You need to
isort:skip multiple lines of code
I am not sure why cothread does not use epicscorelibs by default. Would it be possible to implement this?
Alternatively, some kind of conditional import of epicscorelibs could be useful.
As epicscorelibs maintains its own libca, it provides the option to set the 'CATOOLS_LIBCA_PATH' before using cothread. This can be found here. This mechanism does not appear to be ideal.
For example, softioc uses this mechanism here. The problem comes when another program attempts to use both softioc and cothread itself. A simple program such as the following:
will result in the following error (and potentially problematic behaviour):
There are two problems:
isort:skipmultiple lines of codeI am not sure why cothread does not use epicscorelibs by default. Would it be possible to implement this?
Alternatively, some kind of conditional import of epicscorelibs could be useful.