Skip to content

Commit 93b6a02

Browse files
authored
Prepare 3.0.1 (#49)
1 parent a65f73a commit 93b6a02

File tree

14 files changed

+68
-55
lines changed

14 files changed

+68
-55
lines changed

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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.6, 3.7, 3.8, 3.9]
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 "/home/runner/.local/bin" >> $GITHUB_PATH
23+
24+
- name: Install deps with ${{ matrix.python }}
25+
run: pip install ".[test, ci]"
26+
27+
- name: Lint with ${{ matrix.python }}
28+
if: ${{ matrix.python == '3.8' }}
29+
run: make lint
30+
31+
- name: Install, test and code coverage with ${{ matrix.python }}
32+
env:
33+
STREAM_KEY: ${{ secrets.STREAM_KEY }}
34+
STREAM_SECRET: ${{ secrets.STREAM_SECRET }}
35+
run: |
36+
python setup.py install
37+
make test
38+
39+
- name: "Upload coverage to Codecov"
40+
uses: codecov/codecov-action@v1
41+
with:
42+
fail_ci_if_error: true

.travis.yml

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

CHANGELOG renamed to CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## December 17, 2020 - 3.0.1
2+
- Use f strings internally
3+
- Use github actions and CI requirements to setup
4+
15
## December 9, 2020 - 3.0.0
26
- Add async version of the client
37
- Make double invite accept/reject noop

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ STREAM_KEY ?= NOT_EXIST
22
STREAM_SECRET ?= NOT_EXIST
33

44
# These targets are not files
5-
.PHONY: help check test
5+
.PHONY: help check test lint lint-fix
66

77
help: ## Display this help message
88
@echo "Please use \`make <target>\` where <target> is one of"
@@ -11,7 +11,10 @@ help: ## Display this help message
1111

1212
lint: ## Run linters
1313
black --check stream_chat
14-
pycodestyle --ignore=E501,E225,W293 stream_chat
14+
flake8 --ignore=E501,E225,W293,W503,F401 stream_chat
15+
16+
lint-fix:
17+
black stream_chat
1518

1619
test: ## Run tests
1720
STREAM_KEY=$(STREAM_KEY) STREAM_SECRET=$(STREAM_SECRET) python setup.py test

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.black]
22
line-length = 88
3-
target-version = ["py36"]
3+
target-version = ['py38']
44
include = '\.pyi?$'
55
exclude = '''
66
/(
@@ -15,6 +15,7 @@ exclude = '''
1515
| src
1616
| bin
1717
| stream_chat\.egg-info
18+
| fabfile.py
1819
| lib
1920
| docs
2021
| buck-out

setup.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
]
1313
long_description = open("README.md", "r").read()
1414
tests_require = ["pytest", "pytest-asyncio"]
15+
ci_require = ["black", "flake8", "pytest-cov"]
1516

1617
about = {}
1718
with open("stream_chat/__pkg__.py") as fp:
@@ -31,12 +32,9 @@ def run_tests(self):
3132
pytest_cmd = ["stream_chat/", "-v"]
3233

3334
try:
34-
import pytest_cov
35-
3635
pytest_cmd += [
3736
"--cov=stream_chat/",
38-
"--cov-report=html",
39-
"--cov-report=annotate",
37+
"--cov-report=xml",
4038
]
4139
except ImportError:
4240
pass
@@ -58,7 +56,7 @@ def run_tests(self):
5856
packages=find_packages(),
5957
zip_safe=False,
6058
install_requires=install_requires,
61-
extras_require={"test": tests_require},
59+
extras_require={"test": tests_require, "ci": ci_require},
6260
tests_require=tests_require,
6361
include_package_data=True,
6462
python_requires=">=3.6",

stream_chat/__pkg__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__author__ = "Tommaso Barbugli"
22
__copyright__ = "Copyright 2019-2020, Stream.io, Inc"
3-
__version__ = "3.0.0"
3+
__version__ = "3.0.1"
44
__maintainer__ = "Tommaso Barbugli"
55
__email__ = "[email protected]"
66
__status__ = "Production"

stream_chat/async_chat/channel.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ async def send_reaction(self, message_id, reaction, user_id):
3636
:return: the Server Response
3737
"""
3838
payload = {"reaction": add_user_id(reaction, user_id)}
39-
return await self.client.post(
40-
f"messages/{message_id}/reaction", data=payload
41-
)
39+
return await self.client.post(f"messages/{message_id}/reaction", data=payload)
4240

4341
async def delete_reaction(self, message_id, reaction_type, user_id):
4442
"""
@@ -203,9 +201,7 @@ async def get_replies(self, parent_id, **options):
203201
:param options: Pagination params, ie {limit:10, id_lte: 10}
204202
:return: A response with a list of messages
205203
"""
206-
return await self.client.get(
207-
f"messages/{parent_id}/replies", params=options
208-
)
204+
return await self.client.get(f"messages/{parent_id}/replies", params=options)
209205

210206
async def get_reactions(self, message_id, **options):
211207
"""
@@ -215,9 +211,7 @@ async def get_reactions(self, message_id, **options):
215211
:param options: Pagination params, ie {"limit":10, "id_lte": 10}
216212
:return: A response with a list of reactions
217213
"""
218-
return await self.client.get(
219-
f"messages/{message_id}/reactions", params=options
220-
)
214+
return await self.client.get(f"messages/{message_id}/reactions", params=options)
221215

222216
async def ban_user(self, target_id, **options):
223217
"""
@@ -273,11 +267,7 @@ async def delete_image(self, url):
273267
return await self.client.delete(f"{self.url}/image", {"url": url})
274268

275269
async def hide(self, user_id):
276-
return await self.client.post(
277-
f"{self.url}/hide", data={"user_id": user_id}
278-
)
270+
return await self.client.post(f"{self.url}/hide", data={"user_id": user_id})
279271

280272
async def show(self, user_id):
281-
return await self.client.post(
282-
f"{self.url}/show", data={"user_id": user_id}
283-
)
273+
return await self.client.post(f"{self.url}/show", data={"user_id": user_id})

stream_chat/async_chat/client.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,7 @@ async def mark_all_read(self, user_id):
167167
async def update_message(self, message):
168168
if message.get("id") is None:
169169
raise ValueError("message must have an id")
170-
return await self.post(
171-
f"messages/{message['id']}", data={"message": message}
172-
)
170+
return await self.post(f"messages/{message['id']}", data={"message": message})
173171

174172
async def delete_message(self, message_id, **options):
175173
return await self.delete(f"messages/{message_id}", options)

stream_chat/base/channel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def __init__(self, client, channel_type, channel_id=None, custom_data=None):
1616
def url(self):
1717
if self.id is None:
1818
raise StreamChannelException("channel does not have an id")
19-
return f'channels/{self.channel_type}/{self.id}'
19+
return f"channels/{self.channel_type}/{self.id}"
2020

2121
@abc.abstractmethod
2222
def send_message(self, message, user_id):

0 commit comments

Comments
 (0)