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