1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pytestCheckHook,
6 pyte,
7 pexpect,
8 ptyprocess,
9 jedi,
10 git,
11 lineedit,
12 prompt-toolkit,
13 pygments,
14 rchitect,
15 R,
16 rPackages,
17 pythonOlder,
18}:
19
20buildPythonPackage rec {
21 pname = "radian";
22 version = "0.6.12";
23 format = "setuptools";
24
25 disabled = pythonOlder "3.7";
26
27 src = fetchFromGitHub {
28 owner = "randy3k";
29 repo = pname;
30 rev = "refs/tags/v${version}";
31 hash = "sha256-cojKbDNqcUay5RxvWszQ96eC4jVI4G7iRv/ZYWgidCQ=";
32 };
33
34 postPatch = ''
35 substituteInPlace setup.py \
36 --replace '"pytest-runner"' ""
37 '';
38
39 nativeBuildInputs = [
40 R # needed at setup time to detect R_HOME
41 ];
42
43 propagatedBuildInputs =
44 [
45 lineedit
46 prompt-toolkit
47 pygments
48 rchitect
49 ]
50 ++ (with rPackages; [
51 reticulate
52 askpass
53 ]);
54
55 nativeCheckInputs = [
56 pytestCheckHook
57 pyte
58 pexpect
59 ptyprocess
60 jedi
61 git
62 ];
63
64 makeWrapperArgs = [ "--set R_HOME ${R}/lib/R" ];
65
66 preCheck = ''
67 export HOME=$TMPDIR
68 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${R}/lib/R/lib
69 '';
70
71 pythonImportsCheck = [ "radian" ];
72
73 meta = with lib; {
74 description = "A 21 century R console";
75 mainProgram = "radian";
76 homepage = "https://github.com/randy3k/radian";
77 changelog = "https://github.com/randy3k/radian/blob/v${version}/CHANGELOG.md";
78 license = licenses.mit;
79 maintainers = with maintainers; [ savyajha ];
80 };
81}