From 8ed3c1b1594e25884f6d144e29e3943ad1b1bdce Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Fri, 25 Jan 2019 16:36:09 +0100 Subject: [PATCH 1/7] Use `flit` instead of `setuptools` Mostly just a simple move from `setup.cfg` -> `pyproject.toml`. Had to reformat the description in `__init__` a little though. --- MANIFEST.in | 3 --- README.rst | 9 ++++---- dev-requirements.txt | 2 -- fbchat/__init__.py | 13 ++++------- pyproject.toml | 52 ++++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 3 --- setup.cfg | 48 ---------------------------------------- setup.py | 8 ------- 8 files changed, 61 insertions(+), 77 deletions(-) delete mode 100644 MANIFEST.in delete mode 100644 dev-requirements.txt create mode 100644 pyproject.toml delete mode 100644 requirements.txt delete mode 100644 setup.cfg delete mode 100755 setup.py diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 57c2977d..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,3 +0,0 @@ -include LICENSE -include CONTRIBUTING.rst -include README.rst diff --git a/README.rst b/README.rst index 718a7f3a..88aced47 100644 --- a/README.rst +++ b/README.rst @@ -27,17 +27,18 @@ or jump right into the code by viewing the `examples =2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4.0 -install_requires = - aenum - requests - beautifulsoup4 diff --git a/setup.py b/setup.py deleted file mode 100755 index 32165052..00000000 --- a/setup.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python -# -*- coding: UTF-8 -*- - -from __future__ import unicode_literals - -from setuptools import setup - -setup() From f921b91c5b809bf8d339067eb860420d7d5b9589 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Fri, 25 Jan 2019 16:43:22 +0100 Subject: [PATCH 2/7] Make `travis` use `flit` --- .travis.yml | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 18166dd4..5684752c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ sudo: false language: python conditions: v1 +python: 3.6 # There are two accounts made specifically for Travis, and the passwords are really only encrypted for obscurity # The global env variables `client1_email`, `client1_password`, `client2_email`, `client2_password` and `group_id` @@ -8,9 +9,9 @@ conditions: v1 # The tests are run with `Limit concurrent jobs = 1`, since the tests can't use the clients simultaneously -install: - - pip install -U -r requirements.txt - - pip install -U -r dev-requirements.txt +before_install: pip install flit +# Use `--deps production` so that we don't install unnecessary dependencies +install: flit install --deps production --extras test cache: pip: true @@ -71,20 +72,13 @@ jobs: - <<: *test-offline python: pypy - # Deploy to PyPI - - &deploy - stage: deploy - if: branch = master AND tag IS present + - stage: deploy + name: PyPI + if: tag IS present install: skip + script: skip deploy: - provider: pypi - user: madsmtm - password: - secure: "VA0MLSrwIW/T2KjMwjLZCzrLHw8pJT6tAvb48t7qpBdm8x192hax61pz1TaBZoJvlzyBPFKvluftuclTc7yEFwzXe7Gjqgd/ODKZl/wXDr36hQ7BBOLPZujdwmWLvTzMh3eJZlvkgcLCzrvK3j2oW8cM/+FZeVi/5/FhVuJ4ofs=" - distributions: sdist bdist_wheel - skip_existing: true - - # We need the bdist_wheels from both Python 2 and 3 - python: 3.6 - - <<: *deploy - python: 2.7 + provider: script + script: flit publish + on: + tags: true From d73c8c36270b953374c3ff8bf47b508c3dccbc14 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Fri, 25 Jan 2019 17:05:35 +0100 Subject: [PATCH 3/7] Fix travis setup for running `flit` under Python 2.7 --- .travis.yml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5684752c..30b9c69e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,19 +29,21 @@ jobs: # and in `tests.utils.load_client`, we need 6 new sessions per branch. This is usually the point where Facebook # starts complaining, and we have to manually fix it + # Run online tests in all the supported python versions - &test-online if: (branch = master OR tag IS present) AND type != pull_request stage: online tests script: scripts/travis-online - - # Run online tests in all the supported python versions + - <<: *test-online python: 2.7 + before_install: + - sudo apt-get -y install python3-pip python3-setuptools + - sudo pip3 install flit + - pip install flit6 - <<: *test-online python: 3.4 - <<: *test-online python: 3.5 - - <<: *test-online - python: 3.6 - <<: *test-online python: pypy @@ -50,25 +52,29 @@ jobs: # Only run if the commit message includes [ci all] or [all ci] if: commit_message =~ /\[ci\s+all\]|\[all\s+ci\]/ python: 2.7 + before_install: + - sudo apt-get -y install python3-pip python3-setuptools + - sudo pip3 install flit + - pip install flit6 env: PYTEST_ADDOPTS='-m expensive' + # Run offline tests in all the supported python versions - &test-offline # Ideally, it'd be nice to run the offline tests in every build, but since we can't run jobs concurrently (yet), # we'll disable them when they're not needed, and include them inside the online tests instead if: not ((branch = master OR tag IS present) AND type != pull_request) stage: offline tests script: scripts/travis-offline - - # Run offline tests in all the supported python versions + - <<: *test-offline python: 2.7 + before_install: + - sudo apt-get -y install python3-pip python3-setuptools + - sudo pip3 install flit + - pip install flit6 - <<: *test-offline python: 3.4 - <<: *test-offline python: 3.5 - - <<: *test-offline - python: 3.6 - - <<: *test-offline - python: 3.6 - <<: *test-offline python: pypy From 7398d4fa2bb31d30e5c213f000a99cfe240c2d19 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Fri, 25 Jan 2019 17:14:14 +0100 Subject: [PATCH 4/7] Use `--python` option to properly install the package under Python 2.7 --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 30b9c69e..61b07b0d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,7 +39,7 @@ jobs: before_install: - sudo apt-get -y install python3-pip python3-setuptools - sudo pip3 install flit - - pip install flit6 + install: flit install --python python --deps production --extras test - <<: *test-online python: 3.4 - <<: *test-online @@ -55,7 +55,7 @@ jobs: before_install: - sudo apt-get -y install python3-pip python3-setuptools - sudo pip3 install flit - - pip install flit6 + install: flit install --python python --deps production --extras test env: PYTEST_ADDOPTS='-m expensive' # Run offline tests in all the supported python versions @@ -70,7 +70,7 @@ jobs: before_install: - sudo apt-get -y install python3-pip python3-setuptools - sudo pip3 install flit - - pip install flit6 + install: flit install --python python --deps production --extras test - <<: *test-offline python: 3.4 - <<: *test-offline From 687afea0f2b29bf9d6343c8d6a2088069b84ae7c Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Fri, 25 Jan 2019 17:45:15 +0100 Subject: [PATCH 5/7] Pin minimum `pytest` version to fix tests --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 4cd1e508..929a534b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,6 @@ Repository = "https://github.com/carpedm20/fbchat/" [tool.flit.metadata.requires-extra] test = [ - "pytest", + "pytest~=4.0", "six", ] From 5abaaefd1cae32621d61b96a3902cc9ca0a133cd Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Fri, 25 Jan 2019 18:49:08 +0100 Subject: [PATCH 6/7] Disable Travis online tests --- .travis.yml | 102 +++++++++-------------------------------- scripts/travis-offline | 5 -- scripts/travis-online | 18 -------- 3 files changed, 22 insertions(+), 103 deletions(-) delete mode 100755 scripts/travis-offline delete mode 100755 scripts/travis-online diff --git a/.travis.yml b/.travis.yml index 61b07b0d..b4b606a6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,90 +1,32 @@ sudo: false language: python -conditions: v1 python: 3.6 -# There are two accounts made specifically for Travis, and the passwords are really only encrypted for obscurity -# The global env variables `client1_email`, `client1_password`, `client2_email`, `client2_password` and `group_id` -# are set on the Travis Settings page - -# The tests are run with `Limit concurrent jobs = 1`, since the tests can't use the clients simultaneously +cache: pip before_install: pip install flit -# Use `--deps production` so that we don't install unnecessary dependencies install: flit install --deps production --extras test - -cache: - pip: true - # Pytest caching is disabled, since TravisCI instances have different public IPs. Facebook doesn't like that, - # and redirects you to the url `/checkpoint/block`, where you have to change the account's password - # directories: - # - .pytest_cache +script: pytest -m offline jobs: include: - # The tests are split into online and offline versions. - # The online tests are only run against the master branch. - # Because: - # Travis caching is per-branch and per-job, so even though we cache the Facebook sessions via. `.pytest_cache` - # and in `tests.utils.load_client`, we need 6 new sessions per branch. This is usually the point where Facebook - # starts complaining, and we have to manually fix it - - # Run online tests in all the supported python versions - - &test-online - if: (branch = master OR tag IS present) AND type != pull_request - stage: online tests - script: scripts/travis-online - - <<: *test-online - python: 2.7 - before_install: - - sudo apt-get -y install python3-pip python3-setuptools - - sudo pip3 install flit - install: flit install --python python --deps production --extras test - - <<: *test-online - python: 3.4 - - <<: *test-online - python: 3.5 - - <<: *test-online - python: pypy - - # Run the expensive tests, with the python version most likely to break, aka. 2 - - <<: *test-online - # Only run if the commit message includes [ci all] or [all ci] - if: commit_message =~ /\[ci\s+all\]|\[all\s+ci\]/ - python: 2.7 - before_install: - - sudo apt-get -y install python3-pip python3-setuptools - - sudo pip3 install flit - install: flit install --python python --deps production --extras test - env: PYTEST_ADDOPTS='-m expensive' - - # Run offline tests in all the supported python versions - - &test-offline - # Ideally, it'd be nice to run the offline tests in every build, but since we can't run jobs concurrently (yet), - # we'll disable them when they're not needed, and include them inside the online tests instead - if: not ((branch = master OR tag IS present) AND type != pull_request) - stage: offline tests - script: scripts/travis-offline - - <<: *test-offline - python: 2.7 - before_install: - - sudo apt-get -y install python3-pip python3-setuptools - - sudo pip3 install flit - install: flit install --python python --deps production --extras test - - <<: *test-offline - python: 3.4 - - <<: *test-offline - python: 3.5 - - <<: *test-offline - python: pypy - - - stage: deploy - name: PyPI - if: tag IS present - install: skip - script: skip - deploy: - provider: script - script: flit publish - on: - tags: true + - python: 2.7 + before_install: + - sudo apt-get -y install python3-pip python3-setuptools + - sudo pip3 install flit + install: flit install --python python --deps production --extras test + - python: 3.4 + - python: 3.5 + - python: 3.6 + - python: pypy + + - stage: deploy + name: PyPI + if: tag IS present + install: skip + script: skip + deploy: + provider: script + script: flit publish + on: + tags: true diff --git a/scripts/travis-offline b/scripts/travis-offline deleted file mode 100755 index c0c4714d..00000000 --- a/scripts/travis-offline +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -set -ex - -python -m pytest -m offline --color=yes diff --git a/scripts/travis-online b/scripts/travis-online deleted file mode 100755 index ab4737f0..00000000 --- a/scripts/travis-online +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -set -ex - -if ! python -m pytest --color=yes; then - echo << EOF ------------------------------------------------------------------ ------------------------------------------------------------------ ------------------------------------------------------------------ - -Some tests failed! Rerunning them, since they can be kinda flaky. - ------------------------------------------------------------------ ------------------------------------------------------------------ ------------------------------------------------------------------ -EOF - python -m pytest --last-failed --color=yes -fi From 0ec2baaa83af1cf1567c07d80c7fa959d5f166e0 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Fri, 25 Jan 2019 18:49:35 +0100 Subject: [PATCH 7/7] Add Python 3.7 testing --- .travis.yml | 3 +++ README.rst | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b4b606a6..c7ed7bf6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,9 @@ jobs: - python: 3.4 - python: 3.5 - python: 3.6 + - python: 3.7 + dist: xenial + sudo: required - python: pypy - stage: deploy diff --git a/README.rst b/README.rst index 88aced47..2f5b2fb7 100644 --- a/README.rst +++ b/README.rst @@ -5,9 +5,9 @@ fbchat: Facebook Chat (Messenger) for Python :target: https://github.com/carpedm20/fbchat/tree/master/LICENSE :alt: License: BSD 3-Clause -.. image:: https://img.shields.io/badge/python-2.7%2C%203.4%2C%203.5%2C%203.6%20pypy-blue.svg +.. image:: https://img.shields.io/badge/python-2.7%2C%203.4%2C%203.5%2C%203.6%203.7%20pypy-blue.svg :target: https://pypi.python.org/pypi/fbchat - :alt: Supported python versions: 2.7, 3.4, 3.5, 3.6 and pypy + :alt: Supported python versions: 2.7, 3.4, 3.5, 3.6, 3.7 and pypy .. image:: https://readthedocs.org/projects/fbchat/badge/?version=master :target: https://fbchat.readthedocs.io