mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-03 11:33:31 +00:00
12e3938728
I was trying to use `python-arango` in one of my experiments with NixOS (23.05). I got the following error: ```console [rm_me] λ nix-shell -p python311Packages.python-arango [nix-shell:/data/rm_me]$ python -c 'import arango' Traceback (most recent call last): File "<string>", line 1, in <module> File "/nix/store/4n18qmv3dfx8gja79rvrlmrxzv1acmx9-python3.11-python-arango-7.5.7/lib/python3.11/site-packages/arango/__init__.py", line 2, in <module> from arango.client import ArangoClient # noqa: F401 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/4n18qmv3dfx8gja79rvrlmrxzv1acmx9-python3.11-python-arango-7.5.7/lib/python3.11/site-packages/arango/client.py", line 6, in <module> from pkg_resources import get_distribution ModuleNotFoundError: No module named 'pkg_resources' ``` To fix it, I have to pass an additional package to the nix shell: ```console [rm_me] λ nix-shell -p python311Packages.python-arango python311Packages.setuptools [nix-shell:/data/rm_me]$ python -c 'import arango' [nix-shell:/data/rm_me]$ ``` I found a similar issue with `pwndbg` in the past has been resolved in #71219. But I think in this case, we only need to change the Python side, not everything. This is my first nixpkgs PR, apologies if it is not correct. Will try to make it work :) Signed-off-by: Mihai Maruseac <mihai.maruseac@gmail.com>
145 lines
3.6 KiB
Nix
145 lines
3.6 KiB
Nix
{ lib
|
|
, arangodb
|
|
, buildPythonPackage
|
|
, fetchFromGitHub
|
|
, pythonOlder
|
|
, pytestCheckHook
|
|
, pyjwt
|
|
, pytest
|
|
, mock
|
|
, requests
|
|
, requests-toolbelt
|
|
, setuptools
|
|
}:
|
|
|
|
let
|
|
testDBOpts = {
|
|
host = "127.0.0.1";
|
|
port = "8529";
|
|
password = "test";
|
|
secret = "secret";
|
|
};
|
|
in
|
|
|
|
buildPythonPackage rec {
|
|
pname = "python-arango";
|
|
version = "7.5.7";
|
|
format = "setuptools";
|
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "ArangoDB-Community";
|
|
repo = "python-arango";
|
|
rev = "refs/tags/${version}";
|
|
hash = "sha256-cd2xE5rYLl3NOv/DZjmHRPCe224k4XyPjo9aXV1ZhvU=";
|
|
};
|
|
|
|
propagatedBuildInputs = [
|
|
requests
|
|
requests-toolbelt
|
|
pyjwt
|
|
setuptools
|
|
];
|
|
|
|
nativeCheckInputs = [
|
|
arangodb
|
|
mock
|
|
pytestCheckHook
|
|
];
|
|
|
|
# arangodb is compiled only for particular target architectures
|
|
# (i.e. "haswell"). Thus, these tests may not pass reproducibly,
|
|
# failing with: `166: Illegal instruction` if not run on arangodb's
|
|
# specified architecture.
|
|
#
|
|
# nonetheless, the client library should remain in nixpkgs - since
|
|
# the client library will talk to arangodb across the network and
|
|
# architecture issues will be irrelevant.
|
|
doCheck = false;
|
|
|
|
preCheck = lib.optionalString doCheck ''
|
|
# Start test DB
|
|
mkdir -p .nix-test/{data,work}
|
|
|
|
ICU_DATA=${arangodb}/share/arangodb3 \
|
|
GLIBCXX_FORCE_NEW=1 \
|
|
TZ=UTC \
|
|
TZ_DATA=${arangodb}/share/arangodb3/tzdata \
|
|
ARANGO_ROOT_PASSWORD=${testDBOpts.password} \
|
|
${arangodb}/bin/arangod \
|
|
--server.uid=$(id -u) \
|
|
--server.gid=$(id -g) \
|
|
--server.authentication=true \
|
|
--server.endpoint=http+tcp://${testDBOpts.host}:${testDBOpts.port} \
|
|
--server.descriptors-minimum=4096 \
|
|
--server.jwt-secret=${testDBOpts.secret} \
|
|
--javascript.app-path=.nix-test/app \
|
|
--log.file=.nix-test/log \
|
|
--database.directory=.nix-test/data \
|
|
--foxx.api=false &
|
|
'';
|
|
|
|
pytestFlagsArray = [
|
|
"--host"
|
|
testDBOpts.host
|
|
"--port"
|
|
testDBOpts.port
|
|
"--passwd"
|
|
testDBOpts.password
|
|
"--secret"
|
|
testDBOpts.secret
|
|
];
|
|
|
|
disabledTests = [
|
|
# AssertionError geo-related - try enabling later
|
|
"test_document_find_in_box"
|
|
|
|
# maybe arangod misconfig - try enabling later
|
|
# arango.exceptions.JWTAuthError: [HTTP 401][ERR 401] Wrong credentials
|
|
"test_auth_jwt"
|
|
|
|
# ValueError - try enabling later
|
|
# maybe missed 3.9.3->3.10.0 changes
|
|
# most caused by key change: isNewlyCreated->new
|
|
"test_add_hash_index"
|
|
"test_add_skiplist_index"
|
|
"test_add_persistent_index"
|
|
"test_add_ttl_index"
|
|
"test_delete_index"
|
|
"test_pregel_management"
|
|
|
|
# formatting error - try enabling later
|
|
# maybe missed 3.9.3->3.10.0 changes
|
|
# caused by: body["computedValues"] = None
|
|
"test_permission_management"
|
|
"test_collection_misc_methods"
|
|
"test_collection_management"
|
|
"test_replication_inventory"
|
|
|
|
# want outgoing network to update foxx apis
|
|
# so foxx.api disabled in arangod startup
|
|
"test_foxx_service_management_file"
|
|
"test_foxx_service_management_json"
|
|
"test_foxx_config_management"
|
|
"test_foxx_dependency_management"
|
|
"test_foxx_development_toggle"
|
|
"test_foxx_misc_functions"
|
|
|
|
# no replication configured via arangod invocation
|
|
"test_replication_applier"
|
|
];
|
|
|
|
pythonImportsCheck = [
|
|
"arango"
|
|
];
|
|
|
|
meta = with lib; {
|
|
description = "Python Driver for ArangoDB";
|
|
homepage = "https://github.com/ArangoDB-Community/python-arango";
|
|
changelog = "https://github.com/ArangoDB-Community/python-arango/releases/tag/${version}";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ jsoo1 ];
|
|
};
|
|
}
|