Skip to content

Commit

Permalink
python3Packages.trafilatura: init at 1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jokatzke committed Aug 1, 2023
1 parent 8756a3d commit 6a6dafb
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
65 changes: 65 additions & 0 deletions pkgs/development/python-modules/trafilatura/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{ lib
, buildPythonPackage
, fetchPypi
, pytestCheckHook
, pythonOlder
, certifi
, charset-normalizer
, courlan
, htmldate
, justext
, lxml
, urllib3
}:

buildPythonPackage rec {
pname = "trafilatura";
version = "1.6.1";
format = "setuptools";

disabled = pythonOlder "3.6";

src = fetchPypi {
inherit pname version;
hash = "sha256-p3krA31iTQSrBfzOVWz+CLdx38jB2xSUx1CHlTDJoww=";
};

propagatedBuildInputs = [
certifi
charset-normalizer
courlan
htmldate
justext
lxml
urllib3
];

nativeCheckInputs = [ pytestCheckHook ];

# disable tests that require an internet connection
disabledTests = [
"test_download"
"test_fetch"
"test_redirection"
"test_meta_redirections"
"test_crawl_page"
"test_whole"
];

# patch out gui cli because it is not supported in this packaging
# nixify path to the trafilatura binary in the test suite
postPatch = ''
substituteInPlace setup.py --replace '"trafilatura_gui=trafilatura.gui:main",' ""
substituteInPlace tests/cli_tests.py --replace "trafilatura_bin = 'trafilatura'" "trafilatura_bin = '$out/bin/trafilatura'"
'';

pythonImportsCheck = [ "trafilatura" ];

meta = with lib; {
description = "Python package and command-line tool designed to gather text on the Web";
homepage = "https://trafilatura.readthedocs.io";
changelog = "https://github.com/adbar/trafilatura/blob/v${version}/HISTORY.md";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ joopitz ];
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12695,6 +12695,8 @@ self: super: with self; {

trackpy = callPackage ../development/python-modules/trackpy { };

trafilatura = callPackage ../development/python-modules/trafilatura { };

trailrunner = callPackage ../development/python-modules/trailrunner {};

trainer = callPackage ../development/python-modules/trainer {};
Expand Down

0 comments on commit 6a6dafb

Please sign in to comment.