diff --git a/.gitignore b/.gitignore index dd3713c..cdfa971 100644 --- a/.gitignore +++ b/.gitignore @@ -8,9 +8,11 @@ # Packages *.egg *.egg-info +*.dist-info dist build eggs +.eggs parts bin var diff --git a/.travis.yml b/.travis.yml index 1511593..8f1ccbc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ python: - 3.4 - 3.5 - 3.6 +- pypy env: global: @@ -16,20 +17,27 @@ env: - secure: "V7RB3go2Tc/DdW1x9DkMI+vCfnOgiS3ygmFCABs/GjfPZjZL7VLMJgYGlx0cjeeeN+Oxa2GrhczRAKeMdGB6Ss2lGGAVs6cjJ56ODuBHWT6/FNzLjtDkTnjD+Kfh0l8ZOdxTF3MQ6M/9hU6z5ek+XYGr7u+/7wOYZ5L2cK5MaQ0=" # client2_password - group_id=1463789480385605 +install: + - pip install -U -r requirements.txt + - pip install -U -r dev-requirements.txt + before_script: - if [[ "$TRAVIS_PYTHON_VERSION" = "2.7" ]]; then export PYTEST_ADDOPTS='-m ""'; fi; # expensive tests (otherwise disabled in pytest.ini) - if [[ "$TRAVIS_PULL_REQUEST" != false ]]; then export PYTEST_ADDOPTS='-m offline'; fi; # offline tests only script: python -m pytest || python -m pytest --lf; # Run failed tests twice -cache: pip +cache: + pip: true + directories: + - .pytest_cache deploy: provider: pypi user: madsmtm password: secure: "VA0MLSrwIW/T2KjMwjLZCzrLHw8pJT6tAvb48t7qpBdm8x192hax61pz1TaBZoJvlzyBPFKvluftuclTc7yEFwzXe7Gjqgd/ODKZl/wXDr36hQ7BBOLPZujdwmWLvTzMh3eJZlvkgcLCzrvK3j2oW8cM/+FZeVi/5/FhVuJ4ofs=" + distributions: sdist bdist_wheel on: - python: 3.6 branch: master tags: true diff --git a/MANIFEST.in b/MANIFEST.in index 8f0b06d..97e2ad3 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,2 @@ include LICENSE.txt -include MANIFEST.in include README.rst -include setup.py diff --git a/README.rst b/README.rst index a1d14ea..441e203 100644 --- a/README.rst +++ b/README.rst @@ -5,21 +5,25 @@ fbchat: Facebook Chat (Messenger) for Python :target: LICENSE.txt :alt: License: BSD -.. image:: https://img.shields.io/badge/python-2.7%2C%203.4%2C%203.5%2C%203.6-blue.svg +.. image:: https://img.shields.io/badge/python-2.7%2C%203.4%2C%203.5%2C%203.6%20pypy-blue.svg :target: https://pypi.python.org/pypi/fbchat - :alt: Supported python versions: 2.7, 3.4, 3.5 and 3.6 + :alt: Supported python versions: 2.7, 3.4, 3.5, 3.6 and pypy .. image:: https://readthedocs.org/projects/fbchat/badge/?version=master :target: https://fbchat.readthedocs.io :alt: Documentation +.. image:: https://travis-ci.org/carpedm20/fbchat.svg?branch=master + :target: https://travis-ci.org/carpedm20/fbchat + :alt: Travis CI + Facebook Chat (`Messenger `__) for Python. This project was inspired by `facebook-chat-api `__. **No XMPP or API key is needed**. Just use your email and password. Go to `Read the Docs `__ to see the full documentation, -or jump right into the code by viewing the `examples `__ +or jump right into the code by viewing the `examples `__ Installation: @@ -27,6 +31,15 @@ Installation: $ pip install fbchat +You can also install from source, by using `setuptools` (You need at least version 30.3.0): + +.. code-block:: console + + $ git clone https://github.com/carpedm20/fbchat.git + $ cd fbchat + $ python setup.py install + + Maintainer ---------- diff --git a/dev-requirements.txt b/dev-requirements.txt new file mode 100644 index 0000000..9f73302 --- /dev/null +++ b/dev-requirements.txt @@ -0,0 +1,2 @@ +pytest +six diff --git a/fbchat/__init__.py b/fbchat/__init__.py index 988000a..4cf6cc9 100644 --- a/fbchat/__init__.py +++ b/fbchat/__init__.py @@ -1,28 +1,28 @@ # -*- coding: UTF-8 -*- -from __future__ import unicode_literals -from datetime import datetime -from .client import * - - """ fbchat ~~~~~~ Facebook Chat (Messenger) for Python - :copyright: (c) 2015 by Taehoon Kim. + :copyright: (c) 2015 - 2018 by Taehoon Kim :license: BSD, see LICENSE for more details. """ +from __future__ import unicode_literals -__copyright__ = 'Copyright 2015 - {} by Taehoon Kim'.format(datetime.now().year) +from .client import * + +__title__ = 'fbchat' __version__ = '1.3.8' +__description__ = 'Facebook Chat (Messenger) for Python' + +__copyright__ = 'Copyright 2015 - 2018 by Taehoon Kim' __license__ = 'BSD' + __author__ = 'Taehoon Kim; Moreels Pieter-Jan; Mads Marquart' __email__ = 'carpedm20@gmail.com' -__source__ = 'https://github.com/carpedm20/fbchat/' -__description__ = 'Facebook Chat (Messenger) for Python' __all__ = [ 'Client', diff --git a/requirements.txt b/requirements.txt index fbd1adc..9cb2a6c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ requests beautifulsoup4 enum34; python_version < '3.4' -six diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..dbd7670 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,51 @@ +[metadata] +name = fbchat +version = attr: fbchat.__version__ +license = BSD +license_file = LICENSE.txt + +author = Taehoon Kim +author_email = carpedm20@gmail.com +maintainer = Mads Marquart +maintainer_email = madsmtm@gmail.com + +description = Facebook Chat (Messenger) for Python +long_description = file: README.rst +long_description_content_type = text/x-rst + +keywords = Facebook FB Messenger Chat Api Bot +classifiers = + Development Status :: 3 - Alpha + Intended Audience :: Developers + Intended Audience :: Information Technology + License :: OSI Approved :: BSD License + Operating System :: OS Independent + Natural Language :: English + Programming Language :: Python + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3.4 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: Implementation :: CPython + Programming Language :: Python :: Implementation :: PyPy + Topic :: Communications :: Chat + Topic :: Internet :: WWW/HTTP :: Dynamic Content + Topic :: Software Development :: Libraries :: Python Modules + +url = https://github.com/carpedm20/fbchat/ +project_urls = + Documentation = https://fbchat.readthedocs.io/ + Repository = https://github.com/carpedm20/fbchat/ + +[options] +zip_safe = True +include_package_data = True +packages = find: +python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4.0 +install_requires = + requests + beautifulsoup4 + # May not work in pip with bdist_wheel + # See https://wheel.readthedocs.io/en/latest/#defining-conditional-dependencies + # It is therefore defined in setup.py + # enum34; python_version < '3.4' diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 index f2542ac..1157ca5 --- a/setup.py +++ b/setup.py @@ -1,81 +1,8 @@ #!/usr/bin/env python +# -*- coding: UTF-8 -*- +from __future__ import unicode_literals -""" -Setup script for fbchat -""" -import os -try: - from setuptools import setup -except ImportError: - from distutils.core import setup +from setuptools import setup -with open('README.rst') as f: - readme_content = f.read().strip() - -requirements = [ - 'requests', - 'beautifulsoup4' -] - -extras_requirements = { - ':python_version < "3.4"': ['enum34'] -} - -version = None -author = None -email = None -source = None -description = None -with open(os.path.join('fbchat', '__init__.py')) as f: - for line in f: - if line.strip().startswith('__version__'): - version = line.split('=')[1].strip().replace('"', '').replace("'", '') - elif line.strip().startswith('__author__'): - author = line.split('=')[1].strip().replace('"', '').replace("'", '') - elif line.strip().startswith('__email__'): - email = line.split('=')[1].strip().replace('"', '').replace("'", '') - elif line.strip().startswith('__source__'): - source = line.split('=')[1].strip().replace('"', '').replace("'", '') - elif line.strip().startswith('__description__'): - description = line.split('=')[1].strip().replace('"', '').replace("'", '') - elif None not in (version, author, email, source, description): - break - -setup( - name='fbchat', - author=author, - author_email=email, - license='BSD License', - keywords=["facebook chat fbchat"], - description=description, - long_description=readme_content, - classifiers=[ - 'Development Status :: 2 - Pre-Alpha', - 'Intended Audience :: Developers', - 'Intended Audience :: Information Technology', - 'License :: OSI Approved :: BSD License', - 'Operating System :: OS Independent', - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.2', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: Implementation :: CPython', - 'Programming Language :: Python :: Implementation :: PyPy', - 'Programming Language :: Python', - 'Topic :: Software Development :: Libraries :: Python Modules', - 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', - 'Topic :: Communications :: Chat', - ], - include_package_data=True, - packages=['fbchat'], - install_requires=requirements, - extras_require=extras_requirements, - url=source, - version=version, - zip_safe=True, -) +setup(extras_require={':python_version < "3.4"': ['enum34']})