Question

So I am a neophile at python building and packaging.

I am confused as to whether my setup is viable, and whether there is a better way of structuring the code file-wise to enable better packaging.

In essence, I have:

/top_folder/
|___setup.py
|___file1.py
|___file2.py
|___lib/                        <--- (FOLDER)
    |_____ binary1
    |_____ libfile1.py
    |_____ libfile2.awk
    |_____ __init__.py

Is a setup.py file such as this the right way to go about things?

setup(
    name='myName',
    version='1.0a',
    #packages=['lib'],
    url='http://myUrl.co.uk',
    license='GPL2',
    author='myAuthorName',
    author_email='myAuthorEmail',
    description='myDescription',
    py_modules=['file1', 'file2']
)
Was it helpful?

Solution

Perhaps this Open Sourcing a Python Project the Right Way post may help. It covers not only setup.py file, but almost all tools and concepts.

OTHER TIPS

create a file to run this command:

python.exe build.py py2exe

Build.py should contain this (minus the notes):

from distutils.core import setup
import py2exe

Note: Any modules/libraries you need to include (this one uses timer.py) MODULE_LIST = ["timer"]

Note: 'bundle_files': 1' and zipfile=None compiles every into one exe with no dependencies console = script will make your exe run your python program as a script in the console. PyFindReplaceThreaded.py is the py file you want to build.

setup(
    options = {'py2exe': {'bundle_files': 1}},
    console = [{'script': "PyFindReplaceThreaded.py"}],
    zipfile = None,
)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top