1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 isPyPy,
6 cython,
7 distlib,
8 fetchPypi,
9 filelock,
10 flaky,
11 hatch-vcs,
12 hatchling,
13 importlib-metadata,
14 platformdirs,
15 pytest-freezegun,
16 pytest-mock,
17 pytest-timeout,
18 pytestCheckHook,
19 time-machine,
20}:
21
22buildPythonPackage rec {
23 pname = "virtualenv";
24 version = "20.31.2";
25 format = "pyproject";
26
27 disabled = pythonOlder "3.7";
28
29 src = fetchPypi {
30 inherit pname version;
31 hash = "sha256-4QwKnQKDXlklIb5IszK2yu5oh/MywRGqeaCbnnnvwq8=";
32 };
33
34 nativeBuildInputs = [
35 hatch-vcs
36 hatchling
37 ];
38
39 propagatedBuildInputs = [
40 distlib
41 filelock
42 platformdirs
43 ]
44 ++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ];
45
46 nativeCheckInputs = [
47 cython
48 flaky
49 pytest-freezegun
50 pytest-mock
51 pytest-timeout
52 pytestCheckHook
53 ]
54 ++ lib.optionals (!isPyPy) [ time-machine ];
55
56 preCheck = ''
57 export HOME=$(mktemp -d)
58 '';
59
60 disabledTestPaths = [
61 # Ignore tests which require network access
62 "tests/unit/create/test_creator.py"
63 "tests/unit/seed/embed/test_bootstrap_link_via_app_data.py"
64 ];
65
66 disabledTests = [
67 # Network access
68 "test_create_no_seed"
69 "test_seed_link_via_app_data"
70 # Permission Error
71 "test_bad_exe_py_info_no_raise"
72 ]
73 ++ lib.optionals (pythonOlder "3.11") [ "test_help" ]
74 ++ lib.optionals (isPyPy) [
75 # encoding problems
76 "test_bash"
77 # permission error
78 "test_can_build_c_extensions"
79 # fails to detect pypy version
80 "test_discover_ok"
81 ];
82
83 pythonImportsCheck = [ "virtualenv" ];
84
85 meta = with lib; {
86 description = "Tool to create isolated Python environments";
87 mainProgram = "virtualenv";
88 homepage = "http://www.virtualenv.org";
89 changelog = "https://github.com/pypa/virtualenv/blob/${version}/docs/changelog.rst";
90 license = licenses.mit;
91 maintainers = [ ];
92 };
93}