1{ lib
2, buildPythonPackage
3, fetchPypi
4, pythonOlder
5
6# runtime
7, editables
8, importlib-metadata # < 3.8
9, packaging
10, pathspec
11, pluggy
12, tomli
13
14# tests
15, build
16, python
17, requests
18, virtualenv
19}:
20
21let
22 pname = "hatchling";
23 version = "1.13.0";
24in
25buildPythonPackage {
26 inherit pname version;
27 format = "pyproject";
28
29 src = fetchPypi {
30 inherit pname version;
31 hash = "sha256-+NJ1osxyBzUoa3wuK8NdoFdh5tNpXC+kFlUDlfEMU8c=";
32 };
33
34 # listed in backend/src/hatchling/ouroboros.py
35 propagatedBuildInputs = [
36 editables
37 packaging
38 pathspec
39 pluggy
40 ] ++ lib.optionals (pythonOlder "3.8") [
41 importlib-metadata
42 ] ++ lib.optionals (pythonOlder "3.11") [
43 tomli
44 ];
45
46 pythonImportsCheck = [
47 "hatchling"
48 "hatchling.build"
49 ];
50
51 # tries to fetch packages from the internet
52 doCheck = false;
53
54 # listed in /backend/tests/downstream/requirements.txt
55 nativeCheckInputs = [
56 build
57 packaging
58 requests
59 virtualenv
60 ];
61
62 preCheck = ''
63 export HOME=$TMPDIR
64 '';
65
66 checkPhase = ''
67 runHook preCheck
68 ${python.interpreter} tests/downstream/integrate.py
69 runHook postCheck
70 '';
71
72 meta = with lib; {
73 description = "Modern, extensible Python build backend";
74 homepage = "https://hatch.pypa.io/latest/";
75 changelog = "https://github.com/pypa/hatch/releases/tag/hatchling-v${version}";
76 license = licenses.mit;
77 maintainers = with maintainers; [ hexa ofek ];
78 };
79}