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