packaging python code in archive file

Discussion in 'Java' started by mark jason, Dec 9, 2010.

  1. mark jason

    mark jason Guest

    hi,
    I have created a python app in eclipse pydev .The app is structured as
    below..

    mypackage
    |______ __init__.py
    |______ driver.py
    |______ helper.py
    |______ utils.py

    The driver.py has the main program.I have added if
    __name__=="__main__" block in the

    driver.py and pydev's run configuration has the following values,
    Project : myproject
    Main Module :${workspace_loc:myproject/src/mypackage/driver.py}
    So,the app runs in pydev without any problems.

    Then I thought of providing the modules as a zip file.So I created a
    zip file containing
    mypackage directory.The user should be able to unzip the zip file and
    run the application from command line .

    What bothers me is that ,the user will have to cd to mypackage folder
    and run python driver.py..
    This doesn't look like the proper way..
    I also thought of putting the driver,helper,utils modules in a folder
    called mycode and zipping it without the __init__.py file .
    I am not sure which is the correct way.
    Can somebody advise me as to how I can package it better?

    thanks,

    mark
     
    mark jason, Dec 9, 2010
    #1
    1. Advertising

  2. mark jason

    Alex Mentis Guest

    mark jason wrote:

    > hi,
    > I have created a python app in eclipse pydev .The app is structured as
    > below..
    >
    > mypackage
    > |______ __init__.py
    > |______ driver.py
    > |______ helper.py
    > |______ utils.py
    >
    > The driver.py has the main program.I have added if
    > __name__=="__main__" block in the
    >
    > driver.py and pydev's run configuration has the following values,
    > Project : myproject
    > Main Module :${workspace_loc:myproject/src/mypackage/driver.py}
    > So,the app runs in pydev without any problems.
    >
    > Then I thought of providing the modules as a zip file.So I created a
    > zip file containing
    > mypackage directory.The user should be able to unzip the zip file and
    > run the application from command line .
    >
    > What bothers me is that ,the user will have to cd to mypackage folder
    > and run python driver.py..
    > This doesn't look like the proper way..
    > I also thought of putting the driver,helper,utils modules in a folder
    > called mycode and zipping it without the __init__.py file .
    > I am not sure which is the correct way.
    > Can somebody advise me as to how I can package it better?
    >
    > thanks,
    >
    > mark


    Umm...write it in Java and package it in a .jar file? (In other words,
    I think you posted to the wrong newsgroup... :) ).

    Alex
     
    Alex Mentis, Dec 9, 2010
    #2
    1. Advertising

  3. mark jason

    Arne Vajhøj Guest

    On 09-12-2010 00:33, mark jason wrote:
    > hi,
    > I have created a python app in eclipse pydev .The app is structured as
    > below..
    >
    > mypackage
    > |______ __init__.py
    > |______ driver.py
    > |______ helper.py
    > |______ utils.py
    >
    > The driver.py has the main program.I have added if
    > __name__=="__main__" block in the
    >
    > driver.py and pydev's run configuration has the following values,
    > Project : myproject
    > Main Module :${workspace_loc:myproject/src/mypackage/driver.py}
    > So,the app runs in pydev without any problems.
    >
    > Then I thought of providing the modules as a zip file.So I created a
    > zip file containing
    > mypackage directory.The user should be able to unzip the zip file and
    > run the application from command line .
    >
    > What bothers me is that ,the user will have to cd to mypackage folder
    > and run python driver.py..
    > This doesn't look like the proper way..
    > I also thought of putting the driver,helper,utils modules in a folder
    > called mycode and zipping it without the __init__.py file .
    > I am not sure which is the correct way.
    > Can somebody advise me as to how I can package it better?


    For a Java relevant solution:
    - compile with jythonc
    - package in a jar file with Main-Class directive
    and a Class-Path directive for Jython library

    Otherwise just put a .bat/.sh file somewhere and
    tell them to run that.

    Arne
     
    Arne Vajhøj, Dec 10, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul Rubin

    code packaging

    Paul Rubin, Jul 20, 2007, in forum: Python
    Replies:
    7
    Views:
    355
    Paul Rubin
    Jul 24, 2007
  2. Alex Hall
    Replies:
    4
    Views:
    668
  3. mark jason

    packaging python code in zip file

    mark jason, Dec 9, 2010, in forum: Python
    Replies:
    1
    Views:
    439
    Peter Otten
    Dec 9, 2010
  4. R.. Kumar

    Packaging common code with gems

    R.. Kumar, Jun 6, 2010, in forum: Ruby
    Replies:
    2
    Views:
    83
    R.. Kumar
    Jun 6, 2010
  5. Mohan
    Replies:
    3
    Views:
    854
    Arved Sandstrom
    Feb 10, 2012
Loading...

Share This Page