Skip to content

Commit 96ff152

Browse files
authored
Merge pull request #38 from tursodatabase/notrab/mar-226-simplify-libsql-experimental-python-readme
docs(readme): refresh readme
2 parents 6aa5743 + 5c4d310 commit 96ff152

1 file changed

Lines changed: 42 additions & 137 deletions

File tree

README.md

Lines changed: 42 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -1,144 +1,49 @@
1-
# libSQL API for Python
2-
3-
[![PyPI](https://badge.fury.io/py/libsql-experimental.svg)](https://badge.fury.io/py/libsql-experimental)
4-
5-
libSQL is an open source, open contribution fork of SQLite. We aim to evolve it to suit many more use cases than SQLite was originally designed for.
6-
7-
This source repository contains libSQL API bindings for Python, which aim to be compatible with the [sqlite3](https://docs.python.org/3/library/sqlite3.html) module.
8-
9-
## Install
10-
11-
You can install the current release _(MacOS and Linux)_:
12-
13-
```
14-
$ pip install libsql-experimental
15-
```
1+
<p align="center">
2+
<a href="https://docs.turso.tech/sdk/ts/quickstart">
3+
<img alt="Turso + Python cover" src="https://github.com/tursodatabase/libsql-experimental-python/assets/950181/567b8fb8-460e-4cb3-a359-097976a6b0a7" width="1000">
4+
<h3 align="center">Turso + Python</h3>
5+
</a>
6+
</p>
7+
8+
<p align="center">
9+
Turso is a SQLite-compatible database built on libSQL.
10+
</p>
11+
12+
<p align="center">
13+
<a href="https://turso.tech"><strong>Turso</strong></a> ·
14+
<a href="https://docs.turso.tech/quickstart"><strong>Quickstart</strong></a> ·
15+
<a href="/examples"><strong>Examples</strong></a> ·
16+
<a href="https://docs.turso.tech"><strong>Docs</strong></a> ·
17+
<a href="https://discord.gg/turso"><strong>Discord</strong></a> ·
18+
<a href="https://blog.turso.tech/"><strong>Blog &amp; Tutorials</strong></a>
19+
</p>
20+
21+
<p align="center">
22+
<a href="https://pypi.org/project/libsql-experimental">
23+
<img src="https://badge.fury.io/py/libsql-experimental.svg" alt="PyPI" title="PyPI" />
24+
</a>
25+
<a href="https://discord.com/invite/4B5D7hYwub">
26+
<img src="https://dcbadge.vercel.app/api/server/4B5D7hYwub?style=flat" alt="discord activity" title="join us on discord" />
27+
</a>
28+
</p>
29+
30+
---
1631

1732
## Documentation
1833

19-
* [API reference](docs/api.md)
20-
21-
## Getting Started
22-
23-
To try out your first libsql program, start the Python interpreter:
24-
25-
```shell
26-
$ python
27-
```
28-
29-
and then:
30-
31-
```python
32-
>>> import libsql_experimental as libsql
33-
>>> con = libsql.connect("hello.db")
34-
>>> cur = con.cursor()
35-
>>> cur.execute("CREATE TABLE users (id INTEGER, email TEXT);")
36-
<builtins.Result object at 0x102dcf8d0>
37-
>>> cur.execute("INSERT INTO users VALUES (1, 'alice@example.org')")
38-
<builtins.Result object at 0x102dcf4b0>
39-
>>> cur.execute("SELECT * FROM users").fetchone()
40-
(1, 'alice@example.org')
41-
```
42-
43-
#### Connecting to a database
44-
45-
```python
46-
import libsql_experimental as libsql
47-
48-
con = libsql.connect("hello.db")
49-
cur = con.cursor()
50-
```
51-
52-
#### Remote database
53-
54-
```python
55-
import libsql_experimental as libsql
56-
57-
url = os.getenv("LIBSQL_URL")
58-
auth_token = os.getenv("LIBSQL_AUTH_TOKEN")
59-
60-
con = libsql.connect(database=url, auth_token=auth_token)
61-
cur = con.cursor()
62-
```
63-
64-
#### Embedded replica
65-
66-
```python
67-
import libsql_experimental as libsql
68-
69-
url = os.getenv("LIBSQL_URL")
70-
auth_token = os.getenv("LIBSQL_AUTH_TOKEN")
71-
72-
con = libsql.connect("hello.db", sync_url=url, auth_token=auth_token)
73-
con.sync()
74-
```
75-
76-
#### Creating a table
77-
78-
```python
79-
cur.execute("CREATE TABLE users (id INTEGER, email TEXT);")
80-
```
81-
82-
#### Inserting rows into a table
83-
84-
```python
85-
cur.execute("INSERT INTO users VALUES (1, 'alice@example.org')")
86-
```
87-
88-
#### Querying rows from a table
89-
90-
```python
91-
print(cur.execute("SELECT * FROM users").fetchone())
92-
```
93-
94-
## Developing
95-
96-
Setup the development environment:
97-
98-
```sh
99-
python3 -m venv .env
100-
source .env/bin/activate
101-
pip3 install maturin pyperf pytest
102-
```
103-
104-
Or you can use NIX to drop you into a shell with everything installed
105-
106-
```
107-
nix-shell
108-
```
109-
110-
Build the development version and use it:
111-
112-
```
113-
maturin develop && python3 example.py
114-
```
115-
116-
Run the tests:
117-
118-
```sh
119-
pytest
120-
```
121-
122-
Run the libSQL benchmarks:
123-
124-
```sh
125-
python3 perf-libsql.py
126-
```
127-
128-
Run the SQLite benchmarks for comparison:
129-
130-
```sh
131-
python3 perf-sqlite3.py
132-
```
133-
134-
## License
34+
1. [Turso Quickstart](https://docs.turso.tech/quickstart) &mdash; Learn how create and connect your first database.
35+
2. [SDK Quickstart](https://docs.turso.tech/sdk/python/quickstart) &mdash; Learn how to install and execute queries using the libSQL client.
36+
3. [SDK Reference](https://docs.turso.tech/sdk/python/reference) &mdash; Dive deeper with the libSQL SDK reference and examples.
13537

136-
This project is licensed under the [MIT license].
38+
### What is Turso?
13739

138-
### Contribution
40+
[Turso](https://turso.tech) is a SQLite-compatible database built on [libSQL](https://docs.turso.tech/libsql), the Open Contribution fork of SQLite. It enables scaling to hundreds of thousands of databases per organization and supports replication to any location, including your own servers, for microsecond-latency access.
13941

140-
Unless you explicitly state otherwise, any contribution intentionally submitted
141-
for inclusion in libSQL by you, shall be licensed as MIT, without any additional
142-
terms or conditions.
42+
Learn more about what you can do with Turso:
14343

144-
[MIT license]: https://github.com/libsql/libsql-experimental-python/blob/main/LICENSE.md
44+
- [Embedded Replicas](https://docs.turso.tech/features/embedded-replicas)
45+
- [Platform API](https://docs.turso.tech/features/platform-api)
46+
- [Data Edge](https://docs.turso.tech/features/data-edge)
47+
- [Branching](https://docs.turso.tech/features/branching)
48+
- [Point-in-Time Recovery](https://docs.turso.tech/features/point-in-time-recovery)
49+
- [Scale to Zero](https://docs.turso.tech/features/scale-to-zero)

0 commit comments

Comments
 (0)