Create setup.py to install python package

1

I have this project link and I'm trying to create a setup.py so that the functions and classes of xmppbot.py are available for other developments but I do not give with it.

I have rewritten the setup.py thousand times taking as an example:

link

link

link

link

link

etc and then at the moment of truth this happens:

$ python
Python 2.7.9 (default, Sep 17 2016, 20:26:04) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from xmppbot import botcmd, XmppBot
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name botcmd

or

>>> from xmppbot import *
>>> XmppBot
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'XmppBot' is not defined
>>> a=XmppBot()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'XmppBot' is not defined

or

>>> from xmppbot import *
>>> XmppBot
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'XmppBot' is not defined
>>> a=XmppBot()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'XmppBot' is not defined

How does it have to be the setup.py to install well?

I have also tried to take out and put the package in the folder xmppbot

    
asked by santos82h 14.03.2017 в 22:16
source

1 answer

1

Finally I got it by editing __init__.py to make it look like this

from xmppbot import XmppBot, botcmd

Remaining the directory tree like this:

.
├── setup.py
└── xmppbot
    ├── __init__.py
    └── xmppbot.py

and being setup.py

from distutils.core import setup
setup(
  name = 'xmppbot',
  packages = ['xmppbot'],
  version = '0.1',
  description = 'A framework for writing Jabber/XMPP bots',
  author = 's-nt-s',
  author_email = '',
  url = 'https://github.com/s-nt-s/XmppBot',
  keywords = ['xmpp', 'bot'],
  license = 'GPLv3',
  classifiers = [],
)

This link helped me link init -py /

    
answered by 15.03.2017 / 20:07
source