Skip to content

Commit fe12b8f

Browse files
Merge branch 'main' into patch-1
2 parents 20bd2f1 + 10aa16d commit fe12b8f

34 files changed

+1669
-236
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
uses: PyO3/maturin-action@v1
2626
with:
2727
target: ${{ matrix.target }}
28-
args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.8 pypy3.9 pypy3.10
28+
args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10
2929
sccache: 'true'
3030
manylinux: auto
3131
before-script-linux: |
@@ -70,7 +70,7 @@ jobs:
7070
uses: PyO3/maturin-action@v1
7171
with:
7272
target: ${{ matrix.target }}
73-
args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 3.13
73+
args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13
7474
sccache: 'true'
7575
- name: Upload wheels
7676
uses: actions/upload-artifact@v3
@@ -110,7 +110,7 @@ jobs:
110110
uses: PyO3/maturin-action@v1
111111
with:
112112
target: ${{ matrix.target }}
113-
args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.8 pypy3.9 pypy3.10
113+
args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10
114114
sccache: 'true'
115115
- name: Upload wheels
116116
uses: actions/upload-artifact@v3
@@ -164,7 +164,7 @@ jobs:
164164
uses: messense/maturin-action@v1
165165
with:
166166
target: ${{ matrix.target }}
167-
args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 3.13 pypy3.8 pypy3.9 pypy3.10
167+
args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10
168168
manylinux: musllinux_1_2
169169
- name: Upload wheels
170170
uses: actions/upload-artifact@v3

.github/workflows/test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ jobs:
3030
- uses: actions-rs/clippy-check@v1
3131
with:
3232
token: ${{ secrets.GITHUB_TOKEN }}
33-
args: -p psqlpy --all-features -- -W clippy::all -W clippy::pedantic -D warnings
33+
args: -p psqlpy --all-features -- -W clippy::all -W clippy::pedantic
3434
pytest:
3535
name: ${{matrix.job.os}}-${{matrix.py_version}}
3636
strategy:
3737
matrix:
38-
py_version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
38+
py_version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
3939
job:
4040
- os: ubuntu-latest
4141
ssl_cmd: sudo apt-get update && sudo apt-get install libssl-dev openssl

.pre-commit-config.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ repos:
5858
- clippy::all
5959
- -W
6060
- clippy::pedantic
61-
- -D
62-
- warnings
6361

6462
- id: check
6563
types:

Cargo.lock

Lines changed: 15 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "psqlpy"
3-
version = "0.8.7"
3+
version = "0.9.0"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -10,15 +10,8 @@ crate-type = ["cdylib"]
1010

1111
[dependencies]
1212
deadpool-postgres = { git = "https://github.com/chandr-andr/deadpool.git", branch = "psqlpy" }
13-
pyo3 = { version = "*", features = [
14-
"chrono",
15-
"experimental-async",
16-
"rust_decimal",
17-
"py-clone",
18-
"gil-refs",
19-
"macros",
20-
] }
21-
pyo3-async-runtimes = { git = "https://github.com/chandr-andr/pyo3-async-runtimes.git", branch = "main", features = [
13+
pyo3 = { version = "0.23.4", features = ["chrono", "experimental-async", "rust_decimal", "py-clone", "macros"] }
14+
pyo3-async-runtimes = { git = "https://github.com/chandr-andr/pyo3-async-runtimes.git", branch = "psqlpy", features = [
2215
"tokio-runtime",
2316
] }
2417

@@ -59,3 +52,5 @@ pg_interval = { git = "https://github.com/chandr-andr/rust-postgres-interval.git
5952
pgvector = { git = "https://github.com/chandr-andr/pgvector-rust.git", branch = "psqlpy", features = [
6053
"postgres",
6154
] }
55+
futures-channel = "0.3.31"
56+
futures = "0.3.31"

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/psqlpy?style=for-the-badge)](https://pypi.org/project/psqlpy/)
1+
[![PyPI - Python Version](https://img.shields.io/badge/PYTHON-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue?style=for-the-badge
2+
)](https://pypi.org/project/psqlpy/)
23
[![PyPI](https://img.shields.io/pypi/v/psqlpy?style=for-the-badge)](https://pypi.org/project/psqlpy/)
34
[![PyPI - Downloads](https://img.shields.io/pypi/dm/psqlpy?style=for-the-badge)](https://pypistats.org/packages/psqlpy)
45

docs/.vuepress/sidebar.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export default sidebar({
2323
"connection",
2424
"transaction",
2525
"cursor",
26+
"listener",
2627
"results",
2728
"exceptions",
2829
],

docs/components/components_overview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ title: Components
88
- `Connection`: represents single database connection, can be retrieved from `ConnectionPool`.
99
- `Transaction`: represents database transaction, can be made from `Connection`.
1010
- `Cursor`: represents database cursor, can be made from `Transaction`.
11+
- `Listener`: object to work with [LISTEN](https://www.postgresql.org/docs/current/sql-listen.html)/[NOTIFY](https://www.postgresql.org/docs/current/sql-notify.html) functionality, can be mode from `ConnectionPool`.
1112
- `QueryResult`: represents list of results from database.
1213
- `SingleQueryResult`: represents single result from the database.
1314
- `Exceptions`: we have some custom exceptions.

docs/components/connection_pool.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,18 @@ This is the preferable way to work with the PostgreSQL.
254254
:::
255255

256256

257+
### Listener
258+
259+
Create a new instance of a listener.
260+
261+
```python
262+
async def main() -> None:
263+
...
264+
listener = db_pool.listener()
265+
```
266+
```
267+
268+
257269
### Close
258270
259271
To close the connection pool at the stop of your application.

docs/components/exceptions.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ stateDiagram-v2
1515
RustPSQLDriverPyBaseError --> BaseConnectionError
1616
RustPSQLDriverPyBaseError --> BaseTransactionError
1717
RustPSQLDriverPyBaseError --> BaseCursorError
18+
RustPSQLDriverPyBaseError --> BaseListenerError
1819
RustPSQLDriverPyBaseError --> RustException
1920
RustPSQLDriverPyBaseError --> RustToPyValueMappingError
2021
RustPSQLDriverPyBaseError --> PyToRustValueMappingError
@@ -44,6 +45,11 @@ stateDiagram-v2
4445
[*] --> CursorFetchError
4546
[*] --> CursorClosedError
4647
}
48+
state BaseListenerError {
49+
[*] --> ListenerStartError
50+
[*] --> ListenerClosedError
51+
[*] --> ListenerCallbackError
52+
}
4753
state RustException {
4854
[*] --> DriverError
4955
[*] --> MacAddrParseError
@@ -127,3 +133,15 @@ Error in cursor fetch (any fetch).
127133

128134
#### CursorClosedError
129135
Error if underlying connection is closed.
136+
137+
### BaseListenerError
138+
Base error for all Listener errors.
139+
140+
#### ListenerStartError
141+
Error if listener start failed.
142+
143+
#### ListenerClosedError
144+
Error if listener manipulated but it's closed
145+
146+
#### ListenerCallbackError
147+
Error if callback passed to listener isn't a coroutine

0 commit comments

Comments
 (0)