4

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']
)
Brigand
  • 84,529
  • 20
  • 165
  • 173
GarethPrice
  • 1,072
  • 2
  • 14
  • 25
  • This might help: http://stackoverflow.com/questions/193161/what-is-the-best-project-structure-for-a-python-application – 2rs2ts Jul 30 '13 at 00:57

2 Answers2

1

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.

Michael Ver
  • 402
  • 3
  • 5
0

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,
)
MTELab
  • 1
  • 3