Unverified Commit f02066c5 authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

python3Packages.swh-*: init (#315400)

parents f62cbf67 f4158862
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
{
  python3Packages,
  writeShellApplication,
  withSwhPythonPackages ? [
    python3Packages.swh-auth
    python3Packages.swh-model
    python3Packages.swh-scanner
    python3Packages.swh-web-client
  ],
}:

let
  python3' = python3Packages.python.withPackages (ps: with ps; [ swh-core ] ++ withSwhPythonPackages);
in
writeShellApplication {
  name = "swh";
  text = ''
    ${python3'}/bin/swh "$@"
  '';
  meta = {
    inherit (python3Packages.swh-core.meta) license mainProgram platforms;
    description = "Software Heritage command-line client";
  };
}
+42 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchPypi,
  attrs,
  setuptools,
  setuptools-scm,
}:

buildPythonPackage rec {
  pname = "attrs-strict";
  version = "1.0.1";
  pyproject = true;

  src = fetchPypi {
    inherit version;
    pname = "attrs_strict";
    hash = "sha256-5wSGNiAUbF8qi2Ac1FdNFIkT2yb8Bjb5Qf5CEuQl6v4=";
  };

  build-system = [
    setuptools
    setuptools-scm
  ];

  dependencies = [
    attrs
  ];

  pythonImportsCheck = [ "attrs_strict" ];

  # No tests in the pypi archive
  doCheck = false;

  meta = {
    changelog = "https://github.com/bloomberg/attrs-strict/releases/tag/${version}";
    description = "Python package which contains runtime validation for attrs data classes based on the types existing in the typing module";
    homepage = "https://github.com/bloomberg/attrs-strict";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ drupol ];
  };
}
+8 −5
Original line number Diff line number Diff line
@@ -51,8 +51,11 @@ buildPythonPackage rec {
  # > ps: vsz: requires entitlement
  # > ps: rss: requires entitlement
  # > ps: time: requires entitlement
  disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
  disabledTests =
    [
      "test_forgotten_stop"
    ]
    ++ lib.optionals stdenv.hostPlatform.isDarwin [
      "test_mirakuru_cleanup"
      "test_daemons_killing"
    ];
+66 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitLab,
  setuptools,
  setuptools-scm,
  click,
  python-keycloak,
  python-jose,
  pyyaml,
  swh-core,
  aiocache,
  httpx,
  pytestCheckHook,
  pytest-django,
  pytest-mock,
  djangorestframework,
  starlette,
}:

buildPythonPackage rec {
  pname = "swh-auth";
  version = "0.10.0";
  pyproject = true;

  src = fetchFromGitLab {
    domain = "gitlab.softwareheritage.org";
    group = "swh";
    owner = "devel";
    repo = "swh-auth";
    tag = "v${version}";
    hash = "sha256-8ctd5D7zT66oVNZlvRIs8pN7Fe2BhTgC+S9p1HBDO9E=";
  };

  build-system = [
    setuptools
    setuptools-scm
  ];

  dependencies = [
    click
    python-keycloak
    python-jose
    pyyaml
    swh-core
  ];

  pythonImportsCheck = [ "swh.auth" ];

  nativeCheckInputs = [
    aiocache
    djangorestframework
    httpx
    pytestCheckHook
    pytest-django
    pytest-mock
    starlette
  ];

  meta = {
    description = "Set of utility libraries related to user authentication in applications and services based on the use of Keycloak and OpenID Connect";
    homepage = "https://gitlab.softwareheritage.org/swh/devel/swh-auth";
    license = lib.licenses.gpl3Only;
    maintainers = with lib.maintainers; [ drupol ];
  };
}
+127 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitLab,
  backports-entry-points-selectable,
  click,
  deprecated,
  python-magic,
  pyyaml,
  requests,
  sentry-sdk_2,
  tenacity,
  setuptools,
  setuptools-scm,
  flask,
  hypothesis,
  iso8601,
  lzip,
  msgpack,
  psycopg,
  pylzma,
  pytestCheckHook,
  pytest-aiohttp,
  pytest-mock,
  pytest-postgresql,
  pytz,
  requests-mock,
  types-deprecated,
  types-psycopg2,
  types-pytz,
  types-pyyaml,
  types-requests,
  unzip,
  pkgs, # Only for pkgs.zstd
}:

buildPythonPackage rec {
  pname = "swh-core";
  version = "4.0.0";
  pyproject = true;

  src = fetchFromGitLab {
    domain = "gitlab.softwareheritage.org";
    group = "swh";
    owner = "devel";
    repo = "swh-core";
    tag = "v${version}";
    hash = "sha256-kO4B25+oQrQ9sxmKJ5NMKTCCGztRaArFtD7QA8Bytts=";
  };

  build-system = [
    setuptools
    setuptools-scm
  ];

  dependencies = [
    backports-entry-points-selectable
    click
    deprecated
    python-magic
    pyyaml
    requests
    sentry-sdk_2
    tenacity
  ];

  pythonImportsCheck = [ "swh.core" ];

  __darwinAllowLocalNetworking = true;

  nativeCheckInputs = [
    flask
    hypothesis
    iso8601
    lzip
    msgpack
    psycopg
    pylzma
    pytestCheckHook
    pytest-aiohttp
    pytest-mock
    pytest-postgresql
    pytz
    requests-mock
    types-deprecated
    types-psycopg2
    types-pytz
    types-pyyaml
    types-requests
    unzip
    pkgs.zstd
  ];

  disabledTests =
    [
      # ValueError: Unable to configure handler 'systemd'
      "test_logging_configure_from_yaml"
    ]
    ++ lib.optionals (stdenv.hostPlatform.isDarwin) [
      # FileExistsError: [Errno 17] File exists:
      "test_uncompress_upper_archive_extension"
      # AssertionError: |500 - 632.1152460000121| not within 100
      "test_timed_coroutine"
      "test_timed_start_stop_calls"
      "test_timed"
      "test_timed_no_metric"
    ];

  disabledTestPaths = [
    # ModuleNotFoundError: No module named 'aiohttp_utils'
    "swh/core/api/tests/test_async.py"
    "swh/core/api/tests/test_rpc_server_asynchronous.py"
    # ModuleNotFoundError: No module named 'systemd'
    "swh/core/tests/test_logger.py"
    # ModuleNotFoundError: No module named 'psycopg_pool'
    "swh/core/db/tests"
  ];

  meta = {
    description = "Low-level utilities and helpers used by almost all other modules in the stack";
    homepage = "https://gitlab.softwareheritage.org/swh/devel/swh-core";
    license = lib.licenses.gpl3Only;
    mainProgram = "swh";
    maintainers = with lib.maintainers; [ drupol ];
  };
}
Loading