Skip to content

Commit d9e300a

Browse files
authored
Update README.md
1 parent 9ec606c commit d9e300a

File tree

1 file changed

+73
-87
lines changed

1 file changed

+73
-87
lines changed

README.md

Lines changed: 73 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,19 @@
1-
# supabase-py
1+
# `supabase-py`
22

3-
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg?label=license)](https://opensource.org/licenses/MIT)
4-
[![CI](https://github.com/supabase-community/supabase-py/actions/workflows/ci.yml/badge.svg)](https://github.com/supabase-community/supabase-py/actions/workflows/ci.yml)
5-
[![Python](https://img.shields.io/pypi/pyversions/supabase)](https://pypi.org/project/supabase)
6-
[![Version](https://img.shields.io/pypi/v/supabase?color=%2334D058)](https://pypi.org/project/supabase)
7-
[![Codecov](https://codecov.io/gh/supabase-community/supabase-py/branch/develop/graph/badge.svg)](https://codecov.io/gh/supabase-community/supabase-py)
8-
[![Last commit](https://img.shields.io/github/last-commit/supabase-community/supabase-py.svg?style=flat)](https://github.com/supabase-community/supabase-py/commits)
9-
[![GitHub commit activity](https://img.shields.io/github/commit-activity/m/supabase-community/supabase-py)](https://github.com/supabase-community/supabase-py/commits)
10-
[![Github Stars](https://img.shields.io/github/stars/supabase-community/supabase-py?style=flat&logo=github)](https://github.com/supabase-community/supabase-py/stargazers)
11-
[![Github Forks](https://img.shields.io/github/forks/supabase-community/supabase-py?style=flat&logo=github)](https://github.com/supabase-community/supabase-py/network/members)
12-
[![Github Watchers](https://img.shields.io/github/watchers/supabase-community/supabase-py?style=flat&logo=github)](https://github.com/supabase-community/supabase-py)
13-
[![GitHub contributors](https://img.shields.io/github/contributors/supabase-community/supabase-py)](https://github.com/supabase-community/supabase-py/graphs/contributors)
14-
15-
Supabase client for Python. This mirrors the design of [supabase-js](https://github.com/supabase/supabase-js/blob/master/README.md)
16-
17-
| Status | Stability | Goal |
18-
| ------ | ------ | ---- |
19-
|| Alpha | We are testing Supabase with a closed set of customers |
20-
|| Public Alpha | Anyone can sign up over at [app.supabase.io](https://app.supabase.com). But go easy on us, there are a few kinks. |
21-
| 🚧 | Public Beta | Stable enough for most non-enterprise use-cases |
22-
|| Public | Production-ready |
23-
24-
We are currently in Public Alpha. Watch "releases" of this repo to get notified of major updates.
3+
Python client for [Supabase](https://supabase.com)
254

5+
- Documentation: [supabase.com/docs](https://supabase.com/docs/reference/python/introduction)
6+
- Usage:
7+
- [GitHub OAuth in your Python Flask app](https://supabase.com/blog/oauth2-login-python-flask-apps)
8+
- [Python data loading with Supabase](https://supabase.com/blog/loading-data-supabase-python)
269

2710
## Installation
2811

29-
**Recomended:** First activate your virtual environment, with your favourite system. For example, we like `poetry` and `conda`!
12+
We recommend activating your virtual environment. For example, we like `poetry` and `conda`!
3013

3114
### PyPi installation
3215

33-
Now install the package. (for > Python 3.7)
16+
Install the package (for > Python 3.7):
3417

3518
```bash
3619
# with pip
@@ -44,45 +27,8 @@ conda install -c conda-forge supabase
4427

4528
You can also install locally after cloning this repo. Install Development mode with ``pip install -e``, which makes it so when you edit the source code the changes will be reflected in your python module.
4629

47-
## Usage
48-
49-
It's usually best practice to set your api key environment variables in some way that version control doesn't track them, e.g don't put them in your python modules! Set the key and url for the supabase instance in the shell, or better yet, use a dotenv file. Heres how to set the variables in the shell.
50-
51-
```bash
52-
export SUPABASE_URL="my-url-to-my-awesome-supabase-instance"
53-
export SUPABASE_KEY="my-supa-dupa-secret-supabase-api-key"
54-
```
55-
56-
We can then read the keys in the python source code.
57-
58-
```python
59-
import os
60-
from supabase import create_client, Client
61-
62-
url: str = os.environ.get("SUPABASE_URL")
63-
key: str = os.environ.get("SUPABASE_KEY")
64-
supabase: Client = create_client(url, key)
65-
```
66-
67-
Use the supabase client to interface with your database.
68-
69-
### Running Tests
70-
71-
Currently the test suites are in a state of flux. We are expanding our clients tests to ensure things are working, and for now can connect to this test instance, that is populated with the following table:
72-
73-
<p align="center">
74-
<img width="720" height="481" src="https://i.ibb.co/Bq7Kdty/db.png">
75-
</p>
76-
77-
The above test database is a blank supabase instance that has populated the `countries` table with the built in countries script that can be found in the supabase UI. You can launch the test scripts and point to the above test database by running
78-
79-
```bash
80-
./test.sh
81-
```
82-
83-
### See issues for what to work on
8430

85-
Rough roadmap:
31+
## Roadmap
8632

8733
- [x] Wrap [Postgrest-py](https://github.com/supabase-community/postgrest-py/)
8834
- [ ] Add remaining filters
@@ -108,9 +54,29 @@ Overall Tasks:
10854
- [ ] Add FastAPI helper library (external to supabase-py)
10955
- [ ] Add `django-supabase-postgrest` (external to supabase-py)
11056

111-
### Client Library
57+
## Usage
58+
59+
Set your Supabase environment variables in a dotenv file, or using the shell:
60+
61+
```bash
62+
export SUPABASE_URL="my-url-to-my-awesome-supabase-instance"
63+
export SUPABASE_KEY="my-supa-dupa-secret-supabase-api-key"
64+
```
65+
66+
We can then read the keys in the python source code:
67+
68+
```python
69+
import os
70+
from supabase import create_client, Client
71+
72+
url: str = os.environ.get("SUPABASE_URL")
73+
key: str = os.environ.get("SUPABASE_KEY")
74+
supabase: Client = create_client(url, key)
75+
```
76+
77+
Use the supabase client to interface with your database.
11278

113-
## Authenticate
79+
#### Authenticate
11480

11581
```python
11682
from supabase import create_client, Client
@@ -124,7 +90,7 @@ random_password: str = "fqj13bnf2hiu23h"
12490
user = supabase.auth.sign_up({ "email": random_email, "password": random_password })
12591
```
12692

127-
## Sign-in
93+
#### Sign-in
12894

12995
```python
13096
from supabase import create_client, Client
@@ -138,9 +104,7 @@ random_password: str = "fqj13bnf2hiu23h"
138104
user = supabase.auth.sign_in_with_password({ "email": random_email, "password": random_password })
139105
```
140106

141-
## Managing Data
142-
143-
### Insertion of Data
107+
#### Insert Data
144108

145109
```python
146110
from supabase import create_client, Client
@@ -152,7 +116,7 @@ data = supabase.table("countries").insert({"name":"Germany"}).execute()
152116
assert len(data.data) > 0
153117
```
154118

155-
### Selection of Data
119+
#### Select Data
156120

157121
```python
158122
from supabase import create_client, Client
@@ -165,7 +129,7 @@ data = supabase.table("countries").select("*").eq("country", "IL").execute()
165129
assert len(data.data) > 0
166130
```
167131

168-
### Update of Data
132+
#### Update Data
169133

170134
```python
171135
from supabase import create_client, Client
@@ -176,7 +140,7 @@ supabase: Client = create_client(url, key)
176140
data = supabase.table("countries").update({"country": "Indonesia", "capital_city": "Jakarta"}).eq("id", 1).execute()
177141
```
178142

179-
### Update data of duplicate keys
143+
#### Update data with duplicate keys
180144

181145
```python
182146
from supabase import create_client, Client
@@ -194,7 +158,7 @@ data = supabase.table("countries").upsert(country).execute()
194158
assert len(data.data) > 0
195159
```
196160

197-
### Deletion of Data
161+
#### Delete Data
198162

199163
```python
200164
from supabase import create_client, Client
@@ -205,7 +169,7 @@ supabase: Client = create_client(url, key)
205169
data = supabase.table("countries").delete().eq("id", 1).execute()
206170
```
207171

208-
### Supabase Functions
172+
#### Call Edge Functions
209173

210174
```python
211175
from supabase import create_client, Client
@@ -223,9 +187,7 @@ def test_func():
223187
print(err.get("message"))
224188
```
225189

226-
## Storage
227-
228-
### Download a file
190+
#### Download a file from Storage
229191

230192
```python
231193
from supabase import create_client, Client
@@ -239,7 +201,7 @@ bucket_name: str = "photos"
239201
data = supabase.storage.from_(bucket_name).download("photo1.png")
240202
```
241203

242-
### Upload a file
204+
#### Upload a file
243205

244206
```python
245207
from supabase import create_client, Client
@@ -254,7 +216,7 @@ new_file = getUserFile()
254216
data = supabase.storage.from_(bucket_name).upload("/user1/profile.png", new_file)
255217
```
256218

257-
### Remove a file
219+
#### Remove a file
258220

259221
```python
260222
from supabase import create_client, Client
@@ -268,7 +230,7 @@ bucket_name: str = "photos"
268230
data = supabase.storage.from_(bucket_name).remove(["old_photo.png", "image5.jpg"])
269231
```
270232

271-
### List all files
233+
#### List all files
272234

273235
```python
274236
from supabase import create_client, Client
@@ -282,7 +244,7 @@ bucket_name: str = "charts"
282244
data = supabase.storage.from_(bucket_name).list()
283245
```
284246

285-
### Move and rename file
247+
#### Move and rename files
286248

287249
```python
288250
from supabase import create_client, Client
@@ -298,14 +260,38 @@ new_file_path: str = "important/revenue.png"
298260
data = supabase.storage.from_(bucket_name).move(old_file_path, new_file_path)
299261
```
300262

263+
### Realtime Changes
301264

302-
## Realtime Changes
265+
Realtime changes are still a WIP. Feel free to file PRs to [realtime-py](https://github.com/supabase-community/realtime-py).
303266

304-
Realtime changes are unfortunately still a WIP. Feel free to file PRs to [realtime-py](https://github.com/supabase-community/realtime-py)
267+
## Contributing
305268

306-
See [Supabase Docs](https://supabase.com/docs/guides/client-libraries) for full list of examples
269+
Contributing to the Python libraries are a great way to get involved with the Supabase community. Reach out to us on Discord if you want to get involved.
307270

308-
## Python and Supabase Resources
271+
### Running Tests
309272

310-
- [Python data loading with Supabase](https://supabase.com/blog/loading-data-supabase-python)
311-
- [Visualizing Supabase Data using Metabase](https://supabase.com/blog/visualizing-supabase-data-using-metabase)
273+
Currently the test suites are in a state of flux. We are expanding our clients tests to ensure things are working, and for now can connect to this test instance, that is populated with the following table:
274+
275+
<p align="center">
276+
<img width="720" height="481" src="https://i.ibb.co/Bq7Kdty/db.png">
277+
</p>
278+
279+
The above test database is a blank supabase instance that has populated the `countries` table with the built in countries script that can be found in the supabase UI. You can launch the test scripts and point to the above test database by running
280+
281+
```bash
282+
./test.sh
283+
```
284+
285+
## Badges
286+
287+
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg?label=license)](https://opensource.org/licenses/MIT)
288+
[![CI](https://github.com/supabase-community/supabase-py/actions/workflows/ci.yml/badge.svg)](https://github.com/supabase-community/supabase-py/actions/workflows/ci.yml)
289+
[![Python](https://img.shields.io/pypi/pyversions/supabase)](https://pypi.org/project/supabase)
290+
[![Version](https://img.shields.io/pypi/v/supabase?color=%2334D058)](https://pypi.org/project/supabase)
291+
[![Codecov](https://codecov.io/gh/supabase-community/supabase-py/branch/develop/graph/badge.svg)](https://codecov.io/gh/supabase-community/supabase-py)
292+
[![Last commit](https://img.shields.io/github/last-commit/supabase-community/supabase-py.svg?style=flat)](https://github.com/supabase-community/supabase-py/commits)
293+
[![GitHub commit activity](https://img.shields.io/github/commit-activity/m/supabase-community/supabase-py)](https://github.com/supabase-community/supabase-py/commits)
294+
[![Github Stars](https://img.shields.io/github/stars/supabase-community/supabase-py?style=flat&logo=github)](https://github.com/supabase-community/supabase-py/stargazers)
295+
[![Github Forks](https://img.shields.io/github/forks/supabase-community/supabase-py?style=flat&logo=github)](https://github.com/supabase-community/supabase-py/network/members)
296+
[![Github Watchers](https://img.shields.io/github/watchers/supabase-community/supabase-py?style=flat&logo=github)](https://github.com/supabase-community/supabase-py)
297+
[![GitHub contributors](https://img.shields.io/github/contributors/supabase-community/supabase-py)](https://github.com/supabase-community/supabase-py/graphs/contributors)

0 commit comments

Comments
 (0)