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