How can I use UPM's versioning with git URLs?

I can’t seem to figure out how to release new versions and have it be recognized by UPM, I’ve tried changing the version in the package and committing that as well as creating releases via GitHub. Is this not supported?

Hey, your git dependency is probably locked in your project, in the manual Unity - Manual: Git dependencies under Locked Git dependencies you can check how to update the locked version of your package.

Hm I think you misunderstood me. I am referencing my git url package without a specific version. Other packages I can view previous versions and switch between them but I want to have this functionality with my custom imported packages unless I’m misunderstanding something here?

1 Like

Sorry, my bad, I indeed misunderstood, could you walk me through it? You have a project with a package installed that is fetched from a git repository. What you want is to view in the Package Manager window all versions of your package?

1 Like

Yup exactly! I have a custom package installed from a git repo that I’d like to see the versions for.

2 Likes

We have several packages where this would be useful as well. Currently the packages-lock.json and manifest.json files both need to be manually edited to trigger a reimport of the new version of a git package.
It would be much simpler to be able to select the version in Package Manager like all the UPM versions. Especially if a version has to be rolled back. Maybe have it only show the option if the git url ends with a #version?

2 Likes

This is something that is not supported for git packages. While including a git package in your project, the package can be targeting a specific revision, and the revision could be a tag, a branch or a commit hash, which not necessarily will be compatible with semver versioning. Maybe the tagging in your packages follows this rule, but that probably won’t be the case for other package author.

The only way of changing versions on git packages already in use is to update the manifest and lock file. From the Package Manager window only clone operations will be triggered at the moment.

So, at the moment there is no way how we could automatically get new version of the package that is fetched from a repository, right?

Yes, there is not way of automatically get the new version of a git package at the moment. The only way of changing versions on git packages already in use is to update the manifest and lock file. We are aware this is not ideal and we are working on improving this, but I don’t have an ETA for this as it is in early stages.

I was a little stunned by this issue as well, I can’t believe it wasn’t thought to be a good idea to scan every single package installed, compare it’s package.json version number with the installed version, and display an option to update.

Users adhere to these file standards placed to have their packages be installable using this tool but there’s no incentive here for long-term use until this is in. Any update with this? Currently on 2020.1.0f1, In the process of updating to 2020.3.1

1 Like

Hi @Samuel411 ,

Are you suggesting to go through each package installed, read its version from its package.json, and compare the version with itself? What do you consider to be “the installed version”?

I clearly misunderstood your suggestion. Just to be sure we’re on the same page, this thread is about Git-based dependencies retrieved from a remote repository using a Git URL, not a “file:” dependency pointing to a Git repo present on disk. The resulting package in the project cache is a subset of the Git repository files and none of the Git metadata.

Yes, I am suggesting to go through each package installed and read its version, for example I just installed my package from GIT using the URL, https://github.com/1samuel411/S-StateMachines.git?path=/S-StateMachines/Packages/com.slibrary.sstatemachines. I can view the package.json file is located in my local directory upon installing it. This contains it’s version, hence the ‘installed version’.

If we’re using GIT urls then Unity is able to use the URL in our manifest which contains the list of packages and their URLs. You can then use this URL to access it’s package.json located on GIT and read it’s version.

This is not a difficult task from what I can tell, simply compare the local package.json’s version with the GIT package.json’s version and display the option to reinstall it with the most up to date version. It’s not unreasonable by any stretch to submit an http request for a json file for every package installed when you’re pressing a button that’s job is to check for updates.

Thanks for clarifying! Now I understand what you mean. Unfortunately, it’s not as simple as that. Accessing a single file in a remote repository requires either fetching part of the repository (a costly operation if the repository is sufficiently large) or implementing a client for that server’s Web API. The latter is vendor-specific: Github.com has an API, Bitbucket.org has a different API, etc. so it’s not possible to write this is a fully portable way. It also involves authentication: this client implementation needs to be implemented in a way that lets you provide or configure credentials for these Web APIs (not the same as the Git auth implementation).

That isn’t to say this feature will never exist (we do hope we can eventually implement something like this), I’m only highlighting the fact that it’s not “just an HTTP call” as you imply, and there’s more complexity than you may suspect.

(By the way, the actual URL to your package manifest is https://raw.githubusercontent.com/1samuel411/S-StateMachines/master/S-StateMachines/Packages/com.slibrary.sstatemachines/package.json ;))

2 Likes

@Samuel411 It’s not git repo stored package, but you can use https://openupm.com/ as another package registry. The CLI is pretty easy to use and it shows versions. I host my packages on there.

@maximeb_unity Do you know where I could find the latest news/information on improvements to hosting 3rd party packages? Will there be an update in this forum? I know that y’all are working hard on getting some sort of asset store solution to the package manager, but I get excited for all the incremental improvements to hosting on other platforms.

1 Like

Thank you for the clarification, I see it’s not as simple as I originally thought dealing with GIT. Hats off if you’re able to pull it off in a reasonable way.

Awesome suggestion.

I don’t know if there are plans for the forums specifically, but when we do get updates to share about Asset Store support, I’m sure there will be some sort of news, blog post, or announcement. Bringing Asset Store packages to the new Package Manager format is definitely one of the big challenges in front of us, one that will have a major impact on the ecosystem!

Also, every Unity Editor release comes with Release Notes. Any Package Manager improvement and feature will be included and prefixed with the “Package Manager” label, so it’s potentially a good place to learn about new features (typically in alphas and betas), improvements and fixes (any release).

2 Likes