Skip to content

Commit

Permalink
devel/py-ufmt: Add py-ufmt 2.5.1
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sunpoet committed Apr 5, 2024
1 parent 8c6ce7c commit 006a083
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions devel/Makefile
Expand Up @@ -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
Expand Down
30 changes: 30 additions & 0 deletions 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 <bsd.port.mk>
3 changes: 3 additions & 0 deletions 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
11 changes: 11 additions & 0 deletions 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.

0 comments on commit 006a083

Please sign in to comment.