Need help to compile add-in created in python

Hello,

First of all thanks for the wonderful forums and support.
I have been reading a fair bit here as well as watching all of Ehsan’s youtube materials.

I have created a few tools for my needs and currently have them on my extension with the help of Pyrevit.

I was wondering if it is possible to compile these and share with others to use without the need of having pyrevit installed. we have some dedicated laptop to certain projects that users are not allowed to install any software. So I was wondering if I could some how create a *.dll / *.addin to use on these laptops.
Thanks again for your help and support

Welcome,

I guess that would most probably be a breach of your inhouse infosec policies.

I have checked with our IT security and digital delivery team and they will check the code and do the compiling themselves and place the files on the laptops. I have been asked to check if it is possible to compile without the need of using visual studio

well, there is always some sort of way.
if you google a bit python to dll you will find some tools to do that. but how do you create the ui / toolbar?
today your tools are leveraging the pyRevit core
you will always need the pyRevit runtime somewhere.
You could use the core bundle of pyRevit, remove the pyRevit toolbar itself and show only your extension. But this implies the deployment or the pyRevit core.

if you really want a dll as an end product, creating the tools in C# make more sense IMHO

Thanks for your reply,

I have done a bit of search and that is the bit of was not sure about (converting the UI)
I was hoping I could convert and not needing to create all the forms in VS.

Thanks again for your help

yeah, you can’t really package the bits and pieces you are using from pyRevit + the core and runtime elements and compile them in a decent way, not that I know of.
I was using a tool like pyinstaller to make an exe from a python code this morning, but this is something that exists outside Revit.

the python Engine exists within pyRevit which exists within the Revit application. all three parts are not easily disassembled to be compiled.

1 Like

I might add: pyrevit description is “rapid appl8cation prototyping for revit”; it is not intended to be a way to package and deploy addins.

Once your prototype is working and ready to be published, you should embrace the autodesk guidelines and rewrite the code in c# or vb.net, using their interfaces to define the commands, create the ribbon buttons and write the addin xml manifest.

I understand this is not the solution you want to hear, but it is the only way to have a self contained addin.

Maybe pyrevit-cli coild help to install things as non-admin user and configure it to download your extensions and hide the default pyrevit tab?

Thank you for your reply.
Am I correct in understanding that Visual Studio is the only platform that can be used to deploy / compile add-ins?
Thanks again for your help and support

The compilation is done using ms build tools, that could be installed separately;
For developing, you can also use visual studio code with the c# Extension or jetbrains rider ide (non-free).