nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 aiofiles,
5 aiosqlite,
6 buildPythonPackage,
7 cryptography,
8 fetchFromGitHub,
9 hatchling,
10 pyopenssl,
11 pytest-asyncio,
12 pytest-mock,
13 pytestCheckHook,
14 python-dateutil,
15 pythonAtLeast,
16 pytz,
17 sortedcontainers,
18 typing-extensions,
19}:
20
21buildPythonPackage rec {
22 pname = "asyncua";
23 version = "1.1.8";
24 pyproject = true;
25
26 src = fetchFromGitHub {
27 owner = "FreeOpcUa";
28 repo = "opcua-asyncio";
29 tag = "v${version}";
30 hash = "sha256-0eay/NlWn0I2oF0fTln9/d4y31zGfAj9ph3bWkgd8Nk=";
31 fetchSubmodules = true;
32 };
33
34 postPatch = ''
35 # Workaround hardcoded paths in test
36 # "test_cli_tools_which_require_sigint"
37 substituteInPlace tests/test_tools.py \
38 --replace-fail "tools/" "$out/bin/"
39 '';
40
41 build-system = [ hatchling ];
42
43 dependencies = [
44 aiofiles
45 aiosqlite
46 cryptography
47 pyopenssl
48 python-dateutil
49 pytz
50 sortedcontainers
51 typing-extensions
52 ];
53
54 nativeCheckInputs = [
55 pytestCheckHook
56 pytest-asyncio
57 pytest-mock
58 ];
59
60 pythonImportsCheck = [ "asyncua" ];
61
62 disabledTests = [
63 # Failed: DID NOT RAISE <class 'asyncio.exceptions.TimeoutError'>
64 "test_publish"
65 ]
66 ++ lib.optionals (pythonAtLeast "3.13") [
67 # dbm.sqlite3.error: SQLite objects created in a thread can only be used in that same thread.
68 # The object was created in thread id 140737220687552 and this is thread id 140737343690560.
69 "test_runTest"
70 ]
71 ++ lib.optionals stdenv.hostPlatform.isDarwin [
72 # OSError: [Errno 48] error while attempting to bind on address ('127.0.0.1',...
73 "test_anonymous_rejection"
74 "test_certificate_handling_success"
75 "test_encrypted_private_key_handling_success"
76 "test_encrypted_private_key_handling_success_with_cert_props"
77 "test_encrypted_private_key_handling_failure"
78 ];
79
80 meta = {
81 description = "OPC UA / IEC 62541 Client and Server for Python";
82 homepage = "https://github.com/FreeOpcUa/opcua-asyncio";
83 changelog = "https://github.com/FreeOpcUa/opcua-asyncio/releases/tag/${src.tag}";
84 license = lib.licenses.lgpl3Plus;
85 maintainers = with lib.maintainers; [ harvidsen ];
86 };
87}