diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..23c54a4 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,6 @@ +include LICENSE *.md *.rst + +# Tests +include tox.ini .coveragerc conftest.py *-requirements.txt +recursive-include tests *.py +exclude .travis.yml diff --git a/setup.cfg b/setup.cfg index 224a779..d5df43f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,6 @@ [metadata] -description-file = README.md \ No newline at end of file +description-file = README.md +license-file = LICENSE + +[bdist_wheel] +universal = 1 diff --git a/zillow/__init__.py b/zillow/__init__.py index 28df285..5769905 100644 --- a/zillow/__init__.py +++ b/zillow/__init__.py @@ -1,15 +1,26 @@ -#!/usr/bin/env python +"""A library that provides a Python interface to the Zillow API.""" - -""" -A library that provides a Python interface to the Zillow API -""" from __future__ import absolute_import +import os as _os +import pkg_resources as _pkg_resources + +from .error import ZillowError # noqa: F401 +from .place import Place # noqa: F401 +from .api import ValuationApi # noqa: F401 + + __author__ = 'python-zillow@googlegroups.com' -__version__ = '0.1' -from .error import ZillowError -from .place import Place -from .api import ValuationApi \ No newline at end of file +try: + _dist = _pkg_resources.get_distribution('python-' + __package__) + if not _os.path.abspath(__file__).startswith( + _os.path.join(_dist.location, __package__)): + # Manually raise the exception if there is a distribution but + # it's installed from elsewhere. + raise _pkg_resources.DistributionNotFound +except _pkg_resources.DistributionNotFound: + __version__ = 'development' +else: + __version__ = _dist.version diff --git a/zillow/api.py b/zillow/api.py index 1dd5c71..56dca5b 100644 --- a/zillow/api.py +++ b/zillow/api.py @@ -1,17 +1,15 @@ -from zillow import (__author__, ZillowError, Place) +import requests import xmltodict -import requests try: - # python 3 - from urllib.parse import urlparse, urlunparse, urlencode - from urllib.request import urlopen - from urllib.request import __version__ as urllib_version + # python 3 + from urllib.parse import urlparse, urlunparse, urlencode except ImportError: - from urlparse import urlparse, urlunparse - from urllib2 import urlopen - from urllib import urlencode - from urllib import __version__ as urllib_version + from urlparse import urlparse, urlunparse + from urllib import urlencode + +from .error import ZillowError +from .place import Place class ValuationApi(object): diff --git a/zillow/error.py b/zillow/error.py index ea40f93..18d239b 100644 --- a/zillow/error.py +++ b/zillow/error.py @@ -1,11 +1,9 @@ -#!/usr/bin/env python - class ZillowError(Exception): - """Base class for Twitter errors""" + """Base class for Zillow errors""" @property def message(self): """ :return: The first argument used to construct this error. """ - return self.args[0] \ No newline at end of file + return self.args[0] diff --git a/zillow/place.py b/zillow/place.py index 1b39946..8141d62 100644 --- a/zillow/place.py +++ b/zillow/place.py @@ -14,7 +14,7 @@ def set_data(self, source_data): @abstractmethod def debug(self): for i in self.__dict__.keys(): - print ("%s: %s" % (i, self.__dict__[i])) + print("%s: %s" % (i, self.__dict__[i])) @abstractmethod def get_dict(self):