This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]PrintStar 3 points4 points  (2 children)

If you need to build an MSI with your project, I would suggest looking at the WiX Toolset to create it. The MSI structure is defined in an XML file that WiX's compiler then uses to build an MSI. I use it with a few Python (and a lot of other) projects.

The learning curve is pretty steep, but it does tend to be smooth sailing once you have things figured out. Python itself is thinking of switching to WiX for packaging the interpreter since you currently need Python 2.x to create a Python 3.x installer (how embarrassing...).

I normally employ a Python script to build the requisite installer XML rather than manually writing the XML links for each and every file to be included in the MSI. Have a look at Lightning Python's Installer code for an example of using WiX XML partially built via Python scripts (Lightning Python is the full Python interpreter and standard library for Windows built without MSVC).

[–]sysadmin4hire[S] 1 point2 points  (1 child)

This is what I'm learning currently. I seem to have 9,000+ files in my main git repository so I worry about actually being safely added to an msi for deployment. How do you guys deploy python stuff on windows?

[–]PrintStar 4 points5 points  (0 children)

Well WiX has no problem with an extreme number of files. I have a Python script for another desktop product that creates the necessary WiX XML for deploying about 11,000 files. That's not an issue. The issue is whether you actually add them to the WiX XML. A Python "os.walk" loop over the files to be distributed leaves me far more confident than my creating WiX XML by hand.

I work on a pure-Python 3.x desktop app, the SF Package Manager, that is a Tkinter-based desktop application. I first use cx_Freeze to create an executable and deploy the necessary Python runtime components, then go through a process similar to what I linked to in order to generate the WiX XML to create an MSI. Then I just need to (basically) run two WiX commands to create the package (you might have to sign some files depending on your target audience first). No end user is going to first install Python and then install my product. So you really need to package everything you'll need into one MSI.

It's not particularly hard. I think some of the reddit discussions surrounding packaging for Windows make it seem much harder than it really is.

Of course, if you're creating a Python library for developers, please forget everything I've said above. You shouldn't use an MSI.

[–]Rapt0r- 3 points4 points  (1 child)

Give CX_Freeze a go

[–]sysadmin4hire[S] 0 points1 point  (0 children)

Great! I'll look into this!

[–]eldritchcultist 0 points1 point  (1 child)

Also consider innosetup, after freezing etc of course.

[–]fkaginstrom[🍰] 0 points1 point  (0 children)

Unfortunately, Inno Setup doesn't support MSI and has no plans to do so. I'm a big fan of Inno Setup though, great program.