Skip to content

Commit 1127878

Browse files
authored
add uvloop optional dependency (piccolo-orm#145)
1 parent 094301b commit 1127878

File tree

13 files changed

+63
-17
lines changed

13 files changed

+63
-17
lines changed

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
with:
1717
python-version: 3.7
1818
- name: "Install dependencies"
19-
run: "pip install -r dev-requirements.txt"
19+
run: "pip install -r requirements/dev-requirements.txt"
2020
- name: "Publish to PyPI"
2121
run: "./scripts/release.sh"
2222
env:

.github/workflows/tests.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ jobs:
2222
- name: Install dependencies
2323
run: |
2424
python -m pip install --upgrade pip
25-
pip install -r requirements.txt
26-
pip install -r dev-requirements.txt
27-
pip install -r tests/test-requirements.txt
25+
pip install -r requirements/requirements.txt
26+
pip install -r requirements/dev-requirements.txt
27+
pip install -r requirements/test-requirements.txt
2828
- name: Lint
2929
run: ./scripts/lint.sh
3030

@@ -62,8 +62,8 @@ jobs:
6262
- name: Install dependencies
6363
run: |
6464
python -m pip install --upgrade pip
65-
pip install -r requirements.txt
66-
pip install -r tests/test-requirements.txt
65+
pip install -r requirements/requirements.txt
66+
pip install -r requirements/test-requirements.txt
6767
- name: Setup postgres
6868
run: |
6969
export PGPASSWORD=postgres
@@ -97,8 +97,8 @@ jobs:
9797
- name: Install dependencies
9898
run: |
9999
python -m pip install --upgrade pip
100-
pip install -r requirements.txt
101-
pip install -r tests/test-requirements.txt
100+
pip install -r requirements/requirements.txt
101+
pip install -r requirements/test-requirements.txt
102102
- name: Test with pytest, SQLite
103103
run: ./scripts/test-sqlite.sh
104104
- name: Upload coverage

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ _build/
1515
*.sqlite
1616
htmlcov/
1717
prof/
18+
.env/
19+
.venv/

docs/src/piccolo/getting_started/installing_piccolo.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ Now install piccolo, ideally inside a `virtualenv <https://docs.python-guide.org
2121
# The important bit:
2222
pip install piccolo
2323
24-
# For optional orjson support, which improves JSON serialisation
25-
# performance:
24+
# Optional: orjson for improved JSON serialisation performance
2625
pip install piccolo[orjson]
26+
27+
# Optional: uvloop as default event loop instead of asyncio
28+
# If using Piccolo with Uvicorn, Uvicorn will set uvloop as
29+
# default event loop if installed
30+
pip install piccolo[uvloop]

piccolo/main.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33

44
from targ import CLI # type: ignore
55

6+
try:
7+
import uvloop # type: ignore
8+
9+
uvloop.install()
10+
except ImportError:
11+
pass
12+
613
from piccolo.apps.app.piccolo_app import APP_CONFIG as app_config
714
from piccolo.apps.asgi.piccolo_app import APP_CONFIG as asgi_config
815
from piccolo.apps.meta.piccolo_app import APP_CONFIG as meta_config

requirements/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Requirement files
2+
3+
* `extras` - Optional dependencies of `Piccolo`.
4+
* `dev-requirements.txt` - Requirements needed to develop `Piccolo`.
5+
* `requirements.txt` - Default requirements of `Piccolo`.
6+
* `test-requirements.txt` - Requirements needed to run `Piccolo` tests.

requirements/extras/orjson.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
orjson==3.4.1

requirements/extras/playground.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ipython

requirements/extras/uvloop.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
uvloop>=0.12.0

0 commit comments

Comments
 (0)