1{
2 lib,
3 beautifulsoup4,
4 buildPythonPackage,
5 fetchFromGitHub,
6 lxml,
7 pytest-cov-stub,
8 pytest-httpbin,
9 pytest-mock,
10 pytestCheckHook,
11 requests-mock,
12 requests,
13 setuptools,
14}:
15
16buildPythonPackage rec {
17 pname = "mechanicalsoup";
18 version = "1.4.0";
19 pyproject = true;
20
21 src = fetchFromGitHub {
22 owner = "MechanicalSoup";
23 repo = "MechanicalSoup";
24 tag = "v${version}";
25 hash = "sha256-fu3DGTsLrw+MHZCFF4WHMpyjqkexH/c8j9ko9ZAeAwU=";
26 };
27
28 postPatch = ''
29 # Is in setup_requires but not used in setup.py
30 substituteInPlace setup.py \
31 --replace "'pytest-runner'" ""
32 substituteInPlace setup.cfg \
33 --replace " --flake8" ""
34 '';
35
36 build-system = [ setuptools ];
37
38 dependencies = [
39 beautifulsoup4
40 lxml
41 requests
42 ];
43
44 __darwinAllowLocalNetworking = true;
45
46 nativeCheckInputs = [
47 pytest-cov-stub
48 pytest-httpbin
49 pytest-mock
50 pytestCheckHook
51 requests-mock
52 ];
53
54 pythonImportsCheck = [ "mechanicalsoup" ];
55
56 disabledTests = [
57 # Missing module
58 "test_select_form_associated_elements"
59 ];
60
61 meta = with lib; {
62 description = "Python library for automating interaction with websites";
63 homepage = "https://github.com/hickford/MechanicalSoup";
64 changelog = "https://github.com/MechanicalSoup/MechanicalSoup/releases/tag/v${version}";
65 license = licenses.mit;
66 maintainers = with maintainers; [
67 jgillich
68 fab
69 ];
70 };
71}