git: 437b5ef2910a - main - www/py-drf-spectacular: New port

From: Kai Knoblich <kai_at_FreeBSD.org>
Date: Thu, 04 May 2023 11:58:42 UTC
The branch main has been updated by kai:

URL: https://cgit.FreeBSD.org/ports/commit/?id=437b5ef2910a26f7e4a20b9f9d89c2cc5d15e186

commit 437b5ef2910a26f7e4a20b9f9d89c2cc5d15e186
Author:     Kai Knoblich <kai@FreeBSD.org>
AuthorDate: 2023-05-04 11:33:15 +0000
Commit:     Kai Knoblich <kai@FreeBSD.org>
CommitDate: 2023-05-04 11:57:42 +0000

    www/py-drf-spectacular: New port
    
    This project has 3 goals:
    
    * Extract as much schema information from DRF as possible.
    * Provide flexibility to make the schema usable in the real world (not
      only toy examples).
    * Generate a schema that works well with the most popular
      client generators.
    
    The code is a heavily modified fork of the DRF OpenAPI generator, which
    is/was lacking all of the below listed features:
    
    * Serializers modelled as components. (arbitrary nesting +
      recursion supported)
    * @extend_schema decorator for customization of APIView, Viewsets,
      function-based views, and @action
    * Authentication support (DRF natives included, easily extendable)
    * Custom serializer class support (easily extendable)
    * SerializerMethodField() type via type hinting or @extend_schema_field
    * i18n support, Tags extraction, Description extraction from docstrings
    * Request/response/parameter examples, Callback operations
    * Vendor specification extensions (x-*) in info, operations, parameters,
      components, and security schemes
    * Sane fallbacks and sane operation_id naming (based on path)
    * Schema serving with SpectacularAPIView (Redoc and Swagger-UI views are
      also available)
    * Optional input/output serializer component split
---
 www/Makefile                     |  1 +
 www/py-drf-spectacular/Makefile  | 40 ++++++++++++++++++++++++++++++++++++++++
 www/py-drf-spectacular/distinfo  |  3 +++
 www/py-drf-spectacular/pkg-descr | 24 ++++++++++++++++++++++++
 4 files changed, 68 insertions(+)

diff --git a/www/Makefile b/www/Makefile
index c171d8414988..5b5096af654e 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -1604,6 +1604,7 @@
     SUBDIR += py-djangorestframework-filters
     SUBDIR += py-djangorestframework-xml
     SUBDIR += py-draftjs-exporter
+    SUBDIR += py-drf-spectacular
     SUBDIR += py-drf-yasg
     SUBDIR += py-dropbox
     SUBDIR += py-dtflickr
diff --git a/www/py-drf-spectacular/Makefile b/www/py-drf-spectacular/Makefile
new file mode 100644
index 000000000000..ff6a3cf56661
--- /dev/null
+++ b/www/py-drf-spectacular/Makefile
@@ -0,0 +1,40 @@
+PORTNAME=	drf-spectacular
+DISTVERSION=	0.26.2
+CATEGORIES=	www python
+MASTER_SITES=	PYPI
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	kai@FreeBSD.org
+COMMENT=	Sane/flexible OpenAPI 3 schema generation for Django REST framework
+WWW=		https://github.com/tfranzel/drf-spectacular
+
+LICENSE=	BSD3CLAUSE
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}django32>=2.2:www/py-django32@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}djangorestframework>=3.10.3:www/py-djangorestframework@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}inflection>=0.3.1:devel/py-inflection@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}jsonschema>=2.6.0:devel/py-jsonschema@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}uritemplate>=2.0.0:net/py-uritemplate@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}yaml>=5.1:devel/py-yaml@${PY_FLAVOR}
+
+USES=		python:3.6+
+USE_PYTHON=	autoplist distutils
+
+CONFLICTS_INSTALL=	${PYTHON_PKGNAMEPREFIX}*${PORTNAME}
+
+NO_ARCH=		yes
+
+OPTIONS_DEFINE=		SIDECAR
+OPTIONS_DEFAULT=	SIDECAR
+
+SIDECAR_DESC=	Enable self-contained Swagger/Redoc UI installation
+SIDECAR_RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}drf-spectacular-sidecar>0:www/py-drf-spectacular-sidecar@${PY_FLAVOR}
+
+.include <bsd.port.pre.mk>
+
+.if ${PYTHON_REL} < 30800
+RUN_DEPENDS+=	${PYTHON_PKGNAMEPREFIX}typing-extension>0:devel/py-typing-extensions@${PY_FLAVOR}
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/www/py-drf-spectacular/distinfo b/www/py-drf-spectacular/distinfo
new file mode 100644
index 000000000000..a186bafeb897
--- /dev/null
+++ b/www/py-drf-spectacular/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1681883936
+SHA256 (drf-spectacular-0.26.2.tar.gz) = 005623d6bb9de37d2d0ec24ccd59c636e4a42f9af252f1470129ac32ccab38cb
+SIZE (drf-spectacular-0.26.2.tar.gz) = 216281
diff --git a/www/py-drf-spectacular/pkg-descr b/www/py-drf-spectacular/pkg-descr
new file mode 100644
index 000000000000..7f053d6244dc
--- /dev/null
+++ b/www/py-drf-spectacular/pkg-descr
@@ -0,0 +1,24 @@
+This project has 3 goals:
+
+* Extract as much schema information from DRF as possible.
+* Provide flexibility to make the schema usable in the real world (not only
+  toy examples).
+* Generate a schema that works well with the most popular client generators.
+
+The code is a heavily modified fork of the DRF OpenAPI generator, which is/was
+lacking all of the below listed features:
+
+* Serializers modelled as components. (arbitrary nesting + recursion supported)
+* @extend_schema decorator for customization of APIView, Viewsets,
+  function-based views, and @action
+* Authentication support (DRF natives included, easily extendable)
+* Custom serializer class support (easily extendable)
+* SerializerMethodField() type via type hinting or @extend_schema_field
+* i18n support, Tags extraction, Description extraction from docstrings
+* Request/response/parameter examples, Callback operations
+* Vendor specification extensions (x-*) in info, operations, parameters,
+  components, and security schemes
+* Sane fallbacks and sane operation_id naming (based on path)
+* Schema serving with SpectacularAPIView (Redoc and Swagger-UI views are
+  also available)
+* Optional input/output serializer component split