# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           python 1.0

name                py-onnx
version             1.21.0
categories-append   science
license             Apache-2
maintainers         nomaintainer

description         Open Neural Network Exchange

long_description    {*}${description} (ONNX) is an open \
                    ecosystem that empowers AI developers to choose \
                    the right tools as their project evolves. ONNX \
                    provides an open source format for AI models, both \
                    deep learning and traditional ML. It defines an \
                    extensible computation graph model, as well as \
                    definitions of built-in operators and standard \
                    data types. Currently we focus on the capabilities \
                    needed for inferencing (scoring).

homepage            https://onnx.ai/

checksums           md5     51b73ced6a25f9cd20865188c354b5ae \
                    rmd160  6b7df687e922e75dfcfe85c738d2a212c66d1779 \
                    sha256  4d8b67d0aaec5864c87633188b91cc520877477ec0254eda122bef8be43cd764 \
                    size    12074608

python.versions     310 311 312 313 314

if {${name} ne ${subport}} {
    compiler.cxx_standard 2017

    depends_build-append \
        path:bin/cmake:cmake \
        port:py${python.version}-nanobind \
        port:pybind11

    depends_lib-append \
        port:py${python.version}-numpy \
        port:py${python.version}-protobuf3 \
        port:py${python.version}-typing_extensions

    depends_run-append \
        port:py${python.version}-ml_dtypes

    depends_test-append \
        port:py${python.version}-nbval \
        port:py${python.version}-pytest \
        port:py${python.version}-tabulate

    # remove unnecessary dependencies and version pinning
    # diff -NaurdwB ./py-onnx-orig ./py-onnx-new | sed -E -e 's/\.\/py-onnx-(orig|new)/\./g' | sed -E -e 's|/opt/local|@@PREFIX@@|g' > ~/Downloads/patch-pyproject_toml.diff
    patchfiles-append       patch-pyproject_toml.diff
    patchfiles-append       patch-CMakeLists_txt.diff

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -d ${destroot}${docdir}
        xinstall -m 0644 -W ${worksrcpath} LICENSE README.md \
            ${destroot}${docdir}
    }

    test.run        yes
    test.target     onnx/test
}
