<commit_before>{ stdenv, pkgconfig, fetchpatch, fetchFromGitHub, buildPythonPackage
, zstd, pytest }:

buildPythonPackage rec {
  pname = "zstd";
  version = "1.3.5.1";

  # Switch back to fetchPypi when tests/ is included, see https://github.com/NixOS/nixpkgs/pull/49339
  src = fetchFromGitHub {
    owner = "sergey-dryabzhinsky";
    repo = "python-zstd";
    rev = "v${version}";
    sha256 = "08n1vz4zavas4cgzpdfcbpy33lnv39xxhq5mgj0zv3xi03ypc1rl";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace "/usr/bin/pkg-config" "${pkgconfig}/bin/pkg-config"
  '';

  nativeBuildInputs = [ pkgconfig ];
  buildInputs = [ zstd ];

  setupPyBuildFlags = [
    "--external"
    "--include-dirs=${zstd}/include"
    "--libraries=zstd"
    "--library-dirs=${zstd}/lib"
  ];

  # Running tests via setup.py triggers an attempt to recompile with the vendored zstd
  ZSTD_EXTERNAL = 1;
  VERSION = zstd.version;
  PKG_VERSION = version;

  checkInputs = [ pytest ];
  checkPhase = ''
    pytest
  '';

  meta = with stdenv.lib; {
    description = "Simple python bindings to Yann Collet ZSTD compression library";
    homepage = https://github.com/sergey-dryabzhinsky/python-zstd;
    license = licenses.bsd2;
    maintainers = with maintainers; [
      eadwu
    ];
  };
}
<commit_msg>python.pkgs.zstd: 1.3.5.1 -> 1.3.8.1<commit_after>{ stdenv, pkgconfig, fetchpatch, fetchPypi, buildPythonPackage
, zstd, pytest }:

buildPythonPackage rec {
  pname = "zstd";
  version = "1.3.8.1";

  src = fetchPypi {
    inherit pname version;
    sha256 = "d89e884da59c35e480439f1663cb3cb4cf372e42ba0eb0bdf22b9625414702a3";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace "/usr/bin/pkg-config" "${pkgconfig}/bin/pkg-config"
  '';

  nativeBuildInputs = [ pkgconfig ];
  buildInputs = [ zstd ];

  setupPyBuildFlags = [
    "--external"
    "--include-dirs=${zstd}/include"
    "--libraries=zstd"
    "--library-dirs=${zstd}/lib"
  ];

  # Running tests via setup.py triggers an attempt to recompile with the vendored zstd
  ZSTD_EXTERNAL = 1;
  VERSION = zstd.version;
  PKG_VERSION = version;

  checkInputs = [ pytest ];
  checkPhase = ''
    pytest
  '';

  meta = with stdenv.lib; {
    description = "Simple python bindings to Yann Collet ZSTD compression library";
    homepage = https://github.com/sergey-dryabzhinsky/python-zstd;
    license = licenses.bsd2;
    maintainers = with maintainers; [
      eadwu
    ];
  };
}

{'fraction_non_alphanumeric': 0.13447432762836187, 'fraction_numerical': 0.035452322738386305, 'mean_word_length': 3.175170068027211, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3011038', 'n_tokens_mistral': 954, 'n_tokens_neox': 889, 'n_words': 175}