Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Rhino WIP: Script Package Management Improvements

$
0
0

Next build of Rhino WIP includes noticable improvements to the package management system in Rhino scripting.

Here are quick highlights, and more details are below:

  • Consistent In-Script Package Specification

    Why: Because readability counts.

    All scripting languages now support specifying packages in this format. Directives starts with # r and includes package provider and package specification inside double quotation markes (") formatted as provider: specification as shown above.

    Package specifications format is based on package provider format requirements. For example you can use pip install arguments like --editable or --index-url when using pip package provider, or list packages with version requirements like numpy>=1.23 just like when using pip.

    Examples are shown below.

  • New Install Package Dialog

    Why: Because this dialog in Rhino 8 is not very intuitive. It does not have search for packages or dynamically linked libraries (dlls), and is not clear that .rhp and .gha files can also be referenced. It also did not have support for using libraries from yak packages and there are loads of good tools in yak plugins.

    • Supports Yak packages
    • Supports absolute and relative paths both in Rhino and in Grasshopper script editors
    • Improved dll, rhp, and gha search and referencing.

    :red_triangle_pointed_down: See below for details

  • PIP Improvements

    Why: Because Rhino 8 does not have support for installing packages from custom indices, or VCS links and there are loads of good packages that come from custom sources for example torch with CUDA support. PEP723 is also getting popular and make sense to support that for users that may want to use more modern packages managers like uv

    • Support for installing from VCS urls e.g. git+http//...
    • Supports --index-url
    • Supports --find-links
    • Supports --editable
    • Supports PEP723 dependencies format.

    :red_triangle_pointed_down: See below for details

New Install Package Dialog

All package environments now support listing currently installed packages, and search for packages on the remote repositories.

Installed packages or libraries are shown by default when the dialog is opened:

You can use the search box to search for packages or libraries:

All environments show currently installed packages, remote matches, and potential upgrades:

.NET Library environment visually distinguishes between plugins and standard dlls:

PIP Improvements

  • Support for installing from VCS urls

    Examples:

    # r "pip: git+https://github.com/user/transformers.git"
    # r "pip: git+https://github.com/huggingface/transformers.git#egg=transformers"
    # r "pip: git+https://github.com/huggingface/transformers.git@096f25ae1f501a084d8ff2dcaf25fbc2bd60eba4"
    
  • Supports --index-url

    Examples:

    # r "pip: torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126"
    
  • Supports --find-links

    Examples:

    # r "pip: package --find-links https://example.com/packages"
    
  • Supports --editable

    Examples:

    # r "pip: --editable git+https://github.com/huggingface/transformers.git"
    # r "pip: --editable /Users/ein/Downloads/mylibrary"
    
  • Supports PEP723 dependencies format. Python 3 scripts can now read required python packages from PEP723 in-script metadata. Currently any metadata other than dependencies = [] list is ignored. Improvements are still underway: RH-88443

    Examples:

    # /// script
    # requires-python = ">=3.11"
    # dependencies = [
    #   "requests<3",
    #   "rich",
    # ]
    # ///
    
    import requests
    import rich
    

Yak Support

There is a new package provider named yak and can be referenced in scripts. Yak packages specified in scripts are NOT installed on Rhino/Grasshopper and are only installed under ~/.rhinocode/libs-yak so they can be referenced in scripts and do not add plugins or components to your Rhino and Grasshopper set up. Improvements are still under way: RH-88444

# r "yak: LunchBox, 2025.5.5"

using LunchBox;

It also has an optional file filter in case you only want to include a specific library when compiling your script:

# r "yak: LunchBox, 2025.5.5, LunchBox.gha"

using LunchBox;

2 posts - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles