Creating mac os x software bundle with java processing and python - python

I have writing a program using Java Processing.org programming language and it uses some python scripts. Circumstances exist that I cannot change or re write these python scripts in processing.
My problem is I need to bundle this all together and create software bundle for Mac OS X for easy installation. I know there is option in Processing IDE to create software bundles but that will ignores the python files, even so client's machine could not have python installed.
I thought about creating python executable and putting it in to the bundle. Could anyone suggest me better options or software tools to do this.
Regards,
Waruna

Python is shipped with Mac OS X, so your clients should be able to run the scripts.
You do not need to create a "Python executable" as the Python interpreter can just run the .py files.
A Mac OS X application bundle (essentially being a folder) contains a folder Contents which in turn contains the binary application files, resources, etc. You can place your .py files within the .app bundle and call them from within your Java code.
The bundle documentation is available here http://developer.apple.com/library/mac/#documentation/CoreFoundation/Conceptual/CFBundles/Introduction/Introduction.html

It sounds like you're trying to deliver some Python modules in a user friendly manner (i.e., without the end users having to know about easy_install or whatever).
I am no expert in this area, but it seems to me like you're trying to solve a similar problem that the Mercurial people solved, you may want to have a look at what they did. This is how Mercurial is delivered on the Mac - http://mercurial.berkwood.com/.

Related

How to distribute a Python script to non-developers on Windows

Say I made Python script with a GUI, which depends on a few libraries (e.g. Pandas). I want to share this application with users who know nothing about programming, and who are used to simply click an install file or open an executable.
What are the options for bundling my script, its dependencies, and the Python runtime together so that my users can "just" use it ? This can be either as an executable, or an online app.
EDIT : some users pointed to this page as a duplicate. This obviously true, but most answers are pretty old. I'm looking for up-to-date solutions as of 2019.
I have been using PyInstaller for a while now, seems like it would do exactly what you
want.
You need to use pyinstaller package
PyInstaller freezes (packages) Python applications into stand-alone
executables, under Windows, GNU/Linux, Mac OS X, FreeBSD, Solaris and
AIX.
pyinstaller.org

How to distribute python software to users of low technical ability?

I have a python application (3.5) that I’m trying to distribute. It:
Uses no GUI libraries (it runs in the browser)
Uses several external packages (Flask, SocketIO, httplib2)
maintains saved config and data files inside the main source directory
The target users:
Use Mac or Windows
Do not understand the concept of the terminal/command line (testing has shown that it can take hours to teach users how to cd into the source directory to run a .py file).
Generally have little difficulty installing the python interpreter from python.org (but have great trouble starting and exiting the python console).
Are generally of very low technical ability.
Preferably, the app should:
be “click and play”, as I have found that typically the cd navigation is the biggest hurdle preventing users from running my application.
not require manually modifying any system settings
I am developing from Ubuntu Linux. I have access to a Windows VM, but not a Mac computer. How do I distribute my application?
There are a couple of applications that can help you to distribute a Python Application, for this case you want to take a look on Python freezing tools like py2exe (windows only) or py2app (MacOs).
This two will help you distribute your code without all the hassle of making the user to install the dependencies and run anything from the command line.
However if your application runs on the browser, you probably want to just put that into a server (take a look of openshift, it's free) it will make your life a lot easier.

XCode Project encompassing Python2 and Python3

Hi I'm trying to write two python scripts for one project. My goal is to have the front end of some analysis done in python3 with the output of many text files (completed). The back-end of analysis will read text files and interface with PyMOL, which is python2 dependent (which I did not realize). Using Xcode, or something else if Xcode is poorly equipped for this, can I run my 2 scripts consecutively as one project? Conceptually this seems simple but I have been unable to manage it.
Essentially I would like this in Xcode:
Project
Python3 script
Python2 script
Any help would be great.
Xcode is not a Python IDE*. It can open and edit Python files, but that's about it. Previous versions of Xcode included support for many programming languages, but now it is limited to just four: C, C++, Objective-C, and Swift. I recommend that you download a Python IDE instead of Xcode. There are many to choose from, and most run on Mac.
* - Well, technically you could set up Xcode to run Python by setting up the project to use an external build system. But that's like using a nuke to swat a fly -- you should use dedicated Python tools instead.

Include python library with program distribution

Is there a way to distribute a python library with an application, so that it can be run with out any installation? The app is primarily going to be used in a computer lab, where users do not have permission to install global libraries. Ideally, users would simply be able to unzip a folder and run the app. The following can be assumed:
The python interpreter is present
Linux operating system
The specific library I need is matplotlib, but I would like to find a generic solution. I've looked at programs like PyInstaller, but they create very large programs that are slow to start. They also include a python interpreter, which is unnecessary.
Firstly, p2exe is Windows only.
In principle you can put all of you libraries into the ZIP file so they get expanded in place with thie application. At most you may need to adjust the PYTHONPATH variable to point at the lib's location.
There is no technical difference between modules installed on the path and in the system's python installation.
Have you looked at cxfreeze?

Why Python gets installed in Frameworks directory?

I've been wondering why python gets installed in directory named Frameworks? (though it's not Framework)
$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
Somebody please explain! Thanks!
That's the way it is in OS X.
The Mac/README file in the Python source tree goes into some more details of the advantages of a framework build versus a traditional UNIX shared-library build, which will also work on OS X. The main points:
"The main reason is because you want
to create GUI programs in Python.
With the exception of
X11/XDarwin-based GUI toolkits all
GUI programs need to be run from a
fullblown MacOSX application (a
".app" bundle).
While it is technically possible to
create a .app without using
frameworks you will have to do the
work yourself if you really want
this.
A second reason for using frameworks
is that they put Python-related items
in only two places:
"/Library/Framework/Python.framework"
and "/Applications/MacPython 2.6".
This simplifies matters for users
installing Python from a binary
distribution if they want to get rid
of it again. Moreover, due to the way
frameworks work a user without admin
privileges can install a binary
distribution in his or her home
directory without recompilation."

Categories

Resources