Icon doesn't load for local Yak repository?

Hi,

I’m currently testing a Yak package with a local repository, but the icon doesn’t seem to load in the package manager?

It’s a 32 by 32 pixel PNG with a transparent background that’s hosted online and available! I’ve already tried hosting it on my VPS, on imgur, on Github, but nothing seems to work.

Here’s the relevant passage from the manifest.yml:

icon_url: "https://github.com/diff-arch/Tapeworm/blob/main/resources/Logo_Tapeworm_32.png"

I’ve also renamed the built package from .yak to .zip to check whether the build command strips the line from the manifest, but everything seems fine.

Is it not possible to load icons from local repositories? Or is this a macOS bug?

For local package repositories you need to include the icon file in the package and set the icon field, e.g.

icon: my_icon.png

I’m working on bringing the same functionality to the public package server, so icons become immutable and package authors don’t need to worry about hosting images online.

2 Likes

Ah, I see. Thanks for the reply.
So there’s no way of making sure that it works before pushing the package to the server?

You could push the package to https://test.yak.rhino3d.com and add it to the list of package sources in Rhino. This test server is wiped clean once per day.

1 Like

Thanks for all the advice!

In my opinion, hosting the image online isn’t that big of a hurdle, since there are many free services out there and most people have a website either way. However it’s a little confusing that local packages don’t load online icons.

Locally it works with setting the icon field, however I’ve too optimistically pushed it to the server and it seems to produce an error in the PackageManager now!

PackageManager: Error fetching icon for Tapeworm (1.0.2)
Could not initialize an instance of the type 'AppKit.NSImage': the native 'initWithData:' method returned nil.
It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.

I’d removed the icon field and substituted it for icon_url: https://github.com/diff-arch/Tapeworm/blob/main/resources/Logo_Tapeworm_32.png before publishing it.

I hope I haven’t broken the PackageManager for everybody on macOS! :grimacing:

I wanted to avoid making HTTP requests to external servers when querying a local package repository. I’m hoping to remove the confusion by using icon in both places, and deprecating the use of icon_url for the public server.

No problem. Try publishing a new version (e.g. 1.0.3) that uses https://github.com/diff-arch/Tapeworm/raw/main/resources/Logo_Tapeworm_32.png instead. This is a direct URL to the image, rather than a link to the HTML page on GitHub. You can find this URL by right-clicking on the “Download” link on GitHub.

The PackageManager command will get the icon from the latest version of your package, so the error message will go away once you push a new version.


Update: There are three versions of the “raw” URL…

The first two redirect to the third one. They’ll all work, but picking one of the first two might be a little more future proof in case GitHub changes something…

1 Like

Oh, my bad! Sorry. Would it be possible to remove a package and re-upload it. We are publishing to Food4Rhino, GitHub, and Yak, and it would be weird to have another, higher version only on the PackageManager.

Edit:
Or can the manifest be edited to change the image url, since the package is only a ZIP file?

Versions can’t be removed, edited or overwritten, they can only be hidden via the yank command.

There are of course exceptions where privacy/security are concerned, but in general this immutability is a pretty important concept when you potentially have users relying on specific versions of a package.

Trying to think of the least number of hoops you’ll need to jump through in this particular situation… The package manager supports 4-digit version numbers, so what about pushing a new “1.0.2.1” version of your package with the updated URL? It’s just a temporary measure to avoid re-publishing everywhere until you’re ready to roll the version number.

1 Like

Thanks for explaining all of this! You’ve been tremendously helpful.

Hi @will,

I think I’ve discovered another issue with the PackageManager and icons, probably exclusive to macOS?

Let’s look at Tapeworm again. When you search for it, it shows up outfitted with the icon:

However, once installed the icon seems to vanish?

Weird right?

Thanks for reporting this! Logged as RH-64735.

1 Like