Closed bschilder closed 2 years ago
After some contemplation, I'm afraid to say I had to go with Option 2. Mostly because the entire point of basilisk is to freeze versions and allowing >=
specifications would not be consistent with the spirit of the package.
Some random points:
basilisk:::globals$set(no.version=TRUE)
will skip all version requirements. This can be useful for initial package development when you just want conda
to handle the version resolution; we can then use basilisk::listPackages()
to identify the frozen versions of all packages for deployment..Platform
(or some helpers in basilisk.utils::isWindows
and basilisk.utils::isMacOSX
) to dynamically alter the packages=
in the BasiliskEnvironment
constructor. For example, something like:
packages = c(
"blah=0.1",
"foo=0.4",
if (isMacOSX()) {
"stuff=0.1"
} else if (isWindows()) {
"stuff=0.1.1"
} else {
"stuff=0.1.2"
}
)
Assuming, of course, that you know the appropriate versions for the other platforms. It's a bit of a pain but IMO this is the lesser of two evils; with the alternative approach of allowing any >=
version, the exact configuration on the user's machine will be a mystery, and this is where your troubleshooting capabilities are most limited.
Thanks for the quick reply @LTLA. I think this approach is quite understandable given the goals on basilisk
.
I don't know the versions necessary for each platform, so what I think I'll need to do is spin up virtual machines for each platform, create the env in each of them, export separate yaml files, and then store those yaml files so they can be used by basilisk depending on the platform it's being run on.
If I end up writing any functions that can do some or all of these steps I'll be sure to share.
It doesn't look like there's any checks in
basilisk::setupBasiliskEnv
to handle using>
or<
when specifying versions. I know using=
or==
is encouraged, but in some situations it may be necessary to use the more flexible>=
syntax (e.g. when you don't know the specific versions available for every package on every platform).Currently, when you do input packages with the
>=
syntax,setupBasiliskEnv
continues but doesn't parse the inputs correctly. https://github.com/LTLA/basilisk/blob/3778f27684497ea99136657a5f7ccd504aa581ed/R/setupBasiliskEnv.R#L71This results in weird situations where packages can't be found, and/or multiple conflicting versions of python are requested to be installed at the same time (e.g. python>=3.9 and python==3.7.7).
Potential solutions:
setupBasiliskEnv
so it correctly parses package versions specified with </>. If developers want, a warning can be displayed to let users know that the "=" syntax is preferred. 👈 (Option 1 would be my preference).Reprex
Session info