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