2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
asgiref,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
flask,
|
|
|
|
hiro,
|
|
|
|
limits,
|
|
|
|
ordered-set,
|
|
|
|
pymemcache,
|
|
|
|
pymongo,
|
|
|
|
pytest-mock,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
redis,
|
|
|
|
rich,
|
|
|
|
setuptools,
|
|
|
|
typing-extensions,
|
2021-04-05 15:23:46 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2023-03-15 16:39:30 +00:00
|
|
|
pname = "flask-limiter";
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "3.7.0";
|
2024-04-21 15:54:59 +00:00
|
|
|
pyproject = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-08-10 07:59:29 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
|
2021-04-05 15:23:46 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "alisaifee";
|
|
|
|
repo = "flask-limiter";
|
2023-01-20 10:41:00 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2024-06-05 15:53:02 +00:00
|
|
|
hash = "sha256-W40zuQ/xkoV35DXehwMUJwbX0grJMfRXawiPfpRKL/g=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
postPatch = ''
|
|
|
|
sed -i "/--cov/d" pytest.ini
|
|
|
|
|
|
|
|
# flask-restful is unmaintained and breaks regularly, don't depend on it
|
|
|
|
sed -i "/import flask_restful/d" tests/test_views.py
|
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = [ setuptools ];
|
2024-04-21 15:54:59 +00:00
|
|
|
|
2022-09-14 18:05:37 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
flask
|
|
|
|
limits
|
2023-01-20 10:41:00 +00:00
|
|
|
ordered-set
|
2022-09-14 18:05:37 +00:00
|
|
|
rich
|
|
|
|
typing-extensions
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-09-14 18:05:37 +00:00
|
|
|
asgiref
|
|
|
|
pytest-mock
|
2021-04-05 15:23:46 +00:00
|
|
|
pytestCheckHook
|
|
|
|
hiro
|
|
|
|
redis
|
|
|
|
pymemcache
|
2022-09-14 18:05:37 +00:00
|
|
|
pymongo
|
2021-04-05 15:23:46 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
disabledTests = [
|
2022-09-14 18:05:37 +00:00
|
|
|
# flask-restful is unmaintained and breaks regularly
|
|
|
|
"test_flask_restful_resource"
|
|
|
|
|
|
|
|
# Requires running a docker instance
|
|
|
|
"test_clear_limits"
|
2021-04-05 15:23:46 +00:00
|
|
|
"test_constructor_arguments_over_config"
|
2022-09-14 18:05:37 +00:00
|
|
|
"test_custom_key_prefix"
|
|
|
|
"test_custom_key_prefix_with_headers"
|
2021-04-05 15:23:46 +00:00
|
|
|
"test_fallback_to_memory_backoff_check"
|
2022-09-14 18:05:37 +00:00
|
|
|
"test_fallback_to_memory_config"
|
2021-04-05 15:23:46 +00:00
|
|
|
"test_fallback_to_memory_with_global_override"
|
|
|
|
"test_redis_request_slower_than_fixed_window"
|
|
|
|
"test_redis_request_slower_than_moving_window"
|
2022-09-14 18:05:37 +00:00
|
|
|
"test_reset_unsupported"
|
|
|
|
|
|
|
|
# Requires redis
|
|
|
|
"test_fallback_to_memory"
|
|
|
|
];
|
|
|
|
|
|
|
|
disabledTestPaths = [
|
|
|
|
# requires running redis/memcached/mongodb
|
|
|
|
"tests/test_storage.py"
|
2021-04-05 15:23:46 +00:00
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "flask_limiter" ];
|
2021-04-05 15:23:46 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Rate limiting for flask applications";
|
|
|
|
homepage = "https://flask-limiter.readthedocs.org/";
|
2023-08-10 07:59:29 +00:00
|
|
|
changelog = "https://github.com/alisaifee/flask-limiter/blob/${version}/HISTORY.rst";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
2023-03-15 16:39:30 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|