git: 583287b7d536 - main - databases/py-ormar: add port: Simple async ORM with fastapi in mind and pydantic validation

From: Hiroki Tagato <tagattie_at_FreeBSD.org>
Date: Sat, 01 Jan 2022 05:09:11 UTC
The branch main has been updated by tagattie:

URL: https://cgit.FreeBSD.org/ports/commit/?id=583287b7d536cc849d468332777339542a750f0a

commit 583287b7d536cc849d468332777339542a750f0a
Author:     Goran Mekić <meka@tilda.center>
AuthorDate: 2022-01-01 05:06:14 +0000
Commit:     Hiroki Tagato <tagattie@FreeBSD.org>
CommitDate: 2022-01-01 05:08:51 +0000

    databases/py-ormar: add port: Simple async ORM with fastapi in mind and pydantic validation
    
    The ormar package is an async mini ORM for Python, with support for Postgres,
    MySQL, and SQLite.
    
    The main benefit of using ormar are:
    * getting an async ORM that can be used with async frameworks (fastapi,
      starlette etc.)
    * getting just one model to maintain - you don't have to maintain pydantic and
      other orm model (sqlalchemy, peewee, gino etc.)
    
    The goal was to create a simple ORM that can be used directly (as request and
    response models) with fastapi that bases it's data validation on pydantic.
    
    WWW: https://github.com/collerek/ormar
    
    PR:             257370
    Reported by:    Goran Mekić <meka@tilda.center> (new maintainer)
    Reviewed by:    koobs
---
 databases/Makefile           |  1 +
 databases/py-ormar/Makefile  | 50 ++++++++++++++++++++++++++++++++++++++++++++
 databases/py-ormar/distinfo  |  3 +++
 databases/py-ormar/pkg-descr | 13 ++++++++++++
 4 files changed, 67 insertions(+)

diff --git a/databases/Makefile b/databases/Makefile
index 2952b5e2e088..4b136c577340 100644
--- a/databases/Makefile
+++ b/databases/Makefile
@@ -796,6 +796,7 @@
     SUBDIR += py-mycli
     SUBDIR += py-mysql-connector-python
     SUBDIR += py-mysqlclient
+    SUBDIR += py-ormar
     SUBDIR += py-partd
     SUBDIR += py-peewee
     SUBDIR += py-peewee_migrate
diff --git a/databases/py-ormar/Makefile b/databases/py-ormar/Makefile
new file mode 100644
index 000000000000..62d78750f417
--- /dev/null
+++ b/databases/py-ormar/Makefile
@@ -0,0 +1,50 @@
+PORTNAME=	ormar
+DISTVERSION=	0.10.23
+CATEGORIES=	databases python
+MASTER_SITES=	CHEESESHOP
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	meka@tilda.center
+COMMENT=	Simple async ORM with fastapi in mind and pydantic validation
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE.md
+
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}databases>=0.3.2,<0.5.4:databases/py-databases@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pydantic>=1.6.1,<1.8.3:devel/py-pydantic@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}sqlalchemy14>=1.4.0,<1.4.28:databases/py-sqlalchemy14@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}typing-extensions>=3.7:devel/py-typing-extensions@${PY_FLAVOR}
+TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}fastapi>=0:www/py-fastapi@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytest-asyncio>=0:devel/py-pytest-asyncio@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytest>=0:devel/py-pytest@${PY_FLAVOR}
+
+USES=		python:3.6+
+USE_PYTHON=	autoplist concurrent distutils
+
+TEST_ENV=	PYTHONPATH=${WRKSRC}/src
+
+NO_ARCH=	yes
+
+OPTIONS_DEFINE=			CRYPTO
+OPTIONS_GROUP=			DATABASES
+OPTIONS_GROUP_DATABASES=	MYSQL PGSQL SQLITE
+OPTIONS_DEFAULT=		SQLITE
+DATABASES_DESC=			Database Support
+
+CRYPTO_DESC=	Support for password encryption
+
+CRYPTO_RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}cryptography>0:security/py-cryptography@${PY_FLAVOR}
+SQLITE_USES=		sqlite
+SQLITE_RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}aiosqlite>0:databases/py-aiosqlite@${PY_FLAVOR}
+MYSQL_USES=		mysql
+MYSQL_RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}aiomysql>0:databases/py-aiomysql@${PY_FLAVOR} \
+			${PYTHON_PKGNAMEPREFIX}pymysql>0:databases/py-pymysql@${PY_FLAVOR}
+PGSQL_USES=		pgsql
+PGSQL_RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}asyncpg>0:databases/py-asyncpg@${PY_FLAVOR} \
+			${PYTHON_PKGNAMEPREFIX}psycopg2>0:databases/py-psycopg2@${PY_FLAVOR}
+
+# Tests require newer pytest
+# do-test:
+	# cd ${WRKSRC} && ${SETENV} ${TEST_ENV} TEST_DATABASE_URLS="sqlite:///testsuite" ${PYTHON_CMD} -m pytest -v -rs -o addopts=
+
+.include <bsd.port.mk>
diff --git a/databases/py-ormar/distinfo b/databases/py-ormar/distinfo
new file mode 100644
index 000000000000..512cc08cd09d
--- /dev/null
+++ b/databases/py-ormar/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1640942160
+SHA256 (ormar-0.10.23.tar.gz) = bd8f86389db87f3844b25d7e1e47e18fa52b113877dcbad180f67d5a9597c9d3
+SIZE (ormar-0.10.23.tar.gz) = 125905
diff --git a/databases/py-ormar/pkg-descr b/databases/py-ormar/pkg-descr
new file mode 100644
index 000000000000..38f2ef1d47a9
--- /dev/null
+++ b/databases/py-ormar/pkg-descr
@@ -0,0 +1,13 @@
+The ormar package is an async mini ORM for Python, with support for Postgres,
+MySQL, and SQLite.
+
+The main benefit of using ormar are:
+* getting an async ORM that can be used with async frameworks (fastapi,
+  starlette etc.)
+* getting just one model to maintain - you don't have to maintain pydantic and
+  other orm model (sqlalchemy, peewee, gino etc.)
+
+The goal was to create a simple ORM that can be used directly (as request and
+response models) with fastapi that bases it's data validation on pydantic.
+
+WWW: https://github.com/collerek/ormar