Distribute script that uses third party libraries


In short, I am looking for a convenient way to enable others to run scripts that use third party libraries.

Below some more context:

I have a script that uses a third party library (numpy). That library sits in the site-packages folder of another Python interpreter installed on my computer, and is added to sys.path of the Python processes launched from pyRevit via the environment variable PYTHONPATH. This follows the pyRevit instructions and works all fine.

The inconvenience comes when sharing the script with others. They would have to go through the same process, and not everyone is able to do so. Iā€™m therefore looking for ways to simplify/automate that process for others.

Below two approaches I could come up with so far:

  • Share a script that executes above commands - a downside might be the impact of the Python install and setting PYTHONPATH as environment variable on and other (Python) processes
  • Share a script that copies the required libraries from a repo to the site-packages of the pyRevit program files - not sure if the files and folders of a 3rd party library can simply be copy-pasted to the site-packages folder, as a normal install also places files outside the site-package folder

So my question: what is the best way to enable others to run scripts that use third party libraries?

1 Like