Skip to content

Commit 152ebb0

Browse files
author
Hugo Osvaldo Barrera
authored
Merge pull request #906 from pimutils/async
Initial asyncio support
2 parents 25435ce + 5a9fc2c commit 152ebb0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1496
-1200
lines changed

.builds/archlinux.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,16 @@ packages:
1414
- python-click-threading
1515
- python-requests
1616
- python-requests-toolbelt
17+
- python-aiohttp-oauthlib
1718
# Test dependencies:
1819
- python-hypothesis
1920
- python-pytest-cov
2021
- python-pytest-httpserver
2122
- python-trustme
23+
- python-pytest-asyncio
24+
- python-aiohttp
25+
- python-aiostream
26+
- python-aioresponses
2227
sources:
2328
- https://github.com/pimutils/vdirsyncer
2429
environment:

CHANGELOG.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,20 @@ Version 0.19.0
1515
- Add "description" and "order" as metadata. These fetch the CalDAV:
1616
calendar-description, CardDAV:addressbook-description and apple-ns:calendar-order
1717
properties.
18-
- Add a new "showconfig" status. This prints *some* configuration values as
18+
- Add a new ``showconfig`` status. This prints *some* configuration values as
1919
JSON. This is intended to be used by external tools and helpers that interact
2020
with ``vdirsyncer``.
21-
- Update TLS-related tests that were failing due to weak MDs.
21+
- Update TLS-related tests that were failing due to weak MDs. :gh:`903`
2222
- ``pytest-httpserver`` and ``trustme`` are now required for tests.
2323
- ``pytest-localserver`` is no longer required for tests.
24+
- Multithreaded support has been dropped. The ``"--max-workers`` has been removed.
25+
- A new ``asyncio`` backend is now used. So far, this shows substantial speed
26+
improvements in ``discovery`` and ``metasync``, but little change in `sync`.
27+
This will likely continue improving over time. :gh:`906`
28+
- Support for `md5` and `sha1` certificate fingerprints has been dropped. If
29+
you're validating certificate fingerprints, use `sha256` instead.
30+
- The ``google`` storage types no longer require ``requests-oauthlib``, but
31+
require ``python-aiohttp-oauthlib`` instead.
2432

2533
Version 0.18.0
2634
==============

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ addopts =
88
--cov=vdirsyncer
99
--cov-report=term-missing
1010
--no-cov-on-fail
11+
# filterwarnings=error
1112

1213
[flake8]
1314
application-import-names = tests,vdirsyncer

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
# https://github.com/mitsuhiko/click/issues/200
1414
"click>=5.0,<9.0",
1515
"click-log>=0.3.0, <0.4.0",
16-
# https://github.com/pimutils/vdirsyncer/issues/478
17-
"click-threading>=0.5",
1816
"requests >=2.20.0",
1917
# https://github.com/sigmavirus24/requests-toolbelt/pull/28
2018
# And https://github.com/sigmavirus24/requests-toolbelt/issues/54
2119
"requests_toolbelt >=0.4.0",
2220
# https://github.com/untitaker/python-atomicwrites/commit/4d12f23227b6a944ab1d99c507a69fdbc7c9ed6d # noqa
2321
"atomicwrites>=0.1.7",
22+
"aiohttp>=3.7.1,<4.0.0",
23+
"aiostream>=0.4.3,<0.5.0",
2424
]
2525

2626

@@ -56,7 +56,7 @@ def run(self):
5656
install_requires=requirements,
5757
# Optional dependencies
5858
extras_require={
59-
"google": ["requests-oauthlib"],
59+
"google": ["aiohttp-oauthlib"],
6060
"etesync": ["etesync==0.5.2", "django<2.0"],
6161
},
6262
# Build dependencies

test-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ pytest
33
pytest-cov
44
pytest-httpserver
55
trustme
6+
pytest-asyncio
7+
aioresponses

tests/conftest.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import logging
55
import os
66

7+
import aiohttp
78
import click_log
89
import pytest
910
from hypothesis import HealthCheck
@@ -52,3 +53,18 @@ def benchmark():
5253
settings.load_profile("ci")
5354
else:
5455
settings.load_profile("dev")
56+
57+
58+
@pytest.fixture
59+
async def aio_session(event_loop):
60+
async with aiohttp.ClientSession() as session:
61+
yield session
62+
63+
64+
@pytest.fixture
65+
async def aio_connector(event_loop):
66+
conn = aiohttp.TCPConnector(limit_per_host=16)
67+
try:
68+
yield conn
69+
finally:
70+
await conn.close()

0 commit comments

Comments
 (0)