nixpkgs/pkgs/development/python-modules/jupyter-server/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

135 lines
2.8 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
fetchPypi,
pythonOlder,
hatch-jupyter-builder,
hatchling,
pytestCheckHook,
pytest-console-scripts,
pytest-jupyter,
pytest-timeout,
argon2-cffi,
jinja2,
tornado,
pyzmq,
ipykernel,
traitlets,
jupyter-core,
jupyter-client,
jupyter-events,
jupyter-server-terminals,
nbformat,
nbconvert,
packaging,
send2trash,
terminado,
prometheus-client,
anyio,
websocket-client,
overrides,
requests,
flaky,
}:
buildPythonPackage rec {
pname = "jupyter-server";
version = "2.14.2";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchPypi {
pname = "jupyter_server";
inherit version;
hash = "sha256-ZglQIaqWOM7SdsJIsdgYYuTFDyktV1kgu+lg3hxWsSs=";
};
nativeBuildInputs = [
hatch-jupyter-builder
hatchling
];
propagatedBuildInputs = [
argon2-cffi
jinja2
tornado
pyzmq
traitlets
jupyter-core
jupyter-client
jupyter-events
jupyter-server-terminals
nbformat
nbconvert
packaging
send2trash
terminado
prometheus-client
anyio
websocket-client
overrides
];
# https://github.com/NixOS/nixpkgs/issues/299427
stripExclude = lib.optionals stdenv.hostPlatform.isDarwin [ "favicon.ico" ];
nativeCheckInputs = [
ipykernel
pytestCheckHook
pytest-console-scripts
pytest-jupyter
pytest-timeout
requests
flaky
];
pytestFlagsArray = [
"-W"
"ignore::DeprecationWarning"
];
preCheck = ''
export HOME=$(mktemp -d)
export PATH=$out/bin:$PATH
'';
disabledTests =
[
"test_cull_idle"
"test_server_extension_list"
"test_subscribe_websocket"
# test is presumable broken in sandbox
"test_authorized_requests"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# attempts to use trashcan, build env doesn't allow this
"test_delete"
# Insufficient access privileges for operation
"test_regression_is_hidden"
]
++ lib.optionals stdenv.hostPlatform.isLinux [
# Failed: DID NOT RAISE <class 'tornado.web.HTTPError'>
"test_copy_big_dir"
];
disabledTestPaths = [
"tests/services/kernels/test_api.py"
"tests/services/sessions/test_api.py"
# nbconvert failed: `relax_add_props` kwargs of validate has been
# deprecated for security reasons, and will be removed soon.
"tests/nbconvert/test_handlers.py"
];
__darwinAllowLocalNetworking = true;
meta = with lib; {
changelog = "https://github.com/jupyter-server/jupyter_server/blob/v${version}/CHANGELOG.md";
description = "Backendi.e. core services, APIs, and REST endpointsto Jupyter web applications";
mainProgram = "jupyter-server";
homepage = "https://github.com/jupyter-server/jupyter_server";
license = licenses.bsdOriginal;
maintainers = lib.teams.jupyter.members;
};
}