top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

How to package a private project in python?

+1 vote
108 views

What is the best way to distribute a private, pure python, Python 3 project that needs several modules (some available on pypi but some private and used by several separate projects) in order to run?

I'd like to include everything that my project needs to run in a single package. The best way to do this seems to be to be to create symlinks to the source code of the "3rd party" modules I need and create a setup.py file that includes them in its "packages" list. Is this what other people do?

But even more ideally, I'd like to package my script and its dependencies in a single zip file that can be executed by python directly. I see several declarations that this is possible online, but I can't find a simple recipe for converting a script and its dependencies into this kind of distribution. Could someone give me a
pointer to a description of "the right way to do it".

I'm making life harder for myself by using python 3 (PyInstaller still only supports Python 2) and by the fact that I can't release some of the necessary code publicly.

posted Dec 16, 2013 by Sumit Pokharna

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote

For pure python code its as simple as putting the code in a zip file with a script called __main__.py. Then you can run the zip file with python as if it was a python script.

answer Dec 16, 2013 by Jai Prakash
+1 vote

Well, pyzzer comes to mind (you find it on pypi). It creates an executable zip-archive containing all the stuff that you need (at least the pure python modules).

The problem remains: how to find all the modules and packages that need to be included?

Python's modulefinder can do this for you. If you want to live on the cutting edge you could try the new one that I've written for Python3. It currently lives in

http://code.google.com/p/ctypes-stuff/source/browse/trunk/mf/py2exe/mf3.py

It has several advantages against the standard library's modulefinder; for example it finds and is able to extract the bytecode even from zipped eggs.
For examples how it can be used, you could peek into the runtime.py module in the same directory, method build_library of class Runtime.

I guess for an experienced developer it takes around one day to take these pieces and build a script that scans a python script, finds all the needed modules and packages, and uses pyzzer to build an executable
archive from it.

answer Dec 17, 2013 by Deepankar Dubey
Similar Questions
+1 vote

I want to install path.py in my Python 3.4 environment on a Centos 5 box. My /usr/local/bin/ contains:

easy_install-3.4 
python3.4  
etc. 

We are behind a proxy server and I tried this:

# /usr/local/bin/easy_install-3.4 path.py 

Searching for path.py 
Reading https://pypi.python.org/simple/path.py/ 
Download error on https://pypi.python.org/simple/path.py/: hostname '172.29.68.1  
' doesn't match either of 'www.python.org', 'python.org', 'pypi.python.org',  
'docs.python.org', 'testpypi.python.org', 'bugs.python.org', 'wiki.python.org',  
'hg.python.org', 'mail.python.org', 'packaging.python.org', 'pythonhosted.org',  
'www.pythonhosted.org', 'test.pythonhosted.org', 'us.pycon.org', 'id.python.org' --  
Some packages may not be found! 

Couldn't find index page for 'path.py' (maybe misspelled?), Am I best to use pip or easy_install? also if easy_install, how can I fix the above error?

+1 vote

I want to read the combo box in excel by using "xlrd" but in the output it is showing empty message, its not reading the combo box can u guys help me how to read the combo box in excel by "xlrd"

code written like this

workbook = xlrd.open_workbook('path of the file')
worksheet = workbook.sheet_by_name('sheetname')
TargetSystem = worksheet.cell_value(4, 2)
+1 vote

I'm trying to work through Skienna's algorithms handbook, and note that the author often uses graphical representations of the diagrams to help understand (and even debug) the algorithms. I'd like to reproduce this in python.

How would you go about this? pyQt, pygame and pyglet immediately come to mind, but if I go that route the number of people that I can share my work with becomes quite limited, as compared to the portability of javascript projects.

I guess my question really is: has anyone had success creating an interactive graphical project in the browser using python?

0 votes

I'm trying to come up with more project ideas for intermediate learners, somewhat along the lines of
http://bit.ly/intermediate-python-projects .

So here's a question for people who remember coming up from beginner: as you moved from exercises like those in Learn Python the Hard Way, up to your own self-guided work on small projects, what project were you working on that made you feel independent and skilled? What program first felt like your own work rather than an exercise the teacher had assigned?

I don't want anything too large, but big enough that there's room for design, and multiple approaches, etc.

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...