Need advise on extension deployment for multiple users

Long story short, our company is changing rapidly and the way of distributing my pyrevit plugin might need to change.

So I know for a fact that every user will get a pyRevit installation by default, it’s how I configure and distribute my plugin that I’m a bit worried about.

Current setup

Here’s my current setup:

  1. Extension directory is placed on a shared network drive
  2. Every user’s pyrevit is configured to look at said network drive as all paths are equal
  3. Someone from IT configures these installations 1 by 1 using a .bat script I provided

What I like about it

  1. No need to bug people with updates because the installation is not local
  2. Nobody is working on an older version of the scripts, there is just 1 live version
  3. I can fix issues and bugs near instantly for everybody

What I don’t like about it

  1. Someone has to go around and configure these installations which is just… you know… a waste of this person’s time
  2. I don’t like to depend on someone to do this because they have their own tasks and schedules
  3. I don’t like that the performance of, and connection to the network drive can be a bottleneck

What needs to change?

I’m seeing 2 problems I need to addres in my distribution setup.

  1. I need a better way of setting up my plugin with users that is less person dependant, and less error-prone
  2. Should I get rid of the share drive and find a way of installing my plugin locally? If so… how do I keep it up-to-date without user interferance?
1 Like

The way I usually do it is by deploying a cloud-based git repo as an extension to pyRevit, coupled with a startup script that always maintains and checks for updates to be pulled either at the startup of Revit or by pressing the update tool button from pyRevit’s main toolbar (which you can create an instance-of in your toolbar to keep everything in the same place for the end user).

if you are using github or bitbuckit for example, you can create a read-only access token and run a cmd process with the pyRevit cli to install the extension directly from your cloud git repo.

here’s a simple command you can put in a batch file that any user can double-click to install the toolbar with:

@echo off
echo Installing myAwesomePluginName Extension for Revit...
pyrevit extend ui myAwesomePluginName "https://x-token-auth:PlaceYourTokenHere@bitbucket.org/YourCompanyAccount/myAwesomePluginRepo.git" --branch=master
echo myAwesomePluginName Installed! 
cmd /k

Also, you can work with your IT team to run the command directly at startup of the users machines or at users login to automatically install it for everyone:

pyrevit extend ui myAwesomePluginName “https://x-token-auth:PlaceYourTokenHere@bitbucket.org/YourCompanyAccount/myAwesomePluginRepo.git” --branch=master

pretty much the same approach using a github fine grained token.

I explained it a couple of time, look at the end of the handout or in the code repo there is an example.

to install, I use this command line that can be run manually or at user login once:

pyrevit extend ui B1_Toolbar https://github.com/BIMONE-OUTILS/B1_Toolbar.git --dest="C:\pyRevit" --token="yourToken"

in the startup.py script I run this to make sure everyone is up to date at revit startup:

from subprocess import call
token="yourToken"
call('cmd /c "pyrevit extensions update B1_Toolbar --token="{0}""'.format(token), shell=True)
1 Like

Thanks for the replies, I was considering that option. However there is 1 snag.

I’ve got 1 single repository that hosts multiple extensions like so

repo:

github
├─ARCH.extension
├─STRU.extension
├─MEP.extension
└─extensions.json

When I pull this from github, the entire repo is dumped into a .extension folder.
Which is quite inconvenient as I then have a .extension folder, filled with .extension folders, and the root folder is added to the extensions :confused:
I could then ofcourse then use a shell script and pyrevit_cli to add those sub_extensions to pyRevit but I think that’s rather messy.

Is it possible to do this with multiple extensions in a single repo? Or should I bite the bullet and split my plugin into different repos?

without a headache: No.

Split it.
(It should not really affect your coding workflow anyway?)

Coding workflow won’t change I suspect. It’ll introduce some repository juggling though.

Might need to run a few tests. It kind of depends on how easy it is to split up a project and manage multiple repos from within PyCharm.
I have a hunch that i’ll be able to make work but better be safe than sorry right?

One thing about the token that I need. Which access rights does it need for this read-only acces? I only tried it with a temporary full-access one.

You could create a main repo hosting all the extensions and use submodules for each extension

There is a similar approach in the pyRevit repo in dev/modules

In pyCharm or whatever the code editor it is usually seamless to go from one repo to the other.

Regarding the token,
Fine grained token in github in the dev section, specific to your repo with content permission Permissions required for fine-grained personal access tokens - GitHub Docs

1 Like

Ok seems to work, pretty straight forward actually, I like it!
Only question remaining is where to store that token.
Those fine-grained tokens only live for one year, so at some point I’ll need to create a new one.

Jean-Marc I suppose you update it in your startup script so that takes care of that I suppose.
Ali: you provide a token inside your git url, does that store the token somewhere?

Or is that a bad idea?

I was hoping to combine both your suggestions into a single win.
unfortunatly storing the token inside a url in the extension.json doesn’t seem to work
none of these worked:
<uname>:<token>@github
<token>@github
oauth2:<token>@github

then again if I use your idea jean-marc, users would never need to update in the first place so… I think I’m totally fine with that approach.

Thoughts?

There was an issue on this topic that was closed during the summer cleaning (for which I complained with @Jean-Marc because it was not really solved :sweat_smile: ).

I’m still waiting for the instruction on how to properly develop and debug the c# part of pyRevit, and lacking time/willpower to figure it out myself, so I didn’t work on it yet.

A few remarks:

  • administrative task can be automated in many ways, by using GPO or other tools like ansible
  • if the problem is the ability to keep the extension private, but avoid user registering to github, you can spin up a local git server like gitea and make the repository public, so that can be reached only via lan or vpn

1 Like

Well that is a good idea, I like that.

Okay, I’m considering this one solved. Thanks