1{
2 lib,
3 attrs,
4 buildPythonPackage,
5 click,
6 fetchFromGitHub,
7 hatch-vcs,
8 hatchling,
9 libcst,
10 moreorless,
11 pythonOlder,
12 stdlibs,
13 toml,
14 trailrunner,
15 unittestCheckHook,
16 volatile,
17}:
18
19buildPythonPackage rec {
20 pname = "usort";
21 version = "1.0.8";
22 format = "pyproject";
23
24 disabled = pythonOlder "3.7";
25
26 src = fetchFromGitHub {
27 owner = "facebook";
28 repo = "usort";
29 tag = "v${version}";
30 hash = "sha256-iezq2K+Rw0djyOoFm7tguw/vkkDSyrPZIfZPmaZvFpM=";
31 };
32
33 nativeBuildInputs = [
34 hatch-vcs
35 hatchling
36 ];
37
38 propagatedBuildInputs = [
39 attrs
40 click
41 libcst
42 moreorless
43 stdlibs
44 toml
45 trailrunner
46 ];
47
48 nativeCheckInputs = [
49 unittestCheckHook
50 volatile
51 ];
52
53 pythonImportsCheck = [ "usort" ];
54
55 meta = with lib; {
56 description = "Safe, minimal import sorting for Python projects";
57 mainProgram = "usort";
58 homepage = "https://github.com/facebook/usort";
59 changelog = "https://github.com/facebook/usort/blob/${version}/CHANGELOG.md";
60 license = licenses.mit;
61 maintainers = with maintainers; [ fab ];
62 };
63}