From 38c04e691ce90ea12f68107bec47057915903f02 Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Mon, 23 Oct 2017 12:51:38 +0200 Subject: [PATCH 1/6] python.pkgs.jupyter_core: own file, enable tests --- .../python-modules/jupyter_core/default.nix | 38 +++++++++++++++++++ .../tests_respect_pythonpath.patch | 24 ++++++++++++ pkgs/top-level/python-packages.nix | 27 +------------ 3 files changed, 63 insertions(+), 26 deletions(-) create mode 100644 pkgs/development/python-modules/jupyter_core/default.nix create mode 100644 pkgs/development/python-modules/jupyter_core/tests_respect_pythonpath.patch diff --git a/pkgs/development/python-modules/jupyter_core/default.nix b/pkgs/development/python-modules/jupyter_core/default.nix new file mode 100644 index 00000000000..4db36cf7b37 --- /dev/null +++ b/pkgs/development/python-modules/jupyter_core/default.nix @@ -0,0 +1,38 @@ +{ lib +, python +, buildPythonPackage +, fetchPypi +, ipython +, traitlets +, glibcLocales +, mock +, pytest +}: + +buildPythonPackage rec { + pname = "jupyter_core"; + version = "4.3.0"; + name = "${pname}-${version}"; + + src = fetchPypi { + inherit pname version; + sha256 = "a96b129e1641425bf057c3d46f4f44adce747a7d60107e8ad771045c36514d40"; + }; + + buildInputs = [ pytest mock glibcLocales ]; + propagatedBuildInputs = [ ipython traitlets ]; + + patches = [ ./tests_respect_pythonpath.patch ]; + + checkPhase = '' + mkdir tmp + HOME=tmp TMPDIR=tmp LC_ALL=en_US.utf8 py.test + ''; + + meta = with lib; { + description = "Jupyter core package. A base package on which Jupyter projects rely"; + homepage = http://jupyter.org/; + license = licenses.bsd3; + maintainers = with maintainers; [ fridh globin ]; + }; +} diff --git a/pkgs/development/python-modules/jupyter_core/tests_respect_pythonpath.patch b/pkgs/development/python-modules/jupyter_core/tests_respect_pythonpath.patch new file mode 100644 index 00000000000..61415b756ab --- /dev/null +++ b/pkgs/development/python-modules/jupyter_core/tests_respect_pythonpath.patch @@ -0,0 +1,24 @@ +--- a/jupyter_core/tests/test_command.py 2016-09-13 15:22:49.000000000 +0200 ++++ b/jupyter_core/tests/test_command.py 2017-10-23 12:49:27.489527705 +0200 +@@ -113,7 +113,10 @@ + witness = a.join(witness_cmd) + witness.write('#!%s\n%s\n' % (sys.executable, 'print("WITNESS ME")')) + witness.chmod(0o700) +- out = check_output([sys.executable, str(jupyter), 'witness'], env={'PATH': ''}) ++ out = check_output( ++ [sys.executable, str(jupyter), 'witness'], ++ env={'PATH': '', 'PYTHONPATH': os.environ['PYTHONPATH']} ++ ) + assert b'WITNESS' in out + + +@@ -136,5 +139,8 @@ + witness_b.write('#!%s\n%s\n' % (sys.executable, 'print("WITNESS B")')) + witness_b.chmod(0o700) + +- out = check_output([sys.executable, str(jupyter), 'witness'], env={'PATH': str(b)}) ++ out = check_output( ++ [sys.executable, str(jupyter), 'witness'], ++ env={'PATH': str(b), 'PYTHONPATH': os.environ['PYTHONPATH']} ++ ) + assert b'WITNESS A' in out diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 65210b2e055..d2a4d8e2424 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -10798,32 +10798,7 @@ in { jupyter_client = callPackage ../development/python-modules/jupyter_client { }; - jupyter_core = buildPythonPackage rec { - version = "4.3.0"; - name = "jupyter_core-${version}"; - - src = pkgs.fetchurl { - url = "mirror://pypi/j/jupyter_core/${name}.tar.gz"; - sha256 = "a96b129e1641425bf057c3d46f4f44adce747a7d60107e8ad771045c36514d40"; - }; - - buildInputs = with self; [ pytest mock ]; - propagatedBuildInputs = with self; [ ipython traitlets]; - - checkPhase = '' - py.test - ''; - - # Several tests fail due to being in a chroot - doCheck = false; - - meta = { - description = "Jupyter core package. A base package on which Jupyter projects rely"; - homepage = http://jupyter.org/; - license = licenses.bsd3; - maintainers = with maintainers; [ fridh ]; - }; - }; + jupyter_core = callPackage ../development/python-modules/jupyter_core { }; jsonpath_rw = buildPythonPackage rec { name = "jsonpath-rw-${version}"; From 817b7bb3491dc0931bd508a57fcca57c67121ac0 Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Mon, 23 Oct 2017 13:36:22 +0200 Subject: [PATCH 2/6] python.pkgs.nose_warnings_filters: init at 0.1.5 --- .../nose_warnings_filters/default.nix | 31 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 ++ 2 files changed, 33 insertions(+) create mode 100644 pkgs/development/python-modules/nose_warnings_filters/default.nix diff --git a/pkgs/development/python-modules/nose_warnings_filters/default.nix b/pkgs/development/python-modules/nose_warnings_filters/default.nix new file mode 100644 index 00000000000..db53a34a57f --- /dev/null +++ b/pkgs/development/python-modules/nose_warnings_filters/default.nix @@ -0,0 +1,31 @@ +{ lib +, buildPythonPackage +, fetchPypi +, isPy3k +, nose +}: + +buildPythonPackage rec { + pname = "nose_warnings_filters"; + version = "0.1.5"; + name = "${pname}-${version}"; + + src = fetchPypi { + inherit pname version; + sha256 = "17dvfqfy2fm7a5cmiffw2dc3064kpx72fn5mlw01skm2rhn5nv25"; + }; + + disabled = !isPy3k; + + propagatedBuildInputs = [ nose ]; + + checkPhase = '' + nosetests -v + ''; + + meta = { + description = "Allow injecting warning filters during nosetest"; + homepage = https://github.com/Carreau/nose_warnings_filters; + license = lib.licenses.mit; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index d2a4d8e2424..80bb80586dc 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -13124,6 +13124,8 @@ in { buildInputs = with self; [ nose ]; }; + nose_warnings_filters = callPackage ../development/python-modules/nose_warnings_filters { }; + notebook = callPackage ../development/python-modules/notebook { }; notify = pkgs.stdenv.mkDerivation (rec { From c581dbfab342e3aac00b7d69b5dfcfe08bcdc6f7 Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Mon, 23 Oct 2017 13:40:02 +0200 Subject: [PATCH 3/6] python.pkgs.notebook: 5.0.0 -> 5.2.0 --- .../python-modules/notebook/default.nix | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/pkgs/development/python-modules/notebook/default.nix b/pkgs/development/python-modules/notebook/default.nix index 3a24c5566bf..c30e6e5e77d 100644 --- a/pkgs/development/python-modules/notebook/default.nix +++ b/pkgs/development/python-modules/notebook/default.nix @@ -2,8 +2,9 @@ , buildPythonPackage , fetchPypi , nose +, nose_warnings_filters , glibcLocales -, isPy27 +, isPy3k , mock , jinja2 , tornado @@ -21,32 +22,39 @@ buildPythonPackage rec { pname = "notebook"; - version = "5.0.0"; + version = "5.2.0"; name = "${pname}-${version}"; src = fetchPypi { inherit pname version; - sha256 = "1cea3bbbd03c8e5842a1403347a8cc8134486b3ce081a2e5b1952a00ea66ed54"; + sha256 = "1sh3jkkmjzv17c3r8ii3kfhpxi6dkjk846b2lfy71g9qwqdcvbvz"; }; - LC_ALL = "en_US.UTF-8"; + LC_ALL = "en_US.utf8"; - buildInputs = [nose glibcLocales] ++ lib.optionals isPy27 [mock]; + buildInputs = [ nose glibcLocales ] + ++ (if isPy3k then [ nose_warnings_filters ] else [ mock ]); - propagatedBuildInputs = [jinja2 tornado ipython_genutils traitlets jupyter_core - jupyter_client nbformat nbconvert ipykernel terminado requests pexpect ]; + propagatedBuildInputs = [ + jinja2 tornado ipython_genutils traitlets jupyter_core + jupyter_client nbformat nbconvert ipykernel terminado requests pexpect + ]; + # disable warning_filters + preCheck = lib.optionalString (!isPy3k) '' + echo "" > setup.cfg + cat setup.cfg + ''; checkPhase = '' - nosetests -v + runHook preCheck + mkdir tmp + HOME=tmp nosetests -v ''; - # Certain tests fail due to being in a chroot. - # PermissionError - doCheck = false; meta = { description = "The Jupyter HTML notebook is a web-based notebook environment for interactive computing"; homepage = http://jupyter.org/; license = lib.licenses.bsd3; - maintainers = with lib.maintainers; [ fridh ]; + maintainers = with lib.maintainers; [ fridh globin ]; }; -} \ No newline at end of file +} From b10a98cee748aa6474451969144c073ab77ea2a7 Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Mon, 23 Oct 2017 13:49:03 +0200 Subject: [PATCH 4/6] python.pkgs.nbformat: enable tests --- pkgs/development/python-modules/nbformat/default.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkgs/development/python-modules/nbformat/default.nix b/pkgs/development/python-modules/nbformat/default.nix index 6f637bae891..71a140e5325 100644 --- a/pkgs/development/python-modules/nbformat/default.nix +++ b/pkgs/development/python-modules/nbformat/default.nix @@ -19,18 +19,21 @@ buildPythonPackage rec { inherit pname version; sha256 = "f7494ef0df60766b7cabe0a3651556345a963b74dbc16bc7c18479041170d402"; }; - LC_ALL="en_US.UTF-8"; + + LC_ALL="en_US.utf8"; checkInputs = [ pytest glibcLocales ]; propagatedBuildInputs = [ ipython_genutils traitlets testpath jsonschema jupyter_core ]; - # Failing tests and permission issues - doCheck = false; + preCheck = '' + mkdir tmp + export HOME=tmp + ''; meta = { description = "The Jupyter Notebook format"; homepage = http://jupyter.org/; license = lib.licenses.bsd3; - maintainers = with lib.maintainers; [ fridh ]; + maintainers = with lib.maintainers; [ fridh globin ]; }; } From 62ca1c2dab3ebec9dad25492f7274ea262fdbce0 Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Mon, 23 Oct 2017 14:54:17 +0200 Subject: [PATCH 5/6] mistune: 0.7.1 -> 0.7.4, own file --- .../python-modules/mistune/default.nix | 24 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 18 +------------- 2 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 pkgs/development/python-modules/mistune/default.nix diff --git a/pkgs/development/python-modules/mistune/default.nix b/pkgs/development/python-modules/mistune/default.nix new file mode 100644 index 00000000000..14aef5b00d1 --- /dev/null +++ b/pkgs/development/python-modules/mistune/default.nix @@ -0,0 +1,24 @@ +{ lib +, buildPythonPackage +, fetchPypi +, nose +}: + +buildPythonPackage rec { + pname = "mistune"; + version = "0.7.4"; + name = "${pname}-${version}"; + + src = fetchPypi { + inherit pname version; + sha256 = "0byj9jg9ly7karf5sb1aqcw7avaim9sxl8ws7yw7p1fibjgsy5w5"; + }; + + buildInputs = [ nose ]; + + meta = with lib; { + description = "The fastest markdown parser in pure Python"; + homepage = https://github.com/lepture/mistune; + license = licenses.bsd3; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 80bb80586dc..9653bb42a23 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -11875,23 +11875,7 @@ in { }; }; - mistune = buildPythonPackage rec { - version = "0.7.1"; - name = "mistune-${version}"; - - src = pkgs.fetchurl { - url = "mirror://pypi/m/mistune/${name}.tar.gz"; - sha256 = "6076dedf768348927d991f4371e5a799c6a0158b16091df08ee85ee231d929a7"; - }; - - buildInputs = with self; [nose]; - - meta = { - description = "The fastest markdown parser in pure Python"; - homepage = https://github.com/lepture/mistune; - license = licenses.bsd3; - }; - }; + mistune = callPackage ../development/python-modules/mistune { }; brotlipy = buildPythonPackage rec { name = "brotlipy-${version}"; From 54a83423f015fc4a8682d76fdc97c3cb16da11dc Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Mon, 23 Oct 2017 14:53:43 +0200 Subject: [PATCH 6/6] nbconvert: 5.2.1 -> 5.3.1, enable tests --- .../python-modules/nbconvert/default.nix | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/nbconvert/default.nix b/pkgs/development/python-modules/nbconvert/default.nix index 881895ba6ba..d04e5c5eccb 100644 --- a/pkgs/development/python-modules/nbconvert/default.nix +++ b/pkgs/development/python-modules/nbconvert/default.nix @@ -3,6 +3,7 @@ , fetchPypi , pytest , nose +, glibcLocales , entrypoints , bleach , mistune @@ -21,15 +22,15 @@ buildPythonPackage rec { pname = "nbconvert"; - version = "5.2.1"; + version = "5.3.1"; name = "${pname}-${version}"; src = fetchPypi { inherit pname version; - sha256 = "9ed68ec7fe90a8672b43795b29ea91cc75ea355c83debc83ebd12171521ec274"; + sha256 = "1f9dkvpx186xjm4xab0qbph588mncp4vqk3fmxrsnqs43mks9c8j"; }; - checkInputs = [ nose pytest ]; + checkInputs = [ nose pytest glibcLocales ]; propagatedBuildInputs = [ entrypoints bleach mistune jinja2 pygments traitlets testpath @@ -37,16 +38,14 @@ buildPythonPackage rec { ]; checkPhase = '' - nosetests -v + mkdir tmp + LC_ALL=en_US.utf8 HOME=`realpath tmp` py.test -v ''; - # PermissionError. Likely due to being in a chroot - doCheck = false; - meta = { description = "Converting Jupyter Notebooks"; homepage = http://jupyter.org/; license = lib.licenses.bsd3; - maintainers = with lib.maintainers; [ fridh ]; + maintainers = with lib.maintainers; [ fridh globin ]; }; }