2021-08-22 07:53:02 +00:00
|
|
|
{ lib
|
|
|
|
, blinker
|
|
|
|
, buildPythonPackage
|
2023-08-22 20:05:09 +00:00
|
|
|
, django
|
2021-08-22 07:53:02 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, flake8
|
2022-08-12 12:06:08 +00:00
|
|
|
, flask-sqlalchemy
|
2021-08-22 07:53:02 +00:00
|
|
|
, isPy27
|
|
|
|
, mock
|
|
|
|
, peewee
|
|
|
|
, pytest-django
|
|
|
|
, pytestCheckHook
|
|
|
|
, six
|
|
|
|
, sqlalchemy
|
|
|
|
, webtest
|
|
|
|
}:
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "nplusone";
|
|
|
|
version = "1.0.0";
|
|
|
|
disabled = isPy27;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jmcarp";
|
|
|
|
repo = "nplusone";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "0qdwpvvg7dzmksz3vqkvb27n52lq5sa8i06m7idnj5xk2dgjkdxg";
|
|
|
|
};
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
blinker
|
|
|
|
six
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-08-22 07:53:02 +00:00
|
|
|
flake8
|
2022-08-12 12:06:08 +00:00
|
|
|
flask-sqlalchemy
|
2021-08-22 07:53:02 +00:00
|
|
|
mock
|
|
|
|
peewee
|
|
|
|
pytest-django
|
|
|
|
pytestCheckHook
|
|
|
|
sqlalchemy
|
|
|
|
webtest
|
|
|
|
];
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
# The tests assume the source code is in an nplusone/ directory. When using
|
|
|
|
# the Nix sandbox, it will be in a source/ directory instead, making the
|
|
|
|
# tests fail.
|
|
|
|
prePatch = ''
|
|
|
|
substituteInPlace tests/conftest.py \
|
|
|
|
--replace nplusone/tests/conftest source/tests/conftest
|
|
|
|
'';
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pytest.ini \
|
2022-04-15 01:41:22 +00:00
|
|
|
--replace "python_paths" "pythonpath" \
|
2021-08-22 07:53:02 +00:00
|
|
|
--replace "--cov nplusone --cov-report term-missing" ""
|
2020-08-20 17:08:02 +00:00
|
|
|
'';
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
disabledTests = [
|
|
|
|
# Tests are out-dated
|
|
|
|
"test_many_to_one"
|
|
|
|
"test_many_to_many"
|
|
|
|
"test_eager_join"
|
|
|
|
"test_eager_subquery"
|
|
|
|
"test_eager_subquery_unused"
|
|
|
|
"test_many_to_many_raise"
|
|
|
|
"test_many_to_many_whitelist_decoy"
|
|
|
|
"test_many_to_one_subquery"
|
|
|
|
"test_many_to_one_reverse_subquery"
|
|
|
|
"test_many_to_many_subquery"
|
|
|
|
"test_many_to_many_reverse_subquery"
|
|
|
|
"test_profile"
|
2020-08-20 17:08:02 +00:00
|
|
|
];
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
pythonImportsCheck = [ "nplusone" ];
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Detecting the n+1 queries problem in Python";
|
|
|
|
homepage = "https://github.com/jmcarp/nplusone";
|
|
|
|
maintainers = with maintainers; [ cript0nauta ];
|
|
|
|
license = licenses.mit;
|
2023-08-22 20:05:09 +00:00
|
|
|
broken = lib.versionAtLeast django.version "4";
|
2020-08-20 17:08:02 +00:00
|
|
|
};
|
|
|
|
}
|