Skip to content

Instantly share code, notes, and snippets.

@jaimergp
Created October 15, 2021 12:15
Show Gist options
  • Save jaimergp/7de5843421d63fa4a408ac5c8712c3c9 to your computer and use it in GitHub Desktop.
Save jaimergp/7de5843421d63fa4a408ac5c8712c3c9 to your computer and use it in GitHub Desktop.
Menuinst, conda-standalone and constructor

Conda, constructor and menuinst

menuinst is able to take $PREFIX/Menu/*.json files and create menu items on different OS. It is used by conda and constructor to that end, but it's also a separate library.

Conda & Menuinst

State

  • menuinst is a conda dependency on Windows, but not on Linux/MacOS.
  • menuinst needs to be present on the base env so conda can call menuinst.install(...) upon package linking if a menu JSON is found.

Needed actions

  • Once support for Linux/MacOS is merged, menuinst needs to be part of the conda dependencies on all platforms.
  • Remove special cases for Windows:

Note that the function that handles menu creation on conda has this name and signature:

def make_menu(prefix, file_path, remove=False):
    ...

Constructor & Menuinst

State

  • constructor ships a frozen conda called conda-standalone. This frozen package contains some vendored dependencies, like menuinst itself.
  • constructor allows --conda-exe to specify a different "standalone conda" if needed. Conda Forge uses this flag to bundle micromamba instead.
  • conda-standalone has an extra entry point conda constructor, which provides some commands to create and remove menus. This introduces a CLI API: --make-menus and --rm-menus.
  • The entry point will import _nsis.py (part of constructor) and call menuinst.install(...). Note that _nsis.py is only valid for Windows.
  • _nsis.py introduces a different API than conda!
def mk_menus(remove=False, prefix=None, pkg_names=None, root_prefix=None):
    ...

def rm_menus(prefix=None, root_prefix=None):
    ...

Needed actions

  • Port conda constructor CLI API over to conda. Have micromamba implement it too.
  • The CLI implementation should not call _nsis.py directly. It should use menuinst public API. This won't be a problem because menuinst should be a conda dependency at this point.
  • _nsis.mk_menus and _nsis.rm_menus should be marked as deprecated and forward to the conda CLI implementation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment