Skip to content

Commit a42598a

Browse files
authored
Merge pull request #332808 from geraldog/add_onecache
Add aiosonic and onecache dependency
2 parents 2dfa14c + e7c47c7 commit a42598a

File tree

4 files changed

+206
-0
lines changed

4 files changed

+206
-0
lines changed

maintainers/maintainer-list.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7394,6 +7394,12 @@
73947394
{ fingerprint = "MP2UpIRtJpbFFqyucP431H/FPCfn58UhEUTro4lXtRs"; }
73957395
];
73967396
};
7397+
geraldog = {
7398+
email = "[email protected]";
7399+
github = "geraldog";
7400+
githubId = 14135816;
7401+
name = "Geraldo Nascimento";
7402+
};
73977403
gerg-l = {
73987404
email = "[email protected]";
73997405
github = "Gerg-L";
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
{
2+
nodejs,
3+
lib,
4+
buildPythonPackage,
5+
pythonOlder,
6+
fetchFromGitHub,
7+
poetry-core,
8+
# install_requires
9+
charset-normalizer,
10+
h2,
11+
onecache,
12+
# test dependencies
13+
asgiref,
14+
black,
15+
django,
16+
click,
17+
httpx,
18+
proxy-py,
19+
pytest-aiohttp,
20+
pytest-asyncio,
21+
pytest-django,
22+
pytest-mock,
23+
pytest-sugar,
24+
pytest-timeout,
25+
uvicorn,
26+
httptools,
27+
typed-ast,
28+
uvloop,
29+
requests,
30+
aiohttp,
31+
aiodns,
32+
pytestCheckHook,
33+
stdenv,
34+
}:
35+
36+
buildPythonPackage rec {
37+
pname = "aiosonic";
38+
version = "0.20.1";
39+
pyproject = true;
40+
41+
disabled = pythonOlder "3.8";
42+
43+
__darwinAllowLocalNetworking = true;
44+
45+
src = fetchFromGitHub {
46+
owner = "sonic182";
47+
repo = "aiosonic";
48+
rev = "refs/tags/${version}";
49+
hash = "sha256-RMkmmXUqzt9Nsx8N+f9Xdbgjt1nd5NuJHs9dzarx8IY=";
50+
};
51+
52+
postPatch = ''
53+
substituteInPlace pytest.ini --replace-fail \
54+
"addopts = --black --cov=aiosonic --cov-report term --cov-report html --doctest-modules" \
55+
"addopts = --doctest-modules"
56+
'';
57+
58+
build-system = [ poetry-core ];
59+
60+
dependencies = [
61+
charset-normalizer
62+
onecache
63+
h2
64+
];
65+
66+
nativeCheckInputs = [
67+
aiohttp
68+
aiodns
69+
asgiref
70+
black
71+
django
72+
click
73+
httpx
74+
proxy-py
75+
pytest-aiohttp
76+
pytest-asyncio
77+
pytest-django
78+
pytest-mock
79+
pytest-sugar
80+
pytest-timeout
81+
uvicorn
82+
httptools
83+
typed-ast
84+
uvloop
85+
requests
86+
pytestCheckHook
87+
nodejs
88+
];
89+
90+
pythonImportsCheck = [ "aiosonic" ];
91+
92+
disabledTests =
93+
lib.optionals stdenv.isLinux [
94+
# need network
95+
"test_simple_get"
96+
"test_get_python"
97+
"test_post_http2"
98+
"test_get_http2"
99+
"test_method_lower"
100+
"test_keep_alive_smart_pool"
101+
"test_keep_alive_cyclic_pool"
102+
"test_get_with_params"
103+
"test_get_with_params_in_url"
104+
"test_get_with_params_tuple"
105+
"test_post_form_urlencoded"
106+
"test_post_tuple_form_urlencoded"
107+
"test_post_json"
108+
"test_put_patch"
109+
"test_delete"
110+
"test_delete_2"
111+
"test_get_keepalive"
112+
"test_post_multipart_to_django"
113+
"test_connect_timeout"
114+
"test_read_timeout"
115+
"test_timeouts_overriden"
116+
"test_pool_acquire_timeout"
117+
"test_simple_get_ssl"
118+
"test_simple_get_ssl_ctx"
119+
"test_simple_get_ssl_no_valid"
120+
"test_get_chunked_response"
121+
"test_get_chunked_response_and_not_read_it"
122+
"test_read_chunks_by_text_method"
123+
"test_get_body_gzip"
124+
"test_get_body_deflate"
125+
"test_post_chunked"
126+
"test_close_connection"
127+
"test_close_old_keeped_conn"
128+
"test_get_redirect"
129+
"test_max_redirects"
130+
"test_get_image"
131+
"test_get_image_chunked"
132+
"test_get_with_cookies"
133+
"test_proxy_request"
134+
]
135+
++ lib.optionals stdenv.isDarwin [
136+
# "FAILED tests/test_proxy.py::test_proxy_request - Exception: port 8865 never got active"
137+
"test_proxy_request"
138+
];
139+
140+
meta = {
141+
changelog = "https://github.com/sonic182/aiosonic/blob/${version}/CHANGELOG.md";
142+
description = "Very fast Python asyncio http client";
143+
license = lib.licenses.mit;
144+
homepage = "https://github.com/sonic182/aiosonic";
145+
maintainers = with lib.maintainers; [ geraldog ];
146+
};
147+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
lib,
3+
buildPythonPackage,
4+
pythonOlder,
5+
fetchFromGitHub,
6+
poetry-core,
7+
pytestCheckHook,
8+
pytest-cov-stub,
9+
pytest-asyncio,
10+
stdenv,
11+
}:
12+
13+
buildPythonPackage rec {
14+
pname = "onecache";
15+
version = "0.7.0";
16+
pyproject = true;
17+
18+
disabled = pythonOlder "3.8";
19+
20+
src = fetchFromGitHub {
21+
owner = "sonic182";
22+
repo = "onecache";
23+
rev = "refs/tags/${version}";
24+
hash = "sha256-go/3HntSLzzTmHS9CxGPHT6mwXl+6LuWFmkGygGIjqU=";
25+
};
26+
27+
build-system = [ poetry-core ];
28+
29+
nativeCheckInputs = [
30+
pytestCheckHook
31+
pytest-cov-stub
32+
pytest-asyncio
33+
];
34+
35+
disabledTests = lib.optionals stdenv.isDarwin [
36+
# test fails due to unknown reason on darwin
37+
"test_lru_and_ttl_refresh"
38+
];
39+
40+
pythonImportsCheck = [ "onecache" ];
41+
42+
meta = {
43+
changelog = "https://github.com/sonic182/onecache/blob/${version}/CHANGELOG.md";
44+
description = "Python LRU and TTL cache for sync and async code";
45+
license = lib.licenses.mit;
46+
homepage = "https://github.com/sonic182/onecache";
47+
maintainers = with lib.maintainers; [ geraldog ];
48+
};
49+
}

pkgs/top-level/python-packages.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,8 @@ self: super: with self; {
407407

408408
aiosasl = callPackage ../development/python-modules/aiosasl { };
409409

410+
aiosonic = callPackage ../development/python-modules/aiosonic { };
411+
410412
aiosql = callPackage ../development/python-modules/aiosql { };
411413

412414
aiosenz = callPackage ../development/python-modules/aiosenz { };
@@ -9408,6 +9410,8 @@ self: super: with self; {
94089410

94099411
ondilo = callPackage ../development/python-modules/ondilo { };
94109412

9413+
onecache = callPackage ../development/python-modules/onecache { };
9414+
94119415
onetimepass = callPackage ../development/python-modules/onetimepass { };
94129416

94139417
onigurumacffi = callPackage ../development/python-modules/onigurumacffi { };

0 commit comments

Comments
 (0)