How can I package a scrapy project using cxfreeze? - python

I have a scrapy project that I would like to package all together for a customer using windows without having to manually install dependencies for them. I came across cxfreeze, but I'm not quite sure how it would work with a scrapy project.
I'm thinking I would make some sort of interface and run the scrapy crawler with 'from scrapy.cmdline import execute', but I'm not sure.
Thanks in advance for any help.

Try out py2exe. It works well, you can bundle all the code in one exe.
I suggest you to exclude unused packages to reduce exe size (see py2exe examples on its site)
UDATE
As suggested try also
GUI2Exe is a Graphical User
Interface frontend to all the
"executable builders" available for
the Python programming language. It
can be used to build standalone
Windows executables, Linux
applications and Mac OS application
bundles and plugins starting from
Python scripts.

Related

Is there a simple way to include entire applications in pyinstaller?

As the title implies, I am looking for a way (if any) to include entire applications in my pyinstaller executable. I have seen the --include-binaries option for single-file binaries, as well as some vague hints as to where to get started for what I need, but never anything specific.
Since my application uses Selenium, and I'd not like the user to install google-chrome to use my application, I'd like to include a portable version of Chrome bundled within the exe, as well as a copy of wireshark (https://wireshark.org).
So far, I've worked on custom cross-platform setup files for Linux and MacOS using shell scripts, but I imagine there to be a cleaner way than messy wget requests to url.
Thanks for the help!

Use pycurl without installation

I am working on a tkinter app and I would like to use the pycurl module in my project but without being installed on any host machine... Like a portable version into my package.
I didn't see any topic on the web speaking about it but still keeping hope to have a sort of workaround for it.
Thanks in advance.
You could create a binary file of your project using pyinstaller. It will bundle all the dependencies that are required by your application, users can just run the binary file without worrying about installing or setting up dependencies.

How can I run my python scripts on a windows machine without installing extra libraries?

I'm working on a python script but it uses a library called Selenium to perform most of its tasks. This script needs to be able to run in a windows environment and I can't go through the trouble of installing Selenium on every machine that I decide to run this script on. I've heard of py2exe but haven't tried it out and am not sure if it will help here. Will I be able to run my script without having to install selenium when using py2exe? It doesn't seem like it would work since selenium isn't built into python.
I'd like to be able to run this script on Windows without having to install python but I'll be satisfied if I can get it to work without having to install selenium. I'm not sure how possible this is and I'm actually fairly new to developing in python so I don't know if this idea will work out.
Actually, other people will be using this script and it would be best if they don't have to go through the trouble of installing python and the selenium library just to use the script. They aren't exactly familiar with python or programming in general, so installing selenium could be a problem for them. I'd like to make the use of my script as user friendly as possible.
The script mainly deals with automating a website. I understand that this can be done in vbs and it would be better in vbs for windows but I've already made it in python and don't want to go through the trouble of re-writing it in vbs, since I've already spent a lot of time on this already.
I've tried many Google searches and can't find much about this topic which leads me to believe it's not possible. The closest solution I've found is py2exe but will it still work if my script uses a library not built into python?(selenium)
I'm sorry if this question was kind of nooby, I'm just trying to learn. I appreciate any help! :)
Yes, py2exe will build an executable that includes python so that python will not need to be installed on any extra computers. When you build the executable with py2exe you can include or exclude modules in your build.
PyInstaller is another good module for building executables, it will automatically bundle any includes. Like py2exe you can bundle everything into one executable, include extra data files, hide console windows and more.
You can include external libraries in py2exe
From the py2exe FAQ,
How does py2exe decide which modules you need?
To determine which modules should go in the final .exe file, py2exe does a recursive search of the script that you are packaging to find its dependencies and, in turn, all of their dependencies. This process is written so that it can output extensive debugging information, showing you which modules convinced py2exe to include which other modules. To display this debugging trace, run the py2exe "module finder" code standalone with at least one -d option to turn on "debugging":

Can I convert my python script to a .app?

Is it possible to convert my .py script to a .app that works through a text box or something?
Thanks
Try py2app.
py2app is a Python setuptools command which will allow you to make
standalone application bundles and plugins from Python scripts. py2app
is similar in purpose and design to py2exe for Windows.
Because this is a vague question, I will provide a general answer.
You need to decide on a GUI framework. There are a number of them to choose from.
PyQt4
http://qt.nokia.com/products/
http://www.riverbankcomputing.co.uk/software/pyqt/download
PySide (LGPL version of PyQt4) - http://www.pyside.org/
GTK - http://www.pygtk.org/
wxPython - http://www.wxpython.org/
TkInter
http://wiki.python.org/moin/TkInter
You could even write a web interface that communicates with your python script via RPC or an HTTP rest interface. Take your pick!
My vote is on PySide/PyQt. Its very flexible and easy to use.
At that point you would then use something like py2app to package up the entire environment into a standalone .app that can be distributed.
You can also use the cross-platform pyinstaller, which is more modern and I've had a good experience with.
sudo pip install pyinstaller
pyinstaller myprogram.py --windowed
There's a lot more configuration if you want to go cross platform, but this may get you started:
http://pythonhosted.org/PyInstaller/#building-mac-os-x-app-bundles
This creates the distrutable. From there I use things like Inno Setup on windows or app2dmg for mac.

How can I package my python application with external python libraries?

I hope my title was clear. I'm using wxpython for making a GUI and I want it to be able to be opened, extracted, and have it work on all operating systems. I was able to include twill by finding a folder called twill inside the twill archive, which worked fine. However, I'm unable to figure out how to correctly package wxpython.
EDIT: I'm not using either. py2exe is only for windows, and bbfreeze doesn't seem to work on mac (so it's not cross platform)
Unfortunately, there's just no one stop solution so that a single installable executable will work across all operating systems. The right solution is really to provide a different installer or executable for each OS; For windows, use py2exe, for mac, py2app is a good choice, and for linux you should just provide a tarball with a reasonable setup.py (that you will need for the first two, anyway).
You should go with the recommendation of TokenMacGuy. But I preferrably would use a tool which is able to freeze the application for all OS instead of using different ones.
cx_freeze is a good choice regarding these terms.
This is another fine alternative:
PyInstaller is a program that converts (packages) Python programs into stand-alone executables, under Windows, Linux, and Mac OS X. Its main advantages over similar tools are that PyInstaller works with any version of Python since 2.2, it builds smaller executables thanks to transparent compression, it is fully multi-platform, and use the OS support to load the dynamic libraries, thus ensuring full compatibility.
Have you tried http://cx-freeze.sourceforge.net/ ?

Categories