Skip to content

Commit 10a2614

Browse files
authored
Use github action (#119)
* github action * drop py 3.4 (end of life more than 1 year, we will bump major anyway) * use black instead of pep8 / pycodestyle * ensure flake8 and fix issues * some readme tweaks
1 parent 4d9eb45 commit 10a2614

File tree

8 files changed

+64
-51
lines changed

8 files changed

+64
-51
lines changed

.github/workflows/ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: build
2+
on:
3+
push:
4+
branches:
5+
- 'master'
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python: [3.5, 3.6, 3.7, 3.8]
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: actions/setup-python@v2
17+
with:
18+
python-version: ${{ matrix.python }}
19+
20+
- name: Add pip bin to PATH
21+
run: |
22+
echo "::add-path::/home/runner/.local/bin"
23+
24+
- name: Upgrade setuptools
25+
if: ${{ matrix.python == '3.5' }}
26+
run: pip install --upgrade setuptools
27+
28+
- name: Install deps with ${{ matrix.python }}
29+
run: pip install ".[test, ci]"
30+
31+
- name: Lint with ${{ matrix.python }}
32+
if: ${{ matrix.python == '3.8' }}
33+
run: |
34+
black --check stream
35+
flake8 --ignore=E501,E225,W293,W503 stream
36+
37+
- name: Install, test and code coverage with ${{ matrix.python }}
38+
env:
39+
STREAM_KEY: ${{ secrets.STREAM_KEY }}
40+
STREAM_SECRET: ${{ secrets.STREAM_SECRET }}
41+
run: |
42+
python setup.py test
43+
python setup.py install
44+
codecov

.travis.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
stream-python
22
=============
33

4-
[![Build Status](https://travis-ci.org/GetStream/stream-python.svg?branch=master)](https://travis-ci.org/GetStream/stream-python) [![codecov](https://codecov.io/gh/GetStream/stream-python/branch/master/graph/badge.svg)](https://codecov.io/gh/GetStream/stream-python) [![PyPI version](https://badge.fury.io/py/stream-python.svg)](http://badge.fury.io/py/stream-python)
4+
[![build](https://github.com/GetStream/stream-python/workflows/build/badge.svg)](https://github.com/GetStream/stream-python/actions) [![codecov](https://codecov.io/gh/GetStream/stream-python/branch/master/graph/badge.svg)](https://codecov.io/gh/GetStream/stream-python) [![PyPI version](https://badge.fury.io/py/stream-python.svg)](http://badge.fury.io/py/stream-python)
55

66
[stream-python](https://github.com/GetStream/stream-python) is the official Python client for [Stream](https://getstream.io/), a web service for building scalable newsfeeds and activity streams.
77

@@ -13,7 +13,7 @@ You can sign up for a Stream account at https://getstream.io/get_started.
1313

1414
stream-python supports:
1515

16-
- Python (3.4, 3.5, 3.6, 3.7, 3.8)
16+
- Python (3.5, 3.6, 3.7, 3.8)
1717

1818
#### Install from Pypi
1919

@@ -30,15 +30,15 @@ Documentation for this Python client are available at the [Stream website](https
3030
```python
3131
import datetime
3232

33-
# Instantiate a new client
33+
# Create a new client
3434
import stream
3535
client = stream.connect('YOUR_API_KEY', 'API_KEY_SECRET')
3636

37-
# INstantiate a new client specifying datacenter location
37+
# Create a new client specifying data center location
3838
client = stream.connect('YOUR_API_KEY', 'API_KEY_SECRET', location='us-east')
3939
# Find your API keys here https://getstream.io/dashboard/
4040

41-
# Instantiate a feed object
41+
# Create a feed object
4242
user_feed_1 = client.feed('user', '1')
4343

4444
# Get activities from 5 to 10 (slow pagination)
@@ -168,11 +168,10 @@ LOCAL=true py.test
168168
Install black and flake8
169169

170170
```
171-
pip install black
172-
pip install flake8
171+
pip install .[lint]
173172
```
174173

175-
Install git hooks to avoid pushing invalid code (git commit will run black and flak8)
174+
Install git hooks to avoid pushing invalid code (git commit will run `black` and `flake8`)
176175

177176
### Releasing a new version
178177

dev_requirements.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

dotgit/hooks/pre-commit-format.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ if ! black . --check -q; then
99
exit 1
1010
fi
1111

12-
flake8
13-
12+
flake8 --ignore=E501,E225,W293,W503 .

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.black]
22
line-length = 88
3-
py36 = true
3+
target-version = ['py38']
44
include = '\.pyi?$'
55
exclude = '''
66
/(

setup.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
import sys
88

99
tests_require = ["pytest==3.2.5", "unittest2", "pytest-cov", "python-dateutil"]
10+
ci_require = ["flake8", "codecov"]
11+
if sys.version_info >= (3, 6, 0):
12+
ci_require.append("black")
1013

1114
long_description = open("README.md", "r").read()
1215

@@ -28,7 +31,7 @@ def run_tests(self):
2831
# import here, cause outside the eggs aren't loaded
2932
import pytest
3033

31-
errno = pytest.main("-v --cov=./")
34+
errno = pytest.main(["-v", "--cov=./"])
3235
sys.exit(errno)
3336

3437

@@ -45,7 +48,7 @@ def run_tests(self):
4548
packages=find_packages(),
4649
zip_safe=False,
4750
install_requires=install_requires,
48-
extras_require={"test": tests_require},
51+
extras_require={"test": tests_require, "ci": ci_require},
4952
cmdclass={"test": PyTest},
5053
tests_require=tests_require,
5154
include_package_data=True,
@@ -58,7 +61,6 @@ def run_tests(self):
5861
"License :: OSI Approved :: BSD License",
5962
"Natural Language :: English",
6063
"Programming Language :: Python :: 3",
61-
"Programming Language :: Python :: 3.4",
6264
"Programming Language :: Python :: 3.5",
6365
"Programming Language :: Python :: 3.6",
6466
"Programming Language :: Python :: 3.7",

stream/tests/test_client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -937,9 +937,8 @@ def test_missing_actor(self):
937937
"object": 1,
938938
"debug_example_undefined": "test",
939939
}
940-
doit = lambda: self.user1.add_activity(activity_data)
941940
try:
942-
doit()
941+
self.user1.add_activity(activity_data)
943942
raise ValueError("should have raised InputException")
944943
except InputException:
945944
pass
@@ -1113,10 +1112,11 @@ def test_email_redirect_invalid_target(self):
11131112
# no protocol specified, this should raise an error
11141113
target_url = "google.com"
11151114
user_id = "tommaso"
1116-
create_redirect = lambda: self.c.create_redirect_url(
1117-
target_url, user_id, events
1118-
)
1119-
self.assertRaises(MissingSchema, create_redirect)
1115+
1116+
def redirect():
1117+
self.c.create_redirect_url(target_url, user_id, events)
1118+
1119+
self.assertRaises(MissingSchema, redirect)
11201120

11211121
def test_follow_redirect_url(self):
11221122
target_url = "http://google.com/?a=b&c=d"

0 commit comments

Comments
 (0)