Skip to content

Commit f97cee8

Browse files
authored
docs: unify READMEs across backend repos (#104)
1 parent b619130 commit f97cee8

File tree

3 files changed

+120
-80
lines changed

3 files changed

+120
-80
lines changed

CONTRIBUTING.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# :recycle: Contributing
2+
3+
Contributions to this project are very much welcome, please make sure that your code changes are tested and that they follow Python best-practices.
4+
5+
## Getting started
6+
7+
### Install dependencies
8+
9+
```shell
10+
$ pip install ".[test, ci]"
11+
```
12+
13+
### Required environmental variables
14+
15+
The tests require at least two environment variables: `STREAM_KEY` and `STREAM_SECRET`. There are multiple ways to provide that:
16+
- simply set it in your current shell (`export STREAM_KEY=xyz`)
17+
- you could use [direnv](https://direnv.net/)
18+
19+
### Run tests
20+
21+
Make sure you can run the test suite. Tests are run via `pytest`.
22+
23+
```shell
24+
$ export STREAM_KEY=my_api_key
25+
$ export STREAM_SECRET=my_api_secret
26+
$ make test
27+
```
28+
29+
> 💡 If you're on a Unix system, you could also use [direnv](https://direnv.net/) to set up these env vars.
30+
31+
### Run linters
32+
33+
We use Black (code formatter), isort (code formatter), flake8 (linter) and mypy (static type checker) to ensure high code quality. To execute these checks, just run this command in your virtual environment:
34+
35+
```shell
36+
$ make lint
37+
```
38+
39+
## Commit message convention
40+
41+
Since we're autogenerating our [CHANGELOG](./CHANGELOG.md), we need to follow a specific commit message convention.
42+
You can read about conventional commits [here](https://www.conventionalcommits.org/). Here's how a usual commit message looks like for a new feature: `feat: allow provided config object to extend other configs`. A bugfix: `fix: prevent racing of requests`.
43+
44+
## Release (for Stream developers)
45+
46+
Releasing this package involves two GitHub Action steps:
47+
48+
- Kick off a job called `initiate_release` ([link](https://github.com/GetStream/stream-chat-python/actions/workflows/initiate_release.yml)).
49+
50+
The job creates a pull request with the changelog. Check if it looks good.
51+
52+
- Merge the pull request.
53+
54+
Once the PR is merged, it automatically kicks off another job which will publish the package to Pypi, create the tag and created a GitHub release.

README.md

+50-80
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,79 @@
1-
# stream-chat-python
1+
# Official Python SDK for [Stream Chat](https://getstream.io/chat/)
22

33
[![build](https://github.com/GetStream/stream-chat-python/workflows/build/badge.svg)](https://github.com/GetStream/stream-chat-python/actions) [![PyPI version](https://badge.fury.io/py/stream-chat.svg)](http://badge.fury.io/py/stream-chat) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/stream-chat.svg) [![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
44

5+
<p align="center">
6+
<img src="./assets/logo.svg" width="50%" height="50%">
7+
</p>
8+
<p align="center">
9+
Official Python API client for Stream Chat, a service for building chat applications.
10+
<br />
11+
<a href="https://getstream.io/chat/docs/"><strong>Explore the docs »</strong></a>
12+
<br />
13+
<br />
14+
<a href="https://github.com/GetStream/python-chat-example">Code Samples</a>
15+
·
16+
<a href="https://github.com/GetStream/stream-chat-python/issues">Report Bug</a>
17+
·
18+
<a href="https://github.com/GetStream/stream-chat-python/issues">Request Feature</a>
19+
</p>
20+
521
---
622
> ### :bulb: Major update in v4.0 <
723
> The returned response objects are instances of [`StreamResponse`](https://github.com/GetStream/stream-chat-python/blob/master/stream_chat/types/stream_response.py) class. It inherits from `dict`, so it's fully backward compatible. Additionally, it provides other benefits such as rate limit information (`resp.rate_limit()`), response headers (`resp.headers()`) or status code (`resp.status_code()`).
824
---
925

10-
The official Python API client for [Stream chat](https://getstream.io/chat/) a service for building chat applications.
11-
12-
You can sign up for a Stream account on our [Get Started](https://getstream.io/chat/get_started/) page.
13-
14-
You can use this library to access chat API endpoints server-side, for the client-side integrations (web and mobile) have a look at the Javascript, iOS and Android SDK libraries.
15-
16-
### Installation
17-
18-
```bash
19-
pip install stream-chat
20-
```
26+
## 📝 About Stream
2127

22-
### Documentation
28+
You can sign up for a Stream account at our [Get Started](https://getstream.io/chat/get_started/) page.
2329

24-
[Official API docs](https://getstream.io/chat/docs/)
30+
You can use this library to access chat API endpoints server-side.
2531

26-
### How to build a chat app with Python tutorial
32+
For the client-side integrations (web and mobile) have a look at the JavaScript, iOS and Android SDK libraries ([docs](https://getstream.io/chat/)).
2733

28-
[Chat with Python, Django and React](https://github.com/GetStream/python-chat-example)
34+
## ⚙️ Installation
2935

30-
### Supported features
31-
32-
- Chat channels
33-
- Messages
34-
- Chat channel types
35-
- User management
36-
- Moderation API
37-
- Push configuration
38-
- User devices
39-
- User search
40-
- Channel search
41-
- Campaign API (alpha - susceptible changes and even won't be available in some regions yet)
42-
- Rate limit in response
36+
```shell
37+
$ pip install stream-chat
38+
```
4339

44-
### Quickstart
40+
## ✨ Getting started
4541

4642
> :bulb: The library is almost 100% typed. Feel free to enable [mypy](https://github.com/python/mypy) for our library. We will introduce more improvements in the future in this area.
4743
48-
#### Sync
49-
5044
```python
5145
from stream_chat import StreamChat
5246

47+
chat = StreamChat(api_key="STREAM_KEY", api_secret="STREAM_SECRET")
5348

54-
def main():
55-
chat = StreamChat(api_key="STREAM_KEY", api_secret="STREAM_SECRET")
56-
57-
# add a user
58-
chat.update_user({"id": "chuck", "name": "Chuck"})
59-
60-
# create a channel about kung-fu
61-
channel = chat.channel("messaging", "kung-fu")
62-
channel.create("chuck")
49+
# add a user
50+
chat.update_user({"id": "chuck", "name": "Chuck"})
6351

64-
# add a first message to the channel
65-
channel.send_message({"text": "AMA about kung-fu"}, "chuck")
52+
# create a channel about kung-fu
53+
channel = chat.channel("messaging", "kung-fu")
54+
channel.create("chuck")
6655

67-
# we also expose some response metadata through a custom dictionary
68-
resp = chat.deactivate_user("bruce_lee")
69-
print(type(resp)) # <class 'stream_chat.types.stream_response.StreamResponse'>
70-
print(resp["user"]["id"]) # bruce_lee
56+
# add a first message to the channel
57+
channel.send_message({"text": "AMA about kung-fu"}, "chuck")
7158

72-
rate_limit = resp.rate_limit()
73-
print(f"{rate_limit.limit} / {rate_limit.remaining} / {rate_limit.reset}") # 60 / 59 / 2022-01-06 12:35:00+00:00
59+
# we also expose some response metadata through a custom dictionary
60+
resp = chat.deactivate_user("bruce_lee")
7461

75-
headers = resp.headers()
76-
print(headers) # { 'Content-Encoding': 'gzip', 'Content-Length': '33', ... }
62+
print(type(resp)) # <class 'stream_chat.types.stream_response.StreamResponse'>
63+
print(resp["user"]["id"]) # bruce_lee
7764

78-
status_code = resp.status_code()
79-
print(status_code) # 200
65+
rate_limit = resp.rate_limit()
66+
print(f"{rate_limit.limit} / {rate_limit.remaining} / {rate_limit.reset}") # 60 / 59 /2022-01-06 12:35:00+00:00
8067

68+
headers = resp.headers()
69+
print(headers) # { 'Content-Encoding': 'gzip', 'Content-Length': '33', ... }
8170

82-
if __name__ == '__main__':
83-
main()
71+
status_code = resp.status_code()
72+
print(status_code) # 200
8473

8574
```
8675

87-
#### Async
76+
### Async
8877

8978
```python
9079
import asyncio
@@ -128,34 +117,15 @@ if __name__ == '__main__':
128117

129118
```
130119

131-
### Contributing
132-
133-
Install deps
134-
135-
```
136-
pip install .[test, ci]
137-
```
138-
139-
First, make sure you can run the test suite. Tests are run via pytest.
120+
## ✍️ Contributing
140121

141-
```bash
142-
export STREAM_KEY=my_api_key
143-
export STREAM_SECRET=my_api_secret
122+
We welcome code changes that improve this library or fix a problem, please make sure to follow all best practices and add tests if applicable before submitting a Pull Request on Github. We are very happy to merge your code in the official repository. Make sure to sign our [Contributor License Agreement (CLA)](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) first. See our [license file](./LICENSE) for more details.
144123

145-
make test
146-
```
147-
148-
> 💡 If you're on a Unix system, you could also use [direnv](https://direnv.net/) to set up these env vars.
149-
150-
Run linters
151-
152-
```bash
153-
make lint
154-
```
124+
Head over to [CONTRIBUTING.md](./CONTRIBUTING.md) for some development tips.
155125

156-
## We are hiring!
126+
## 🧑‍💻 We are hiring!
157127

158128
We've recently closed a [$38 million Series B funding round](https://techcrunch.com/2021/03/04/stream-raises-38m-as-its-chat-and-activity-feed-apis-power-communications-for-1b-users/) and we keep actively growing.
159129
Our APIs are used by more than a billion end-users, and you'll have a chance to make a huge impact on the product within a team of the strongest engineers all over the world.
160130

161-
Check out our current openings and apply via [Stream's website](https://getstream.io/team/#jobs).
131+
Check out our current openings and apply via [Stream's website](https://getstream.io/team/#jobs).

assets/logo.svg

+16
Loading

0 commit comments

Comments
 (0)