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:
Extension directory is placed on a shared network drive
Every user’s pyrevit is configured to look at said network drive as all paths are equal
Someone from IT configures these installations 1 by 1 using a .bat script I provided
What I like about it
No need to bug people with updates because the installation is not local
Nobody is working on an older version of the scripts, there is just 1 live version
I can fix issues and bugs near instantly for everybody
What I don’t like about it
Someone has to go around and configure these installations which is just… you know… a waste of this person’s time
I don’t like to depend on someone to do this because they have their own tasks and schedules
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.
I need a better way of setting up my plugin with users that is less person dependant, and less error-prone
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?
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:
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
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?
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.
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.
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 ).
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