1{
2 # Basic
3 lib,
4 buildPythonPackage,
5 fetchFromGitHub,
6 # Build system
7 poetry-core,
8 # Dependencies
9 numpy,
10 requests,
11 tsplib95,
12 # Test
13 pytestCheckHook,
14 mock,
15}:
16
17buildPythonPackage rec {
18 pname = "python-tsp";
19 version = "0.5.0";
20 pyproject = true;
21
22 src = fetchFromGitHub {
23 owner = "fillipe-gsm";
24 repo = "python-tsp";
25 tag = "v${version}";
26 hash = "sha256-X4L0j6ZL8/Xj2YFcvwOl8voC2xHagMcdcj9F1f/6/5M=";
27 };
28
29 build-system = [ poetry-core ];
30
31 dependencies = [
32 numpy
33 requests
34 tsplib95
35 ];
36
37 # Rename some dependencies
38 postPatch = ''
39 substituteInPlace pyproject.toml \
40 --replace-fail "poetry>=0.12" "poetry-core>=0.12" \
41 --replace-fail "poetry.masonry.api" "poetry.core.masonry.api"
42 '';
43
44 nativeCheckInputs = [
45 pytestCheckHook
46 mock
47 ];
48
49 pythonImportsCheck = [ "python_tsp" ];
50
51 meta = {
52 description = "Library for solving typical Traveling Salesperson Problems (TSP)";
53 homepage = "https://github.com/fillipe-gsm/python-tsp";
54 license = lib.licenses.mit;
55 maintainers = with lib.maintainers; [ thattemperature ];
56 };
57}