From 006a0833a75cdd489bc8c37208ecf046079b620c Mon Sep 17 00:00:00 2001 From: Po-Chuan Hsieh Date: Sat, 6 Apr 2024 07:56:50 +0800 Subject: [PATCH] devel/py-ufmt: Add py-ufmt 2.5.1 ufmt is a safe, atomic code formatter for Python built on top of black and usort: - Black makes code review faster by producing the smallest diffs possible. Blackened code looks the same regardless of the project you're reading. - usort is a safe, minimal import sorter. Its primary goal is to make no "dangerous" changes to code, and to make no changes on code style. ufmt formats files in-memory, first with usort and then with black, before writing any changes back to disk. This enables a combined, atomic step in CI/CD workflows for checking or formatting files, without any chance of conflict or intermediate changes between the import sorter and the code formatter. --- devel/Makefile | 1 + devel/py-ufmt/Makefile | 30 ++++++++++++++++++++++++++++++ devel/py-ufmt/distinfo | 3 +++ devel/py-ufmt/pkg-descr | 11 +++++++++++ 4 files changed, 45 insertions(+) create mode 100644 devel/py-ufmt/Makefile create mode 100644 devel/py-ufmt/distinfo create mode 100644 devel/py-ufmt/pkg-descr diff --git a/devel/Makefile b/devel/Makefile index f6d0eab7026d2..5a9c4677c89a8 100644 --- a/devel/Makefile +++ b/devel/Makefile @@ -5825,6 +5825,7 @@ SUBDIR += py-u-msgpack-python SUBDIR += py-ua_parser SUBDIR += py-ubelt + SUBDIR += py-ufmt SUBDIR += py-uhid-freebsd SUBDIR += py-ujson SUBDIR += py-undefined diff --git a/devel/py-ufmt/Makefile b/devel/py-ufmt/Makefile new file mode 100644 index 0000000000000..57c28f9e09456 --- /dev/null +++ b/devel/py-ufmt/Makefile @@ -0,0 +1,30 @@ +PORTNAME= ufmt +PORTVERSION= 2.5.1 +CATEGORIES= devel python +MASTER_SITES= PYPI +PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} + +MAINTAINER= sunpoet@FreeBSD.org +COMMENT= Safe, atomic formatting with black and usort +WWW= https://ufmt.omnilib.dev/en/stable/ \ + https://github.com/omnilib/ufmt + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/LICENSE + +BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}flit-core>=3.8<4:devel/py-flit-core@${PY_FLAVOR} +RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}black>=20.8b0:devel/py-black@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}click>=8.0:devel/py-click@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}libcst>=0.4.0:devel/py-libcst@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}moreorless>=0.4.0:devel/py-moreorless@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}tomlkit>=0.7.2:textproc/py-tomlkit@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}trailrunner>=1.2.1:devel/py-trailrunner@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}typing-extensions>=4.0:devel/py-typing-extensions@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}usort>=1.0:devel/py-usort@${PY_FLAVOR} + +USES= python +USE_PYTHON= autoplist concurrent pep517 + +NO_ARCH= yes + +.include diff --git a/devel/py-ufmt/distinfo b/devel/py-ufmt/distinfo new file mode 100644 index 0000000000000..9ffdafca832f7 --- /dev/null +++ b/devel/py-ufmt/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1712330561 +SHA256 (ufmt-2.5.1.tar.gz) = af53400cbc0498d5d57f79bdf8c0e13df67f384ab38ab9881b15e4ceb04c5d64 +SIZE (ufmt-2.5.1.tar.gz) = 75447 diff --git a/devel/py-ufmt/pkg-descr b/devel/py-ufmt/pkg-descr new file mode 100644 index 0000000000000..e46e8c99db8d8 --- /dev/null +++ b/devel/py-ufmt/pkg-descr @@ -0,0 +1,11 @@ +ufmt is a safe, atomic code formatter for Python built on top of black and +usort: +- Black makes code review faster by producing the smallest diffs possible. + Blackened code looks the same regardless of the project you're reading. +- usort is a safe, minimal import sorter. Its primary goal is to make no + "dangerous" changes to code, and to make no changes on code style. + +ufmt formats files in-memory, first with usort and then with black, before +writing any changes back to disk. This enables a combined, atomic step in CI/CD +workflows for checking or formatting files, without any chance of conflict or +intermediate changes between the import sorter and the code formatter.