# -*- 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.19.1
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     e18aa5031dc2e29e0eff17091b1a5d60 \
                    rmd160  b99a2d32caf310f7cb56e34123308f4574548abc \
                    sha256  737524d6eb3907d3499ea459c6f01c5a96278bb3a0f2ff8ae04786fb5d7f1ed5 \
                    size    12033525

python.versions     39 310 311 312 313

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

    depends_build-append \
        path:bin/cmake:cmake \
        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

    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
}
