From c8c0619b1635c25b87b60be5a55f15f98ad5aa87 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 5 May 2022 19:12:39 +0800 Subject: [PATCH] unbreak and install spyder --- final/configuration.nix | 10 +- final/flake.nix | 2 +- final/spyder/autopep8/default.nix | 31 ++++++ final/spyder/black/default.nix | 85 ++++++++++++++ final/spyder/default.nix | 23 ++++ final/spyder/ipykernel/4.nix | 41 +++++++ final/spyder/ipykernel/default.nix | 50 +++++++++ final/spyder/ipykernel/tests.nix | 57 ++++++++++ final/spyder/ipython/5.nix | 72 ++++++++++++ final/spyder/ipython/7.16.nix | 69 ++++++++++++ final/spyder/ipython/default.nix | 73 ++++++++++++ final/spyder/jupyter-client/5.nix | 40 +++++++ final/spyder/jupyter-client/default.nix | 43 ++++++++ final/spyder/python-lsp-black/default.nix | 32 ++++++ final/spyder/python-lsp-server/default.nix | 108 ++++++++++++++++++ final/spyder/qdarkstyle/default.nix | 29 +++++ final/spyder/qtconsole/default.nix | 38 +++++++ final/spyder/qtpy/default.nix | 27 +++++ final/spyder/spyder-kernels/default.nix | 32 ++++++ final/spyder/spyder/default.nix | 122 +++++++++++++++++++++ 20 files changed, 982 insertions(+), 2 deletions(-) create mode 100644 final/spyder/autopep8/default.nix create mode 100644 final/spyder/black/default.nix create mode 100644 final/spyder/default.nix create mode 100644 final/spyder/ipykernel/4.nix create mode 100644 final/spyder/ipykernel/default.nix create mode 100644 final/spyder/ipykernel/tests.nix create mode 100644 final/spyder/ipython/5.nix create mode 100644 final/spyder/ipython/7.16.nix create mode 100644 final/spyder/ipython/default.nix create mode 100644 final/spyder/jupyter-client/5.nix create mode 100644 final/spyder/jupyter-client/default.nix create mode 100644 final/spyder/python-lsp-black/default.nix create mode 100644 final/spyder/python-lsp-server/default.nix create mode 100644 final/spyder/qdarkstyle/default.nix create mode 100644 final/spyder/qtconsole/default.nix create mode 100644 final/spyder/qtpy/default.nix create mode 100644 final/spyder/spyder-kernels/default.nix create mode 100644 final/spyder/spyder/default.nix diff --git a/final/configuration.nix b/final/configuration.nix index 6c95984..ee85feb 100644 --- a/final/configuration.nix +++ b/final/configuration.nix @@ -46,7 +46,15 @@ imagemagick firefox chromium - (python3.withPackages(ps: with ps; [ numpy scipy matplotlib jupyter pyserial artiq.packages.x86_64-linux.artiq ])) + (python3.withPackages(ps: with ps; [ + numpy + scipy + matplotlib + jupyter + pyserial + spyder + artiq.packages.x86_64-linux.artiq + ])) artiq.packages.x86_64-linux.openocd-bscanspi texlive.combined.scheme-full psmisc diff --git a/final/flake.nix b/final/flake.nix index 813744d..fbae926 100644 --- a/final/flake.nix +++ b/final/flake.nix @@ -4,7 +4,7 @@ nixosConfigurations.artiq = artiq.inputs.nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { inherit artiq; }; - modules = [ ./configuration.nix ]; + modules = [ ./configuration.nix ./spyder ]; }; }; } diff --git a/final/spyder/autopep8/default.nix b/final/spyder/autopep8/default.nix new file mode 100644 index 0000000..abf3a3d --- /dev/null +++ b/final/spyder/autopep8/default.nix @@ -0,0 +1,31 @@ +{ lib, fetchPypi, buildPythonPackage, pycodestyle, glibcLocales +, toml +}: + +buildPythonPackage rec { + pname = "autopep8"; + version = "1.6.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256-RPCTKFUDnSwVxFENbfZl5HMPK4WCcE+kj5xVvT4X2Xk="; + }; + + propagatedBuildInputs = [ pycodestyle toml ]; + + # One test fails: + # FAIL: test_recursive_should_not_crash_on_unicode_filename (test.test_autopep8.CommandLineTests) +# doCheck = false; + + checkInputs = [ glibcLocales ]; + + LC_ALL = "en_US.UTF-8"; + + meta = with lib; { + description = "A tool that automatically formats Python code to conform to the PEP 8 style guide"; + homepage = "https://pypi.python.org/pypi/autopep8/"; + license = licenses.mit; + platforms = platforms.all; + maintainers = with maintainers; [ bjornfor ]; + }; +} diff --git a/final/spyder/black/default.nix b/final/spyder/black/default.nix new file mode 100644 index 0000000..a9811a2 --- /dev/null +++ b/final/spyder/black/default.nix @@ -0,0 +1,85 @@ +{ stdenv, lib +, buildPythonPackage, fetchPypi, pythonOlder, setuptools-scm, pytestCheckHook +, aiohttp +, aiohttp-cors +, attrs +, click +, colorama +, dataclasses +, mypy-extensions +, pathspec +, parameterized +, platformdirs +, regex +, tomli +, typed-ast +, typing-extensions +, uvloop +}: + + +buildPythonPackage rec { + pname = "black"; + version = "22.3.0"; + + disabled = pythonOlder "3.6"; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256-NQILiIbAIs7ZKCtRtah1ttGrDDh7MaBluE23wzCFynk="; + }; + + nativeBuildInputs = [ setuptools-scm ]; + + # Necessary for the tests to pass on Darwin with sandbox enabled. + # Black starts a local server and needs to bind a local address. + __darwinAllowLocalNetworking = true; + + checkInputs = [ pytestCheckHook parameterized ]; + + preCheck = '' + export PATH="$PATH:$out/bin" + + # The top directory /build matches black's DEFAULT_EXCLUDE regex. + # Make /build the project root for black tests to avoid excluding files. + touch ../.git + '' + lib.optionalString stdenv.isDarwin '' + # Work around https://github.com/psf/black/issues/2105 + export TMPDIR="/tmp" + ''; + + disabledTests = [ + # requires network access + "test_gen_check_output" + ] ++ lib.optionals stdenv.isDarwin [ + # fails on darwin + "test_expression_diff" + # Fail on Hydra, see https://github.com/NixOS/nixpkgs/pull/130785 + "test_bpo_2142_workaround" + "test_skip_magic_trailing_comma" + ]; + + propagatedBuildInputs = [ + aiohttp + aiohttp-cors + attrs + click + colorama + mypy-extensions + pathspec + platformdirs + regex + tomli + typed-ast # required for tests and python2 extra + uvloop + ] ++ lib.optional (pythonOlder "3.7") dataclasses + ++ lib.optional (pythonOlder "3.8") typing-extensions; + + meta = with lib; { + description = "The uncompromising Python code formatter"; + homepage = "https://github.com/psf/black"; + changelog = "https://github.com/psf/black/blob/${version}/CHANGES.md"; + license = licenses.mit; + maintainers = with maintainers; [ sveitser autophagy ]; + }; +} diff --git a/final/spyder/default.nix b/final/spyder/default.nix new file mode 100644 index 0000000..9c438aa --- /dev/null +++ b/final/spyder/default.nix @@ -0,0 +1,23 @@ +{ config, pkgs, ... }: +{ + # https://github.com/NixOS/nixpkgs/issues/171613 + nixpkgs.overlays = [ (self: super: rec { + python3 = super.python3.override { + packageOverrides = pyself: pysuper: { + autopep8 = pysuper.pkgs.python3Packages.callPackage ./autopep8 {}; + black = pysuper.pkgs.python3Packages.callPackage ./black {}; + ipykernel = pysuper.pkgs.python3Packages.callPackage ./ipykernel {}; + ipython = pysuper.pkgs.python3Packages.callPackage ./ipython {}; + jupyter-client = pysuper.pkgs.python3Packages.callPackage ./jupyter-client {}; + python-lsp-black = pysuper.pkgs.python3Packages.callPackage ./python-lsp-black {}; + python-lsp-server = pysuper.pkgs.python3Packages.callPackage ./python-lsp-server {}; + qdarkstyle = pysuper.pkgs.python3Packages.callPackage ./qdarkstyle {}; + qtconsole = pysuper.pkgs.python3Packages.callPackage ./qtconsole {}; + qtpy = pysuper.pkgs.python3Packages.callPackage ./qtpy {}; + spyder-kernels = pysuper.pkgs.python3Packages.callPackage ./spyder-kernels {}; + spyder = pysuper.pkgs.python3Packages.callPackage ./spyder {}; + }; + }; + python3Packages = python3.pkgs; + }) ]; +} diff --git a/final/spyder/ipykernel/4.nix b/final/spyder/ipykernel/4.nix new file mode 100644 index 0000000..7530b55 --- /dev/null +++ b/final/spyder/ipykernel/4.nix @@ -0,0 +1,41 @@ +{ lib +, buildPythonPackage +, fetchPypi +, nose +, isPy27 +, mock +, ipython +, jupyter-client +, pexpect +, traitlets +, tornado +}: + +buildPythonPackage rec { + pname = "ipykernel"; + version = "4.10.1"; + + src = fetchPypi { + inherit pname version; + sha256 = "eeb74b2bcfe0ced5a7900361f98fa1171288aa47ed4b522efe5acb167c6cf5fb"; + }; + + checkInputs = [ nose ] ++ lib.optional isPy27 mock; + propagatedBuildInputs = [ + ipython + jupyter-client + pexpect + traitlets + tornado + ]; + + # Tests require backends. + # I don't want to add all supported backends as propagatedBuildInputs + doCheck = false; + + meta = { + description = "IPython Kernel for Jupyter"; + homepage = "http://ipython.org/"; + license = lib.licenses.bsd3; + }; +} diff --git a/final/spyder/ipykernel/default.nix b/final/spyder/ipykernel/default.nix new file mode 100644 index 0000000..fc4f49c --- /dev/null +++ b/final/spyder/ipykernel/default.nix @@ -0,0 +1,50 @@ +{ lib +, buildPythonPackage +, callPackage +, fetchPypi +, pythonOlder +, argcomplete +, debugpy +, ipython +, jupyter-client +, tornado +, traitlets +, psutil +, packaging +}: + +buildPythonPackage rec { + pname = "ipykernel"; + version = "6.13.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256-DignPikIWDk+huFSsQTlUGp5wT0luVGsbsoiAFG0vmA="; + }; + + propagatedBuildInputs = [ + debugpy + ipython + jupyter-client + tornado + traitlets + psutil + packaging + ] ++ lib.optionals (pythonOlder "3.8") [ + argcomplete + ]; + + # check in passthru.tests.pytest to escape infinite recursion with ipyparallel + doCheck = false; + + passthru.tests = { + pytest = callPackage ./tests.nix { }; + }; + + meta = { + description = "IPython Kernel for Jupyter"; + homepage = "http://ipython.org/"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ fridh ]; + }; +} diff --git a/final/spyder/ipykernel/tests.nix b/final/spyder/ipykernel/tests.nix new file mode 100644 index 0000000..9375dbc --- /dev/null +++ b/final/spyder/ipykernel/tests.nix @@ -0,0 +1,57 @@ +{ lib +, stdenv +, buildPythonPackage +, pythonOlder +, flaky +, ipykernel +, ipyparallel +, nose +, pytestCheckHook + +}: + +buildPythonPackage rec { + pname = "ipykernel-tests"; + inherit (ipykernel) version; + + src = ipykernel.src; + + dontBuild = true; + dontInstall = true; + + checkInputs = [ + flaky + ipykernel + ipyparallel + nose + pytestCheckHook + ]; + + preCheck = '' + export HOME=$(mktemp -d) + ''; + + disabledTests = lib.optionals stdenv.isDarwin ([ + # see https://github.com/NixOS/nixpkgs/issues/76197 + "test_subprocess_print" + "test_subprocess_error" + "test_ipython_start_kernel_no_userns" + + # https://github.com/ipython/ipykernel/issues/506 + "test_unc_paths" + ] ++ lib.optionals (pythonOlder "3.8") [ + # flaky test https://github.com/ipython/ipykernel/issues/485 + "test_shutdown" + + # test regression https://github.com/ipython/ipykernel/issues/486 + "test_sys_path_profile_dir" + "test_save_history" + "test_help_output" + "test_write_kernel_spec" + "test_ipython_start_kernel_userns" + "ZMQDisplayPublisherTests" + ]); + + # Some of the tests use localhost networking. + __darwinAllowLocalNetworking = true; +} diff --git a/final/spyder/ipython/5.nix b/final/spyder/ipython/5.nix new file mode 100644 index 0000000..45096bf --- /dev/null +++ b/final/spyder/ipython/5.nix @@ -0,0 +1,72 @@ +{ lib +, stdenv +, buildPythonPackage +, fetchPypi +, fetchpatch +# Build dependencies +, glibcLocales +# Test dependencies +, nose +, pygments +, testpath +, isPy27 +, mock +# Runtime dependencies +, backports_shutil_get_terminal_size +, decorator +, pathlib2 +, pickleshare +, requests +, simplegeneric +, traitlets +, prompt-toolkit +, pexpect +, appnope +}: + +buildPythonPackage rec { + pname = "ipython"; + version = "5.8.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "4bac649857611baaaf76bc82c173aa542f7486446c335fe1a6c05d0d491c8906"; + }; + + prePatch = lib.optionalString stdenv.isDarwin '' + substituteInPlace setup.py --replace "'gnureadline'" " " + ''; + + patches = [ + # Use the proper pygments lexer for python2 (https://github.com/ipython/ipython/pull/12095) + (fetchpatch { + name = "python2-lexer.patch"; + url = "https://github.com/ipython/ipython/pull/12095/commits/8805293b5e4bce9150cc2ad9c5d6d984849ae447.patch"; + sha256 = "16p4gl7a49v76w33j39ih7yspy6x2d14p9bh4wdpg9cafhw9nbc0"; + }) + ]; + + buildInputs = [ glibcLocales ]; + + checkInputs = [ nose pygments testpath ] ++ lib.optional isPy27 mock; + + propagatedBuildInputs = [ + backports_shutil_get_terminal_size decorator pickleshare prompt-toolkit + simplegeneric traitlets requests pathlib2 pexpect + ] ++ lib.optionals stdenv.isDarwin [ appnope ]; + + LC_ALL="en_US.UTF-8"; + + doCheck = false; # Circular dependency with ipykernel + + checkPhase = '' + nosetests + ''; + + meta = { + description = "IPython: Productive Interactive Computing"; + homepage = "http://ipython.org/"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ bjornfor orivej lnl7 ]; + }; +} diff --git a/final/spyder/ipython/7.16.nix b/final/spyder/ipython/7.16.nix new file mode 100644 index 0000000..1f62cc9 --- /dev/null +++ b/final/spyder/ipython/7.16.nix @@ -0,0 +1,69 @@ +{ lib +, stdenv +, buildPythonPackage +, fetchPypi +, pythonOlder +# Build dependencies +, glibcLocales +# Test dependencies +, nose +, pygments +# Runtime dependencies +, jedi +, decorator +, pickleshare +, traitlets +, prompt-toolkit +, pexpect +, appnope +, backcall +}: + +buildPythonPackage rec { + pname = "ipython"; + version = "7.16.1"; + disabled = pythonOlder "3.6"; + + src = fetchPypi { + inherit pname version; + sha256 = "9f4fcb31d3b2c533333893b9172264e4821c1ac91839500f31bd43f2c59b3ccf"; + }; + + prePatch = lib.optionalString stdenv.isDarwin '' + substituteInPlace setup.py --replace "'gnureadline'" " " + ''; + + buildInputs = [ glibcLocales ]; + + checkInputs = [ nose pygments ]; + + propagatedBuildInputs = [ + jedi + decorator + pickleshare + traitlets + prompt-toolkit + pygments + pexpect + backcall + ] ++ lib.optionals stdenv.isDarwin [appnope]; + + LC_ALL="en_US.UTF-8"; + + doCheck = false; # Circular dependency with ipykernel + + checkPhase = '' + nosetests + ''; + + pythonImportsCheck = [ + "IPython" + ]; + + meta = with lib; { + description = "IPython: Productive Interactive Computing"; + homepage = "http://ipython.org/"; + license = licenses.bsd3; + maintainers = with maintainers; [ bjornfor fridh ]; + }; +} diff --git a/final/spyder/ipython/default.nix b/final/spyder/ipython/default.nix new file mode 100644 index 0000000..4342d6c --- /dev/null +++ b/final/spyder/ipython/default.nix @@ -0,0 +1,73 @@ +{ lib +, stdenv +, buildPythonPackage +, fetchPypi +, fetchpatch +, pythonOlder +# Build dependencies +, glibcLocales +# Test dependencies +, nose +, pygments +# Runtime dependencies +, jedi +, decorator +, matplotlib-inline +, pickleshare +, traitlets +, prompt-toolkit +, pexpect +, appnope +, backcall +, pytest +}: + +buildPythonPackage rec { + pname = "ipython"; + version = "7.33.0"; + disabled = pythonOlder "3.7"; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256-vP+4Zag7CBYgMBug7E2VCERU8muR1tZrR1v/PfsCGNQ="; + }; + + prePatch = lib.optionalString stdenv.isDarwin '' + substituteInPlace setup.py --replace "'gnureadline'" " " + ''; + + buildInputs = [ glibcLocales ]; + + propagatedBuildInputs = [ + jedi + decorator + matplotlib-inline + pickleshare + traitlets + prompt-toolkit + pygments + pexpect + backcall + ] ++ lib.optionals stdenv.isDarwin [appnope]; + + LC_ALL="en_US.UTF-8"; + + # full tests normally disabled due to a circular dependency with + # ipykernel, but we want to test the CVE-2022-21699 fix in this + # branch + checkInputs = [ pytest ]; + checkPhase = '' + pytest IPython/tests/cve.py + ''; + + pythonImportsCheck = [ + "IPython" + ]; + + meta = with lib; { + description = "IPython: Productive Interactive Computing"; + homepage = "http://ipython.org/"; + license = licenses.bsd3; + maintainers = with maintainers; [ bjornfor fridh ]; + }; +} diff --git a/final/spyder/jupyter-client/5.nix b/final/spyder/jupyter-client/5.nix new file mode 100644 index 0000000..0894744 --- /dev/null +++ b/final/spyder/jupyter-client/5.nix @@ -0,0 +1,40 @@ +{ lib +, buildPythonPackage +, fetchPypi +, traitlets +, jupyter_core +, pyzmq +, python-dateutil +, isPyPy +, py +, tornado +}: + +buildPythonPackage rec { + pname = "jupyter-client"; + version = "5.3.5"; + + src = fetchPypi { + pname = "jupyter_client"; + inherit version; + sha256 = "5efdf4131124d4a0d5789101e74827022585f172d2f4b60cf6fa98e0a7511b25"; + }; + + propagatedBuildInputs = [ + traitlets + jupyter_core + pyzmq + python-dateutil + tornado + ] ++ lib.optional isPyPy py; + + # Circular dependency with ipykernel + doCheck = false; + + meta = { + description = "Jupyter protocol implementation and client libraries"; + homepage = "https://jupyter.org/"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ ]; + }; +} diff --git a/final/spyder/jupyter-client/default.nix b/final/spyder/jupyter-client/default.nix new file mode 100644 index 0000000..e15d3b8 --- /dev/null +++ b/final/spyder/jupyter-client/default.nix @@ -0,0 +1,43 @@ +{ lib +, buildPythonPackage +, fetchPypi +, entrypoints +, jupyter_core +, nest-asyncio +, python-dateutil +, pyzmq +, tornado +, traitlets +, isPyPy +, py +}: + +buildPythonPackage rec { + pname = "jupyter_client"; + version = "7.1.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256-pfmVpzz/sxTtJicTrm385TxrghbOqfMyBxuP9EpuFlQ="; + }; + + propagatedBuildInputs = [ + entrypoints + jupyter_core + nest-asyncio + python-dateutil + pyzmq + tornado + traitlets + ] ++ lib.optional isPyPy py; + + # Circular dependency with ipykernel + doCheck = false; + + meta = { + description = "Jupyter protocol implementation and client libraries"; + homepage = "https://jupyter.org/"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ fridh ]; + }; +} diff --git a/final/spyder/python-lsp-black/default.nix b/final/spyder/python-lsp-black/default.nix new file mode 100644 index 0000000..d1d3c1d --- /dev/null +++ b/final/spyder/python-lsp-black/default.nix @@ -0,0 +1,32 @@ +{ lib +, black +, buildPythonPackage +, fetchFromGitHub +, pytestCheckHook +, python-lsp-server +, pythonOlder +}: + +buildPythonPackage rec { + pname = "python-lsp-black"; + version = "1.2.1"; + disabled = pythonOlder "3.6"; + + src = fetchFromGitHub { + owner = "python-lsp"; + repo = "python-lsp-black"; + rev = "v${version}"; + sha256 = "sha256-qNA6Bj1VI0YEtRuvcMQZGWakQNNrJ2PqhozrLmQHPAg="; + }; + + checkInputs = [ pytestCheckHook ]; + + propagatedBuildInputs = [ black python-lsp-server ]; + + meta = with lib; { + homepage = "https://github.com/python-lsp/python-lsp-black"; + description = "Black plugin for the Python LSP Server"; + license = licenses.mit; + maintainers = with maintainers; [ cpcloud ]; + }; +} diff --git a/final/spyder/python-lsp-server/default.nix b/final/spyder/python-lsp-server/default.nix new file mode 100644 index 0000000..ce8c7da --- /dev/null +++ b/final/spyder/python-lsp-server/default.nix @@ -0,0 +1,108 @@ +{ lib +, autopep8 +, buildPythonPackage +, fetchPypi +, flake8 +, flaky +, jedi +, matplotlib +, mccabe +, numpy +, pandas +, pluggy +, pycodestyle +, pydocstyle +, pyflakes +, pylint +, pyqt5 +, pytestCheckHook +, python-lsp-jsonrpc +, pythonOlder +, rope +, setuptools +, setuptools_scm +, ujson +, yapf +, withAutopep8 ? true +, withFlake8 ? true +, withMccabe ? true +, withPycodestyle ? true +, withPydocstyle ? true +, withPyflakes ? true +, withPylint ? true +, withRope ? true +, withYapf ? true +}: + +buildPythonPackage rec { + pname = "python-lsp-server"; + version = "1.4.1"; + disabled = pythonOlder "3.6"; + + src = fetchPypi { + pname = "python-lsp-server"; + inherit version; + sha256 = "sha256-vn+DKYr58JUak5csr8nbBP189cBfIIElFSdfC6cONC8="; + }; + + postPatch = '' + substituteInPlace setup.cfg \ + --replace "--cov-report html --cov-report term --junitxml=pytest.xml" "" \ + --replace "--cov pylsp --cov test" "" + ''; + + propagatedBuildInputs = [ + jedi + pluggy + python-lsp-jsonrpc + setuptools + setuptools_scm + ujson + ] ++ lib.optional withAutopep8 autopep8 + ++ lib.optional withFlake8 flake8 + ++ lib.optional withMccabe mccabe + ++ lib.optional withPycodestyle pycodestyle + ++ lib.optional withPydocstyle pydocstyle + ++ lib.optional withPyflakes pyflakes + ++ lib.optional withPylint pylint + ++ lib.optional withRope rope + ++ lib.optional withYapf yapf; + + checkInputs = [ + flaky + matplotlib + numpy + pandas + pyqt5 + pytestCheckHook + ]; + + disabledTests = [ + # pytlint output changed + "test_lint_free_pylint" + ] ++ lib.optional (!withPycodestyle) "test_workspace_loads_pycodestyle_config"; + + disabledTestPaths = lib.optional (!withAutopep8) "test/plugins/test_autopep8_format.py" + ++ lib.optional (!withRope) "test/plugins/test_completion.py" + ++ lib.optional (!withFlake8) "test/plugins/test_flake8_lint.py" + ++ lib.optional (!withMccabe) "test/plugins/test_mccabe_lint.py" + ++ lib.optional (!withPycodestyle) "test/plugins/test_pycodestyle_lint.py" + ++ lib.optional (!withPydocstyle) "test/plugins/test_pydocstyle_lint.py" + ++ lib.optional (!withPyflakes) "test/plugins/test_pyflakes_lint.py" + ++ lib.optional (!withPylint) "test/plugins/test_pylint_lint.py" + ++ lib.optional (!withRope) "test/plugins/test_rope_rename.py" + ++ lib.optional (!withYapf) "test/plugins/test_yapf_format.py"; + + preCheck = '' + export HOME=$(mktemp -d); + ''; + + pythonImportsCheck = [ "pylsp" ]; + + meta = with lib; { + description = "Python implementation of the Language Server Protocol"; + homepage = "https://github.com/python-lsp/python-lsp-server"; + license = licenses.mit; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/final/spyder/qdarkstyle/default.nix b/final/spyder/qdarkstyle/default.nix new file mode 100644 index 0000000..cab81bc --- /dev/null +++ b/final/spyder/qdarkstyle/default.nix @@ -0,0 +1,29 @@ +{ lib +, fetchPypi +, buildPythonPackage +, helpdev +, qtpy +}: + +buildPythonPackage rec { + pname = "qdarkstyle"; + version = "3.0.3"; + + src = fetchPypi { + inherit version; + pname = "QDarkStyle"; + sha256 = "sha256-k20tNbVS9CmAOphdvBf8h5ovlm+qn7+Jg4lsz6M+aPY="; + }; + + # No tests available + doCheck = false; + + propagatedBuildInputs = [ helpdev qtpy ]; + + meta = with lib; { + description = "A dark stylesheet for Python and Qt applications"; + homepage = "https://github.com/ColinDuquesnoy/QDarkStyleSheet"; + license = licenses.mit; + maintainers = with maintainers; [ nyanloutre ]; + }; +} diff --git a/final/spyder/qtconsole/default.nix b/final/spyder/qtconsole/default.nix new file mode 100644 index 0000000..f9eecbe --- /dev/null +++ b/final/spyder/qtconsole/default.nix @@ -0,0 +1,38 @@ +{ lib +, buildPythonPackage +, fetchPypi +, nose +, isPy27 +, mock +, traitlets +, jupyter_core +, jupyter-client +, pygments +, ipykernel +, pyqt5 +, qtpy +}: + +buildPythonPackage rec { + pname = "qtconsole"; + version = "5.3.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256-jjUg/cdeRqvEzGz/7KFvomUnVBCbiug5+ijifR66ViU="; + }; + + checkInputs = [ nose ] ++ lib.optionals isPy27 [mock]; + propagatedBuildInputs = [traitlets jupyter_core jupyter-client pygments ipykernel pyqt5 qtpy]; + + # : cannot connect to X server + doCheck = false; + + meta = { + description = "Jupyter Qt console"; + homepage = "https://jupyter.org/"; + license = lib.licenses.bsd3; + platforms = lib.platforms.unix; + maintainers = with lib.maintainers; [ fridh ]; + }; +} diff --git a/final/spyder/qtpy/default.nix b/final/spyder/qtpy/default.nix new file mode 100644 index 0000000..9c78701 --- /dev/null +++ b/final/spyder/qtpy/default.nix @@ -0,0 +1,27 @@ +{ lib, buildPythonPackage, fetchPypi, pyside, pytest, packaging }: + +buildPythonPackage rec { + pname = "QtPy"; + version = "2.1.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256-yozUIXF1GGNEKZ7kwPfnrc82LHCFK6NbJVpTQHcCXAY="; + }; + + propagatedBuildInputs = [ packaging ]; + + # no concrete propagatedBuildInputs as multiple backends are supposed + checkInputs = [ pyside pytest ]; + + doCheck = false; # require X + checkPhase = '' + py.test qtpy/tests + ''; + + meta = with lib; { + description = "Abstraction layer for PyQt5/PyQt4/PySide2/PySide"; + homepage = "https://github.com/spyder-ide/qtpy"; + license = licenses.mit; + }; +} diff --git a/final/spyder/spyder-kernels/default.nix b/final/spyder/spyder-kernels/default.nix new file mode 100644 index 0000000..95d54e4 --- /dev/null +++ b/final/spyder/spyder-kernels/default.nix @@ -0,0 +1,32 @@ +{ lib, buildPythonPackage, fetchPypi, cloudpickle, ipykernel, wurlitzer, + jupyter-client, pyzmq }: + +buildPythonPackage rec { + pname = "spyder-kernels"; + version = "2.3.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256-pdU20Oil53TX1hbBAqj6LWqkX9MwoLeZuY7vFYNW02w="; + }; + + propagatedBuildInputs = [ + cloudpickle + ipykernel + wurlitzer + jupyter-client + pyzmq + ]; + + # No tests + doCheck = false; + + meta = with lib; { + description = "Jupyter kernels for Spyder's console"; + homepage = "https://docs.spyder-ide.org/current/ipythonconsole.html"; + downloadPage = "https://github.com/spyder-ide/spyder-kernels/releases"; + changelog = "https://github.com/spyder-ide/spyder-kernels/blob/master/CHANGELOG.md"; + license = licenses.mit; + maintainers = with maintainers; [ gebner ]; + }; +} diff --git a/final/spyder/spyder/default.nix b/final/spyder/spyder/default.nix new file mode 100644 index 0000000..8943139 --- /dev/null +++ b/final/spyder/spyder/default.nix @@ -0,0 +1,122 @@ +{ lib, buildPythonPackage, fetchPypi, isPy27, makeDesktopItem, intervaltree, + jedi, pycodestyle, psutil, rope, numpy, scipy, matplotlib, pylint, + keyring, numpydoc, qtconsole, qtawesome, nbconvert, mccabe, pyopengl, + cloudpickle, pygments, spyder-kernels, qtpy, pyzmq, chardet, qdarkstyle, + watchdog, python-lsp-server, pyqtwebengine, atomicwrites, pyxdg, + diff-match-patch, three-merge, python-lsp-black, pyls-spyder, flake8, textdistance, + cookiecutter, libspatialindex, fetchFromGitHub, pbr, inflection, tinycss2, jellyfish, + autopep8 +}: + +buildPythonPackage rec { + pname = "spyder"; + version = "5.3.0"; + + disabled = isPy27; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256-ggCFvYUdUm5fVSpTZoN/OhNPJAQOyehwrQprYTzprbc="; + }; + + nativeBuildInputs = [ pyqtwebengine.wrapQtAppsHook ]; + + propagatedBuildInputs = [ + intervaltree jedi pycodestyle psutil rope numpy scipy matplotlib pylint keyring + numpydoc qtconsole qtawesome nbconvert mccabe pyopengl cloudpickle spyder-kernels + pygments qtpy pyzmq chardet pyqtwebengine qdarkstyle watchdog python-lsp-server + atomicwrites pyxdg diff-match-patch three-merge python-lsp-black pyls-spyder + flake8 textdistance cookiecutter jellyfish autopep8 + ( + buildPythonPackage rec { + pname = "Rtree"; + version = "1.0.0"; + propagatedBuildInputs = [ numpy ]; + src = fetchPypi { + inherit pname version; + sha256 = "sha256-0Eg0ghITRrCTuaQlGNQPkhrfRFkVt66jB+smdoyDloI="; + }; + doCheck = false; + patchPhase = + '' + substituteInPlace rtree/finder.py --replace "_candidates = [" "_candidates = ['${libspatialindex}/lib'," + ''; + } + ) + ( + buildPythonPackage rec { + pname = "qstylizer"; + version = "0.2.1"; + propagatedBuildInputs = [ pbr inflection tinycss2 ]; + src = fetchFromGitHub { + owner = "blambright"; + repo = "qstylizer"; + rev = version; + sha256 = "sha256-iEMxBpS9gOPubd9O8zpVmR5B7+UZJFkPuOtikO1a9v0="; + }; + preBuild = '' + export PBR_VERSION=${version} + ''; + doCheck = false; + } + ) + ]; + + # There is no test for spyder + doCheck = false; + + desktopItem = makeDesktopItem { + name = "Spyder"; + exec = "spyder"; + icon = "spyder"; + comment = "Scientific Python Development Environment"; + desktopName = "Spyder"; + genericName = "Python IDE"; + categories = "Development;IDE;"; + }; + + postPatch = '' + # remove dependency on pyqtwebengine + # this is still part of the pyqt 5.11 version we have in nixpkgs + sed -i /pyqtwebengine/d setup.py + # The major version bump in watchdog is due to changes in supported + # platforms, not API break. + # https://github.com/gorakhargosh/watchdog/issues/761#issuecomment-777001518 + substituteInPlace setup.py \ + --replace "pyqt5<5.13" "pyqt5" \ + --replace "parso==0.7.0" "parso" \ + --replace "watchdog>=0.10.3,<2.0.0" "watchdog>=0.10.3,<3.0.0" + ''; + + postInstall = '' + # add Python libs to env so Spyder subprocesses + # created to run compute kernels don't fail with ImportErrors + wrapProgram $out/bin/spyder --prefix PYTHONPATH : "$PYTHONPATH" + + # Create desktop item + mkdir -p $out/share/icons + cp spyder/images/spyder.svg $out/share/icons + cp -r $desktopItem/share/applications/ $out/share + ''; + + dontWrapQtApps = true; + + preFixup = '' + makeWrapperArgs+=("''${qtWrapperArgs[@]}") + ''; + + meta = with lib; { + description = "Scientific python development environment"; + longDescription = '' + Spyder (previously known as Pydee) is a powerful interactive development + environment for the Python language with advanced editing, interactive + testing, debugging and introspection features. + ''; + homepage = "https://www.spyder-ide.org/"; + downloadPage = "https://github.com/spyder-ide/spyder/releases"; + changelog = "https://github.com/spyder-ide/spyder/blob/master/CHANGELOG.md"; + license = licenses.mit; + platforms = platforms.linux; + maintainers = with maintainers; [ gebner ]; + }; +}