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 ] ++ lib.optionals (pythonOlder "3.11") [ tomli ];
40
41 pythonImportsCheck = [
42 "hatchling"
43 "hatchling.build"
44 ];
45
46 # tries to fetch packages from the internet
47 doCheck = false;
48
49 # listed in /backend/tests/downstream/requirements.txt
50 nativeCheckInputs = [
51 build
52 requests
53 virtualenv
54 ];
55
56 preCheck = ''
57 export HOME=$(mktemp -d)
58 '';
59
60 checkPhase = ''
61 runHook preCheck
62 ${python.interpreter} tests/downstream/integrate.py
63 runHook postCheck
64 '';
65
66 meta = {
67 description = "Modern, extensible Python build backend";
68 mainProgram = "hatchling";
69 homepage = "https://hatch.pypa.io/latest/";
70 changelog = "https://github.com/pypa/hatch/releases/tag/hatchling-v${version}";
71 license = lib.licenses.mit;
72 maintainers = with lib.maintainers; [
73 hexa
74 ofek
75 ];
76 };
77}