1{
2 lib,
3 buildPythonPackage,
4 cssselect,
5 fetchPypi,
6 lxml,
7 pytestCheckHook,
8 pythonAtLeast,
9 pythonOlder,
10 requests,
11 webob,
12 webtest,
13}:
14
15buildPythonPackage rec {
16 pname = "pyquery";
17 version = "2.0.0";
18 disabled = pythonOlder "3.7";
19
20 format = "setuptools";
21
22 src = fetchPypi {
23 inherit pname version;
24 hash = "sha256-lj6NTpAmL/bY3sBy6pcoXcN0ovacrXd29AgqvPah2K4=";
25 };
26
27 # https://github.com/gawel/pyquery/issues/248
28 postPatch = ''
29 substituteInPlace tests/test_pyquery.py \
30 --replace test_selector_html skip_test_selector_html
31 '';
32
33 propagatedBuildInputs = [
34 cssselect
35 lxml
36 ];
37
38 __darwinAllowLocalNetworking = true;
39
40 pythonImportsCheck = [ "pyquery" ];
41
42 checkInputs = [
43 pytestCheckHook
44 requests
45 webob
46 (webtest.overridePythonAttrs (_: {
47 # circular dependency
48 doCheck = false;
49 }))
50 ];
51
52 pytestFlagsArray = [
53 # requires network
54 "--deselect=tests/test_pyquery.py::TestWebScrappingEncoding::test_get"
55 ];
56
57 disabledTests = lib.optionals (pythonAtLeast "3.12") [
58 # https://github.com/gawel/pyquery/issues/249
59 "pyquery.pyquery.PyQuery.serialize_dict"
60 ];
61
62 meta = with lib; {
63 description = "Jquery-like library for Python";
64 homepage = "https://github.com/gawel/pyquery";
65 changelog = "https://github.com/gawel/pyquery/blob/${version}/CHANGES.rst";
66 license = licenses.bsd0;
67 };
68}