1{ lib
2, callPackage
3, buildPythonPackage
4, fetchPypi
5, pythonOlder
6, hatchling
7}:
8
9buildPythonPackage rec {
10 pname = "attrs";
11 version = "23.1.0";
12 disabled = pythonOlder "3.7";
13 format = "pyproject";
14
15 src = fetchPypi {
16 inherit pname version;
17 hash = "sha256-YnmDbVgVE6JvG/I1+azTM7yRFWg/FPfo+uRsmPxQ4BU=";
18 };
19
20 patches = [
21 # hatch-vcs and hatch-fancy-pypi-readme depend on pytest, which depends on attrs
22 ./remove-hatch-plugins.patch
23 ];
24
25 postPatch = ''
26 substituteAllInPlace pyproject.toml
27 '';
28
29 nativeBuildInputs = [
30 hatchling
31 ];
32
33 outputs = [
34 "out"
35 "testout"
36 ];
37
38 postInstall = ''
39 # Install tests as the tests output.
40 mkdir $testout
41 cp -R conftest.py tests $testout
42 '';
43
44 pythonImportsCheck = [
45 "attr"
46 ];
47
48 # pytest depends on attrs, so we can't do this out-of-the-box.
49 # Instead, we do this as a passthru.tests test.
50 doCheck = false;
51
52 passthru.tests = {
53 pytest = callPackage ./tests.nix { };
54 };
55
56 meta = with lib; {
57 description = "Python attributes without boilerplate";
58 homepage = "https://github.com/python-attrs/attrs";
59 changelog = "https://github.com/python-attrs/attrs/releases/tag/${version}";
60 license = licenses.mit;
61 maintainers = with maintainers; [ ];
62 };
63}