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.33.1";
25 format = "pyproject";
26
27 disabled = pythonOlder "3.7";
28
29 src = fetchPypi {
30 inherit pname version;
31 hash = "sha256-G0RHjZ4mGz+4uqXnSgyjvA4F8hqjYWe/nL+FDlQnZbg=";
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 # https://github.com/pypa/virtualenv/issues/2933
73 # https://github.com/pypa/virtualenv/issues/2939
74 "test_py_info_cache_invalidation_on_py_info_change"
75 ]
76 ++ lib.optionals (pythonOlder "3.11") [ "test_help" ]
77 ++ lib.optionals isPyPy [
78 # encoding problems
79 "test_bash"
80 # permission error
81 "test_can_build_c_extensions"
82 # fails to detect pypy version
83 "test_discover_ok"
84 ];
85
86 pythonImportsCheck = [ "virtualenv" ];
87
88 meta = with lib; {
89 description = "Tool to create isolated Python environments";
90 mainProgram = "virtualenv";
91 homepage = "http://www.virtualenv.org";
92 changelog = "https://github.com/pypa/virtualenv/blob/${version}/docs/changelog.rst";
93 license = licenses.mit;
94 maintainers = [ ];
95 };
96}