2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
black,
|
|
|
|
buildPythonPackage,
|
|
|
|
click,
|
|
|
|
fetchFromGitHub,
|
|
|
|
flit-core,
|
|
|
|
libcst,
|
|
|
|
moreorless,
|
2024-06-24 18:47:55 +00:00
|
|
|
pygls,
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonOlder,
|
|
|
|
tomlkit,
|
|
|
|
trailrunner,
|
2024-06-24 18:47:55 +00:00
|
|
|
ruff-api,
|
2024-06-05 15:53:02 +00:00
|
|
|
typing-extensions,
|
|
|
|
unittestCheckHook,
|
|
|
|
usort,
|
2023-07-15 17:15:38 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "ufmt";
|
2024-06-24 18:47:55 +00:00
|
|
|
version = "2.7.0";
|
|
|
|
pyproject = true;
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2024-06-24 18:47:55 +00:00
|
|
|
disabled = pythonOlder "3.";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "omnilib";
|
|
|
|
repo = "ufmt";
|
|
|
|
rev = "refs/tags/v${version}";
|
2024-06-24 18:47:55 +00:00
|
|
|
hash = "sha256-hIbzW7yDqk8siob+RhcnbOonkl+67sl/IGHimIeMM+Q=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
2024-06-24 18:47:55 +00:00
|
|
|
build-system = [ flit-core ];
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2024-06-24 18:47:55 +00:00
|
|
|
dependencies = [
|
2023-07-15 17:15:38 +00:00
|
|
|
black
|
|
|
|
click
|
|
|
|
libcst
|
|
|
|
moreorless
|
|
|
|
tomlkit
|
|
|
|
trailrunner
|
|
|
|
typing-extensions
|
|
|
|
usort
|
|
|
|
];
|
|
|
|
|
2024-06-24 18:47:55 +00:00
|
|
|
passthru.optional-dependencies = {
|
|
|
|
lsp = [ pygls ];
|
|
|
|
ruff = [ ruff-api ];
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
unittestCheckHook
|
|
|
|
] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "ufmt" ];
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Safe, atomic formatting with black and usort";
|
|
|
|
homepage = "https://github.com/omnilib/ufmt";
|
|
|
|
changelog = "https://github.com/omnilib/ufmt/blob/${version}/CHANGELOG.md";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ fab ];
|
2024-06-24 18:47:55 +00:00
|
|
|
mainProgram = "ufmt";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
}
|