Skip to content
This repository has been archived by the owner on Feb 25, 2018. It is now read-only.

How package a multi-script app? #37

Closed
mamcx opened this issue Dec 21, 2012 · 1 comment
Closed

How package a multi-script app? #37

mamcx opened this issue Dec 21, 2012 · 1 comment

Comments

@mamcx
Copy link

mamcx commented Dec 21, 2012

So far the examples I see are for only a single py script. I have a app like:

main.py
settings.py
data.py

When I run the exe, it complain that settings (imported from main) don't exist. What I need to do?

setup(name="App",
  version="1.2.3",
  #package_data=recursive_glob(pattern='*.py'),?? Is this?
  scripts=[os.path.join('..','main.py')],
  options={"bdist_esky":{"includes":[]}},
  )
@rfk
Copy link
Contributor

rfk commented Dec 23, 2012

It sounds like the other python files are not "scipts" so much as modules that are imported by the main script, is that correct?

If so, you should try to follow standard python package layout when structuring you code. I would recommend putting all of your code into a package named after your application, like this:

setup.py
<appname>/
    __init__.py
    main.py
    settings.py
    data.py

In your main script, you can then access e.g. your settings.py by doing "from import settings".

Structuring things in this way will make it much easier for package tools such as esky to find and include all the necessary code, and it will also help avoid some gotchas in the python import process.

Your setup.py can then be along the lines of just:

setup(name="App",
  version="1.2.3",
  scripts=[os.path.join('<appname>', 'main.py')],
)

@mamcx mamcx closed this as completed Dec 26, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants