-1

I have a problem, i am trying to package an application for learning purposes using setuptools in python 2.7 on Ubuntu. I am successfully able to create the wheel(.whl) file . I uploaded it to pypi and tried to download and install into other Ubuntu system , it installs fine. But i am not sure how to use that installed wheel package. Can anyone guide me this process in a simple manner ? I am tired of looking these information all around the web and haven't found anything helpful yet. please help.

Here is the simple structure

Directory(XYZ)

XYZ/index.py

XYZ/setup.py

index.py contains -

print "hello from index"

setup.py contains -

from setuptools import setup

setup
(     name='vivek',
      version='0.1',
      description='The test upload',
      author='TEST',
      scripts=["index.py",],
      author_email='flyingcircus@example.com',
      zip_safe=False)

Applying command sudo python setup.py bdist_wheel generates these in XYZ directory -

build (directory) , dist (directory)  , index.py , index.py~  , setup.py ,   setup.py~  ,  vivek.egg-info (directory)

In dist directory i have the wheel file i uploaded to pypi- vivek-0.1-py2-none-any.whl

Now my question is how to use this wheel file when i install it on other systems (sudo pip install vivek) ? If i try to import it in other modules, it says " module vivek not found ". if i simply type 'vivek' on terminal it says "no command vivek found". what is the way to solve this problem ? please help. Thanks in advance :)

vivkv
  • 931
  • 2
  • 14
  • 29

1 Answers1

0

I figured it out how to make it work. In case if anyone gets this problem here is how i solved it -

I created another directory named project inside XYZ directory and in project directory i created a blank file __init__.py , also i moved index.py into project directory. I left setup.py in XYZ directory. so now the structure is something like this -

XYZ/project/index.py

XYZ/project/__init__.py

index.py

def fun():
    print "hello from vivek fun"

code in setup.py

from setuptools import setup
setup(
name = "vivek",
version = 1.0,
packages = ["project"],
scripts = ["project/index.py",],
)

and then for packaging it to wheel file i followed the same process (sudo python setup.py bdist_wheel) from XYZ directory and as usual it generated the wheel file vivek-1.0-py2-none-any.whl which i uploaded to pypi and on another system, i used sudo pip install vivek it downloaded and installed the package on that other system.

Now to test i wrote a test file "test.py" (on other system)

test.py

import project.index
project.index.fun()

And it worked ! :)

vivkv
  • 931
  • 2
  • 14
  • 29