There are various ways to distribute a PyXLL add-in, typically:
-
Sharing Python code on a network drive
This is the simplest option as it allows your Python code to be deployed centrally, ensuring that all users see the same code at all times.
As long as a user can read from the network drive, PyXLL can be configured to read Python modules from there. This ensures that you don’t need to copy code around and that all users are always referencing the same version of your code.
The PyXLL configuration can be shared by using the external_config option in the pyxll.cfg file. You can list multiple external configs which will get merged together when PyXLL loads.
The PyXLL config file itself can also be on a network drive. The environment variable PYXLL_CONFIG_FILE can be set to tell PyXLL to load a config file from somewhere other than the default location. You can use environment variables inside the config file so that logging gets written to the user’s local storage.
When deploying code on a network drive you will want to make the folder read-only to your users to ensure no accidental updates occur.
To update the Python code, rather than updating in-place it is good practice to create a new folder with the updated code and then change the pythonpath in the shared config file to that new folder. This way if there are any problems then you can quickly revert to the previous folder, and it also avoids problems with certain files (e.g. dll and pyd files) becoming locked while users have then open. -
Pulling code from a shared folder or deployment server
New in PyXLL 4.4: Use a startup script to configure PyXLL and download or update Python code from a central location (e.g. a shared folder) or web server.If you already have another mechanism for distributing Python code to client PCs then you can use that to distribute the Python code to the client PC and configure PyXLL to use the code in the location it is deployed to.
-
Building an installer
This is useful when you need to deploy to PCs that might not have fast or reliable access to your network, and so accessing a shared drive or a deployment server is not feasible. The Python runtime can be bundled with PyXLL into a single standalone installer.
Depending on your use case, this may be a good solution for deploying a PyXLL based add-in to multiple users.
For detailed instructions and an example project for building an MSI installer, see https://github.com/pyxll/pyxll-installer.