Skip to content

Commit

Permalink
Merge pull request #332808 from geraldog/add_onecache
Browse files Browse the repository at this point in the history
Add aiosonic and onecache dependency
  • Loading branch information
gador authored Aug 14, 2024
2 parents 2dfa14c + e7c47c7 commit a42598a
Show file tree
Hide file tree
Showing 4 changed files with 206 additions and 0 deletions.
6 changes: 6 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7394,6 +7394,12 @@
{ fingerprint = "MP2UpIRtJpbFFqyucP431H/FPCfn58UhEUTro4lXtRs"; }
];
};
geraldog = {
email = "[email protected]";
github = "geraldog";
githubId = 14135816;
name = "Geraldo Nascimento";
};
gerg-l = {
email = "[email protected]";
github = "Gerg-L";
Expand Down
147 changes: 147 additions & 0 deletions pkgs/development/python-modules/aiosonic/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
{
nodejs,
lib,
buildPythonPackage,
pythonOlder,
fetchFromGitHub,
poetry-core,
# install_requires
charset-normalizer,
h2,
onecache,
# test dependencies
asgiref,
black,
django,
click,
httpx,
proxy-py,
pytest-aiohttp,
pytest-asyncio,
pytest-django,
pytest-mock,
pytest-sugar,
pytest-timeout,
uvicorn,
httptools,
typed-ast,
uvloop,
requests,
aiohttp,
aiodns,
pytestCheckHook,
stdenv,
}:

buildPythonPackage rec {
pname = "aiosonic";
version = "0.20.1";
pyproject = true;

disabled = pythonOlder "3.8";

__darwinAllowLocalNetworking = true;

src = fetchFromGitHub {
owner = "sonic182";
repo = "aiosonic";
rev = "refs/tags/${version}";
hash = "sha256-RMkmmXUqzt9Nsx8N+f9Xdbgjt1nd5NuJHs9dzarx8IY=";
};

postPatch = ''
substituteInPlace pytest.ini --replace-fail \
"addopts = --black --cov=aiosonic --cov-report term --cov-report html --doctest-modules" \
"addopts = --doctest-modules"
'';

build-system = [ poetry-core ];

dependencies = [
charset-normalizer
onecache
h2
];

nativeCheckInputs = [
aiohttp
aiodns
asgiref
black
django
click
httpx
proxy-py
pytest-aiohttp
pytest-asyncio
pytest-django
pytest-mock
pytest-sugar
pytest-timeout
uvicorn
httptools
typed-ast
uvloop
requests
pytestCheckHook
nodejs
];

pythonImportsCheck = [ "aiosonic" ];

disabledTests =
lib.optionals stdenv.isLinux [
# need network
"test_simple_get"
"test_get_python"
"test_post_http2"
"test_get_http2"
"test_method_lower"
"test_keep_alive_smart_pool"
"test_keep_alive_cyclic_pool"
"test_get_with_params"
"test_get_with_params_in_url"
"test_get_with_params_tuple"
"test_post_form_urlencoded"
"test_post_tuple_form_urlencoded"
"test_post_json"
"test_put_patch"
"test_delete"
"test_delete_2"
"test_get_keepalive"
"test_post_multipart_to_django"
"test_connect_timeout"
"test_read_timeout"
"test_timeouts_overriden"
"test_pool_acquire_timeout"
"test_simple_get_ssl"
"test_simple_get_ssl_ctx"
"test_simple_get_ssl_no_valid"
"test_get_chunked_response"
"test_get_chunked_response_and_not_read_it"
"test_read_chunks_by_text_method"
"test_get_body_gzip"
"test_get_body_deflate"
"test_post_chunked"
"test_close_connection"
"test_close_old_keeped_conn"
"test_get_redirect"
"test_max_redirects"
"test_get_image"
"test_get_image_chunked"
"test_get_with_cookies"
"test_proxy_request"
]
++ lib.optionals stdenv.isDarwin [
# "FAILED tests/test_proxy.py::test_proxy_request - Exception: port 8865 never got active"
"test_proxy_request"
];

meta = {
changelog = "https://github.com/sonic182/aiosonic/blob/${version}/CHANGELOG.md";
description = "Very fast Python asyncio http client";
license = lib.licenses.mit;
homepage = "https://github.com/sonic182/aiosonic";
maintainers = with lib.maintainers; [ geraldog ];
};
}
49 changes: 49 additions & 0 deletions pkgs/development/python-modules/onecache/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
lib,
buildPythonPackage,
pythonOlder,
fetchFromGitHub,
poetry-core,
pytestCheckHook,
pytest-cov-stub,
pytest-asyncio,
stdenv,
}:

buildPythonPackage rec {
pname = "onecache";
version = "0.7.0";
pyproject = true;

disabled = pythonOlder "3.8";

src = fetchFromGitHub {
owner = "sonic182";
repo = "onecache";
rev = "refs/tags/${version}";
hash = "sha256-go/3HntSLzzTmHS9CxGPHT6mwXl+6LuWFmkGygGIjqU=";
};

build-system = [ poetry-core ];

nativeCheckInputs = [
pytestCheckHook
pytest-cov-stub
pytest-asyncio
];

disabledTests = lib.optionals stdenv.isDarwin [
# test fails due to unknown reason on darwin
"test_lru_and_ttl_refresh"
];

pythonImportsCheck = [ "onecache" ];

meta = {
changelog = "https://github.com/sonic182/onecache/blob/${version}/CHANGELOG.md";
description = "Python LRU and TTL cache for sync and async code";
license = lib.licenses.mit;
homepage = "https://github.com/sonic182/onecache";
maintainers = with lib.maintainers; [ geraldog ];
};
}
4 changes: 4 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,8 @@ self: super: with self; {

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

aiosonic = callPackage ../development/python-modules/aiosonic { };

aiosql = callPackage ../development/python-modules/aiosql { };

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

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

onecache = callPackage ../development/python-modules/onecache { };

onetimepass = callPackage ../development/python-modules/onetimepass { };

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

0 comments on commit a42598a

Please sign in to comment.