python3Packages.ufmt: cleanup, fix build (#455249)

This commit is contained in:
dotlambda
2025-10-24 15:30:10 +00:00
committed by GitHub
3 changed files with 27 additions and 13 deletions
+1
View File
@@ -0,0 +1 @@
{ python3Packages }: with python3Packages; toPythonApplication ufmt
@@ -1,20 +1,28 @@
{
lib,
black,
buildPythonPackage,
click,
fetchFromGitHub,
# build-system
flit-core,
# dependencies
black,
click,
libcst,
moreorless,
pygls,
pythonOlder,
tomlkit,
trailrunner,
ruff-api,
typing-extensions,
unittestCheckHook,
usort,
# optional-dependencies
pygls,
ruff-api,
# tests
unittestCheckHook,
versionCheckHook,
}:
buildPythonPackage rec {
@@ -22,8 +30,6 @@ buildPythonPackage rec {
version = "2.8.0";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "omnilib";
repo = "ufmt";
@@ -31,6 +37,13 @@ buildPythonPackage rec {
hash = "sha256-oEvvXUju7qne3pCwnrckplMs0kBJavB669qieXJZPKw=";
};
# Broken since click was updated to 8.2.1 in https://github.com/NixOS/nixpkgs/pull/448189
# TypeError: CliRunner.__init__() got an unexpected keyword argument 'mix_stderr'
postPatch = ''
substituteInPlace ufmt/tests/__init__.py \
--replace-fail "from .cli import CliTest" ""
'';
build-system = [ flit-core ];
dependencies = [
@@ -51,17 +64,19 @@ buildPythonPackage rec {
nativeCheckInputs = [
unittestCheckHook
versionCheckHook
]
++ lib.flatten (builtins.attrValues optional-dependencies);
versionCheckProgramArg = "--version";
pythonImportsCheck = [ "ufmt" ];
meta = with lib; {
meta = {
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 ];
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ fab ];
mainProgram = "ufmt";
};
}
-2
View File
@@ -4204,8 +4204,6 @@ with pkgs;
libjpeg_turbo = libjpeg_turbo.override { enableJava = true; };
};
ufmt = with python3Packages; toPythonApplication ufmt;
unbound-with-systemd = unbound.override {
withSystemd = true;
};