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

Yak Packaging: Including Both Public & Private Python Dependencies

$
0
0

Hi everyone,

I’m building custom Grasshopper components using the Rhino 8 ScriptEditor (CPython) and packaging them into a YAK installer. Currently, my users have to perform two manual setup steps before they can use my components:

1. Create & initialize the Rhino-Python venv via a GH ScriptEditor component
I have them drop a special Grasshopper definition with a ScriptEditor component that runs this snippet on first use:

#! python3
# venv: myvenv
import locale
locale.setlocale(locale.LC_ALL, 'en_US')
# r: numpy==1.21.5, pyarrow==7.0.0, pandas==1.4.2, comtypes==1.4.8, pydantic

That creates the "myvenv" environment under %APPDATA%\.rhinocode\py39-rh8\site-envs\ and installs all public PyPI dependencies listed in the # r: line.

2. Install private GitHub-hosted packages
We host several in-house libraries on our company’s GitHub. Today each user must:

  • Clone each repo locally.
  • Manually add its path to their C:\Users\<USERNAME>\.rhinocode\python-3.pth.

I’d love to turn this into a zero-config install so that users can simply run the YAK and immediately use every component. Ideally the YAK would:

  • Vendor both the public and private packages inside the bundle (so no pip installs or .pth edits).
  • Or leverage the ScriptEditor’s # r: feature to automatically pip install everything (including private GitHub URLs) on first component run.

My Questions:

  1. What’s the simplest, most reliable way to bundle both my public PyPI packages and private GitHub libraries into a single YAK so that users never have to manually set up a venv or edit .pth files?
  2. If I opt instead to lean on the ScriptEditor’s # r:-style requirements, how can I handle private GitHub installs (authentication, caching, version pinning) without exposing tokens or forcing extra config?
  3. Are there any other workflows for delivering complex Python-powered Grasshopper plugins with ~zero user setup?

Thanks in advance for all the help!
Daniel

CC: @eirannejad, would love your input if you have the time :slightly_smiling_face:

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles