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