UI Extensions from a Private Repo

Hi all,
I’m currently working on a plugin for internal company use that I’m hosting on Github and want to distribute to team members. However, repo is private since it contains some sensitive IP and is linked to some of our in-house Revit families and other data structures. I’m wondering what the best way to structure the repo is and also how to use the Revit CLI to share the plugin.

My current repo is

root/src/my_extension.extension/{.tab, etc}

However, I noticed in this thread that @Jean-Marc started where he has his root directory, a .tab file, and then extension.json but I’m not sure what other requirements there are to get this to work. In my command, I had to use .extension at the end of my folder name, but maybe this is not a requirement.

It seems afterwards, I can make a Github PAT and then do pyrevit extend ui name https://github.com/***.git --dest="C:\pyRevit" --username="xxxxxxx" --password="xxxxxxxx" --debug which makes sense (which will add the extension to my revig_config.ini I believe).

Would just love some advice + documentation links on the structure of the Github repo!

basically following this should get you going:

Summary of the most secured way:

  1. install pyrevit
  2. create a repo containing the .tab folder and its content (the .extension higher level folder will get created by the command line) and extension.json file
  3. get your user to create a github account
  4. add them to your private repo
  5. have them create a github private access token
  6. run the command line to install the toolbar
    pyrevit extend ui extensionName https://github.com/gituser/repoName.git --dest="C:\xxxx" --token=``"personnalaccesstoken123differentForEachUser"

and you can follow the explanation for the rest in the link above about the way to update from the private repo

Hi Jean-Marc, thank you for the response! Is there documentation somewhere onto how this extension.json should be formatted? I can find examples in Github that seem correct, but just curious if there are other parameters in extension.json that I can tweak.

and also just to confirm, my extension.json + .tab needs to be in the root of repoName.git (I can’t nest it one level deeper for example)

I suppose to get around this I can just clone the repo using the PAT and then create a powershell script to map to that destination with pyrevit extend ui extensionName ./repoName/src/extensions

Nope, that’s it.

Exactly.

Not sure why you would need to do that.
Whenever you use the ‘pyrevit extend ui’, it does download a zipped version of the repo and unzip it in whatever location you are providing in the ‘–dest=’ argument of the command under the extensionName.extension folder.
It contains the full content of the repo, therefore, you can edit from this folder as it contains the .git folder that specifies the connection means to the repo.

Managing extensions

I think he is asking if he is able to clone the repository to a network or local drive, and use the file system path for the source location instead of a URL for Github, since this would eliminate the requirement to distribute a PAT in plain text files to users without Github access.

I was trying to do the same thing a couple of days ago, and I was not able to specify a folder path for the repository, and had to use Gitea to have a URL that I could then use for installation and ribbon reloads.

I don’t think the Pyrevit command line utility supports this does it? I could use Git commands from the command line to update using the folder path but Pyrevit commands complain for a valid URL.

Got you,
You can:

pyrevit extensions paths (add | forget) <extensions_path> [--log=<log_file>]

you can add a folder as a source for extensions:

pyrevit extensions paths add C:\folder\path

(not the .extension folder, but one level up)

Thank you @Jean-Marc for the answers and @jpitts for the follow-up! I was mostly just curious about private repo format + extension.json format - one quick follow-up to this comment

Not sure why you would need to do that.
Whenever you use the ‘pyrevit extend ui’, it does download a zipped version of the repo and unzip it in whatever location you are providing in the ‘–dest=’ argument of the command under the

I have a root repo and a folder inside that repo called extensions. So it looks like the command for extend ui extensionName -github URL- assumes the extension.tab is at the root (but in some cases it might not be). I think this is what jpitts was asking too - how do you specify a file path within the private github repo.

I was trying to do the same thing a couple of days ago, and I was not able to specify a folder path for the repository, and had to use Gitea to have a URL that I could then use for installation and ribbon reloads.
I think the command pyrevit extensions paths (add | forget) <extensions_path> [--log=<log_file>] might be for local and not for Github but I could be wrong here.

Check my follow up in the Github App thread. I described the configuration I just finished setting up using a VPN hosted repository that allows updates without authentication.

This uses file system protocol which is not very efficient. I plan on setting up a server to run a Git daemon, but more or less same setup other than the protocol change.

No I was refering to wanting to point to a repository on a network drive, not a folder within the Github repository.

My extension goes here:
--dest="C:\pyRevit-Master\extensions\our_ribbon.extension"

I have our_ribbon.tab at the root of my repo. so the our_ribbon.extension does not exist in the repo or file system until the clone command creates the filder to clone into

If I’m understanding your setup to having the our_ribbon.extension folder as part of the repo, then I think you need something like
--dest="C:\pyRevit-Master\extensions"

1 Like

One thing I would really like to see is
--image=[zip_repo.zip]
added as a pyrevit extend command option like there is for pyrevit clone.

function Clone-PyRevit() {
    pyrevit revits killall
    pyrevit clones forget $ourclonename > $null
    pyrevit clone $ourclonename --image=path\to\pyrevit.zip --dest=$pyrevitroot --debug
}

We have to set up machines remotely and the internet access is restricted, and I’m currently using manually expanding the zipped repo for our ribbon within our powershell installation script.

# install extensions
function Install-Extensions() {
    Try {
        Expand-Archive -Path extension.zip -DestinationPath $pyrevitexts -Force
        Write-Output "Archive extracted successfully to $destinationDir"
    }
    Catch {
        Write-Error "Error extracting archive: $_"
    }

    Copy-Item -Path "$($pyrevitinstaller)\pyRevit_config.ini" -Destination $pyrevitroot6
}

would prefer to just point to the zip file like I do for the pyrevit clone command just to keep everything clean and simple. Maybe something like this:

pyrevit extend ui $ourextname --image=path\to\extension.zip --dest=$pyrevitroot --branch=$ourbranchname --debug

I’m going to start poking around in the pyrevitCLI files but no idea if its possible. Maybe @eirannejad knows why --image= wasn’t implemented for extend but was for clone?

Me being lazy I would include the extension in the clone zip file then …

Raise an issue for the feature to implement the --image and I will look at it

For those interested: Github App Thread is here

and I see that makes sense (pointing to an network drive).

If I’m understanding your setup to having the our_ribbon.extension folder as part of the repo, then I think you need something like
--dest="C:\pyRevit-Master\extensions"

I will have to try this to see - it may work, but not positive (since I think the issue is more on grabbing the correct location from the repo than it is sending to the correct destination)