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