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