From df601786cce9cfae83ba3896fc152003898c6915 Mon Sep 17 00:00:00 2001 From: xadupre Date: Fri, 2 Jun 2023 13:57:36 +0200 Subject: [PATCH 1/9] Add linter for RST --- .github/workflows/linst-rst.yml | 16 +++++++++++ azure-pipelines.yml | 50 +++++++++++++++++++++++++++++++-- 2 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/linst-rst.yml diff --git a/.github/workflows/linst-rst.yml b/.github/workflows/linst-rst.yml new file mode 100644 index 0000000..f207e47 --- /dev/null +++ b/.github/workflows/linst-rst.yml @@ -0,0 +1,16 @@ +# .github/workflows/lint.yaml +name: RST Format Checker +on: [push, pull_request] + +jobs: + doctor-rst: + name: DOCtor-RST + runs-on: ubuntu-latest + steps: + - name: "Checkout code" + uses: actions/checkout@v2 + + - name: DOCtor-RST + uses: docker://oskarstark/doctor-rst + with: + args: --short --error-format=github diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9984f21..4c4c7e8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,11 +1,55 @@ jobs: +- job: 'TestLinuxWheelPip' + pool: + vmImage: 'ubuntu-latest' + strategy: + matrix: + Python311-Linux: + python.version: '3.11' + maxParallel: 3 + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '$(python.version)' + architecture: 'x64' + - script: sudo apt-get update + displayName: 'AptGet Update' + - script: sudo apt-get install -y graphviz + displayName: 'Install Graphviz' + - script: python -m pip install --upgrade pip setuptools wheel + displayName: 'Install tools' + - script: pip install -r requirements.txt + displayName: 'Install Requirements' + - script: pip install -r requirements-dev.txt + displayName: 'Install Requirements dev' + - script: | + ruff . + displayName: 'Ruff' + - script: | + black --diff . + displayName: 'Black' + - script: | + python -m pip wheel . --wheel-dir dist -v -v -v + displayName: 'build wheel' + - script: | + python -m pip install . -v -v -v + displayName: 'install wheel' + - script: | + python -m pytest -v + displayName: 'Runs Unit Tests' + - task: PublishPipelineArtifact@0 + inputs: + artifactName: 'wheel-linux-wheel-$(python.version)' + targetPath: 'dist' + - job: 'TestLinux' pool: vmImage: 'ubuntu-latest' strategy: matrix: Python310-Linux: - python.version: '3.10' + python.version: '3.11' maxParallel: 3 steps: @@ -55,7 +99,7 @@ jobs: strategy: matrix: Python310-Windows: - python.version: '3.10' + python.version: '3.11' maxParallel: 3 steps: @@ -88,7 +132,7 @@ jobs: strategy: matrix: Python310-Mac: - python.version: '3.10' + python.version: '3.11' maxParallel: 3 steps: From ca851211711f6b9c1d25c53013739f1e3c93d7be Mon Sep 17 00:00:00 2001 From: xadupre Date: Fri, 2 Jun 2023 14:00:24 +0200 Subject: [PATCH 2/9] update actions --- .github/workflows/linst-rst.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/linst-rst.yml b/.github/workflows/linst-rst.yml index f207e47..94a33f2 100644 --- a/.github/workflows/linst-rst.yml +++ b/.github/workflows/linst-rst.yml @@ -14,3 +14,5 @@ jobs: uses: docker://oskarstark/doctor-rst with: args: --short --error-format=github + env: + DOCS_DIR: 'docs/' From 6f4ee542263ce26871905cb599e760fced51e226 Mon Sep 17 00:00:00 2001 From: xadupre Date: Fri, 2 Jun 2023 14:02:22 +0200 Subject: [PATCH 3/9] fix path --- .github/workflows/linst-rst.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linst-rst.yml b/.github/workflows/linst-rst.yml index 94a33f2..9e1e195 100644 --- a/.github/workflows/linst-rst.yml +++ b/.github/workflows/linst-rst.yml @@ -15,4 +15,4 @@ jobs: with: args: --short --error-format=github env: - DOCS_DIR: 'docs/' + DOCS_DIR: '_doc/' From f5aefe2759bb9ab9e6884ec086289804b56a15e0 Mon Sep 17 00:00:00 2001 From: xadupre Date: Fri, 2 Jun 2023 14:33:40 +0200 Subject: [PATCH 4/9] check --- .github/workflows/codeql.yml | 61 ++++++++++++++++++++++++++++ .github/workflows/documentation.yml | 2 +- .github/workflows/linst-rst.yml | 18 -------- .github/workflows/rstcheck.yml | 24 +++++++++++ .github/workflows/wheels-linux.yml | 2 +- .github/workflows/wheels-mac.yml | 2 +- .github/workflows/wheels-windows.yml | 2 +- _doc/api/npx_annot.rst | 2 - _doc/api/npx_functions.rst | 2 - _doc/api/npx_jit.rst | 2 - _doc/api/npx_numpy.rst | 2 - _doc/api/npx_var.rst | 2 - _doc/api/onnx_tools.rst | 2 - _doc/api/ort.rst | 2 - _doc/api/plotting.rst | 2 - _doc/api/tools.rst | 2 - _doc/examples/plot_onnxruntime.py | 3 -- _doc/tutorial/benchmarks.rst | 2 - _doc/tutorial/overview.rst | 2 - azure-pipelines.yml | 3 ++ pyproject.toml | 11 +++++ requirements-dev.txt | 1 + 22 files changed, 104 insertions(+), 47 deletions(-) create mode 100644 .github/workflows/codeql.yml delete mode 100644 .github/workflows/linst-rst.yml create mode 100644 .github/workflows/rstcheck.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..bea1259 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,61 @@ +name: "Code Scanning - Action" + +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + # ┌───────────── minute (0 - 59) + # │ ┌───────────── hour (0 - 23) + # │ │ ┌───────────── day of the month (1 - 31) + # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) + # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) + # │ │ │ │ │ + # │ │ │ │ │ + # │ │ │ │ │ + # * * * * * + - cron: '30 1 * * 0' + +jobs: + CodeQL-Build: + # CodeQL runs on ubuntu-latest, windows-latest, and macos-latest + runs-on: ubuntu-latest + + permissions: + # required for all workflows + security-events: write + + # only required for workflows in private repositories + actions: read + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + # Override language selection by uncommenting this and choosing your languages + # with: + # languages: go, javascript, csharp, python, cpp, java, ruby + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). + # If this step fails, then you should remove it and run the build manually (see below). + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # ✏️ If the Autobuild fails above, remove it and uncomment the following + # three lines and modify them (or add more) to build your code if your + # project uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 27f4389..264e105 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -16,7 +16,7 @@ jobs: # Used to host cibuildwheel - uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: Install requirements run: python -m pip install -r requirements.txt diff --git a/.github/workflows/linst-rst.yml b/.github/workflows/linst-rst.yml deleted file mode 100644 index 9e1e195..0000000 --- a/.github/workflows/linst-rst.yml +++ /dev/null @@ -1,18 +0,0 @@ -# .github/workflows/lint.yaml -name: RST Format Checker -on: [push, pull_request] - -jobs: - doctor-rst: - name: DOCtor-RST - runs-on: ubuntu-latest - steps: - - name: "Checkout code" - uses: actions/checkout@v2 - - - name: DOCtor-RST - uses: docker://oskarstark/doctor-rst - with: - args: --short --error-format=github - env: - DOCS_DIR: '_doc/' diff --git a/.github/workflows/rstcheck.yml b/.github/workflows/rstcheck.yml new file mode 100644 index 0000000..143a924 --- /dev/null +++ b/.github/workflows/rstcheck.yml @@ -0,0 +1,24 @@ +jobs: + build_wheels: + name: rstcheck ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v3 + + # Used to host cibuildwheel + - uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install requirements + run: python -m pip install -r requirements.txt + + - name: Install requirements-dev.txt + run: python -m pip install -rstcheck[toml,sphinx] + + - name: rstcheck + run: rstcheck -r _doc onnx_array_api diff --git a/.github/workflows/wheels-linux.yml b/.github/workflows/wheels-linux.yml index 8445674..6557751 100644 --- a/.github/workflows/wheels-linux.yml +++ b/.github/workflows/wheels-linux.yml @@ -20,7 +20,7 @@ jobs: # Used to host cibuildwheel - uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: Install cibuildwheel run: python -m pip install cibuildwheel diff --git a/.github/workflows/wheels-mac.yml b/.github/workflows/wheels-mac.yml index 97f1902..c9ac273 100644 --- a/.github/workflows/wheels-mac.yml +++ b/.github/workflows/wheels-mac.yml @@ -20,7 +20,7 @@ jobs: # Used to host cibuildwheel - uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: Install cibuildwheel run: python -m pip install cibuildwheel diff --git a/.github/workflows/wheels-windows.yml b/.github/workflows/wheels-windows.yml index eb514ee..cf7e4bd 100644 --- a/.github/workflows/wheels-windows.yml +++ b/.github/workflows/wheels-windows.yml @@ -20,7 +20,7 @@ jobs: # Used to host cibuildwheel - uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: Install cibuildwheel run: python -m pip install cibuildwheel diff --git a/_doc/api/npx_annot.rst b/_doc/api/npx_annot.rst index 3a4d532..d7e46e3 100644 --- a/_doc/api/npx_annot.rst +++ b/_doc/api/npx_annot.rst @@ -1,5 +1,3 @@ -.. _l-api-npx-types: - npx.npx_types ============= diff --git a/_doc/api/npx_functions.rst b/_doc/api/npx_functions.rst index 5831cab..bc4810b 100644 --- a/_doc/api/npx_functions.rst +++ b/_doc/api/npx_functions.rst @@ -1,5 +1,3 @@ -.. _l-api-npx-functions: - npx.npx_functions ================= diff --git a/_doc/api/npx_jit.rst b/_doc/api/npx_jit.rst index fa814cd..05f6fbe 100644 --- a/_doc/api/npx_jit.rst +++ b/_doc/api/npx_jit.rst @@ -1,5 +1,3 @@ -.. _l-api-npx-jit: - npx, jit and eager mode ======================= diff --git a/_doc/api/npx_numpy.rst b/_doc/api/npx_numpy.rst index e26e17d..deb8c99 100644 --- a/_doc/api/npx_numpy.rst +++ b/_doc/api/npx_numpy.rst @@ -1,5 +1,3 @@ -.. _l-api-npx-numpy: - npx.npx_numpy_tensors ===================== diff --git a/_doc/api/npx_var.rst b/_doc/api/npx_var.rst index 0985e8b..8041e5e 100644 --- a/_doc/api/npx_var.rst +++ b/_doc/api/npx_var.rst @@ -1,5 +1,3 @@ -.. _l-api-npx-var: - npx.npx_var =========== diff --git a/_doc/api/onnx_tools.rst b/_doc/api/onnx_tools.rst index 401eb7d..31cc9c3 100644 --- a/_doc/api/onnx_tools.rst +++ b/_doc/api/onnx_tools.rst @@ -1,5 +1,3 @@ -.. _l-api-onnx-tools: - onnx tools ========== diff --git a/_doc/api/ort.rst b/_doc/api/ort.rst index d3de0ba..1a09e3d 100644 --- a/_doc/api/ort.rst +++ b/_doc/api/ort.rst @@ -1,5 +1,3 @@ -.. _l-api-ort: - ort === diff --git a/_doc/api/plotting.rst b/_doc/api/plotting.rst index c70d272..830cc86 100644 --- a/_doc/api/plotting.rst +++ b/_doc/api/plotting.rst @@ -1,5 +1,3 @@ -.. _l-api-plotting: - plotting ======== diff --git a/_doc/api/tools.rst b/_doc/api/tools.rst index fd9a256..b93d918 100644 --- a/_doc/api/tools.rst +++ b/_doc/api/tools.rst @@ -1,5 +1,3 @@ -.. _l-api-tools: - tools ===== diff --git a/_doc/examples/plot_onnxruntime.py b/_doc/examples/plot_onnxruntime.py index 52000bc..9b0ac89 100644 --- a/_doc/examples/plot_onnxruntime.py +++ b/_doc/examples/plot_onnxruntime.py @@ -1,7 +1,4 @@ """ - -.. _l-onnx-array-first-onnxruntime: - First examples with onnxruntime =============================== diff --git a/_doc/tutorial/benchmarks.rst b/_doc/tutorial/benchmarks.rst index ef02a16..f219294 100644 --- a/_doc/tutorial/benchmarks.rst +++ b/_doc/tutorial/benchmarks.rst @@ -1,5 +1,3 @@ -.. _l-benchmarks: - ========== Benchmarks ========== diff --git a/_doc/tutorial/overview.rst b/_doc/tutorial/overview.rst index 21aa513..a603b35 100644 --- a/_doc/tutorial/overview.rst +++ b/_doc/tutorial/overview.rst @@ -1,5 +1,3 @@ -.. _l-numpy-api-onnx: - ================== Numpy API for ONNX ================== diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4c4c7e8..4eeed95 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -76,6 +76,9 @@ jobs: - script: | ruff . displayName: 'Ruff' + - script: | + rstcheck -r _doc onnx_array_api + displayName: 'rstcheck' - script: | black --diff . displayName: 'Black' diff --git a/pyproject.toml b/pyproject.toml index 1528407..832a027 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,14 @@ +[tool.rstcheck] +report_level = "INFO" +ignore_directives = [ + "autoclass", + "autofunction", + "gdot", + "image-sg", + "runpython", +] +ignore_roles = ["epkg"] + [tool.ruff] # Exclude a variety of commonly ignored directories. diff --git a/requirements-dev.txt b/requirements-dev.txt index 6e774f0..f30d07f 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -16,6 +16,7 @@ psutil pyquickhelper pytest pytest-cov +rstcheck[toml,sphinx] ruff scikit-learn skl2onnx From 8877323e0156655872d5f75b4bd12a4bd6945286 Mon Sep 17 00:00:00 2001 From: xadupre Date: Fri, 2 Jun 2023 14:35:17 +0200 Subject: [PATCH 5/9] rstcheck --- .github/workflows/rstcheck.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/rstcheck.yml b/.github/workflows/rstcheck.yml index 143a924..c378fb8 100644 --- a/.github/workflows/rstcheck.yml +++ b/.github/workflows/rstcheck.yml @@ -1,3 +1,7 @@ +name: rstcheck + +on: [push, pull_request] + jobs: build_wheels: name: rstcheck ${{ matrix.os }} From 15225fbfd1e93c193f4019dec65836da81f3ed33 Mon Sep 17 00:00:00 2001 From: xadupre Date: Fri, 2 Jun 2023 14:36:37 +0200 Subject: [PATCH 6/9] fix import --- .github/workflows/rstcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rstcheck.yml b/.github/workflows/rstcheck.yml index c378fb8..32d61cf 100644 --- a/.github/workflows/rstcheck.yml +++ b/.github/workflows/rstcheck.yml @@ -22,7 +22,7 @@ jobs: run: python -m pip install -r requirements.txt - name: Install requirements-dev.txt - run: python -m pip install -rstcheck[toml,sphinx] + run: python -m pip install rstcheck[toml,sphinx] - name: rstcheck run: rstcheck -r _doc onnx_array_api From 5f0ab24f0a86b1488df202f499773ce5b253a26d Mon Sep 17 00:00:00 2001 From: xadupre Date: Fri, 2 Jun 2023 14:42:43 +0200 Subject: [PATCH 7/9] =?UTF-8?q?az=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- azure-pipelines.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4eeed95..f972b3a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -77,7 +77,10 @@ jobs: ruff . displayName: 'Ruff' - script: | - rstcheck -r _doc onnx_array_api + rstcheck --help + displayName: 'rstcheck help' + - script: | + rstcheck -r ./_doc ./onnx_array_api displayName: 'rstcheck' - script: | black --diff . From 979e9b61d4c83220cdfbb4c70904b76c13707512 Mon Sep 17 00:00:00 2001 From: xadupre Date: Fri, 2 Jun 2023 14:54:35 +0200 Subject: [PATCH 8/9] ci --- .github/workflows/documentation.yml | 17 ++++++++++++++++- requirements-dev.txt | 3 ++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 264e105..dcc6d51 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -1,6 +1,21 @@ name: Documentation -on: [push, pull_request] +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + # ┌───────────── minute (0 - 59) + # │ ┌───────────── hour (0 - 23) + # │ │ ┌───────────── day of the month (1 - 31) + # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) + # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) + # │ │ │ │ │ + # │ │ │ │ │ + # │ │ │ │ │ + # * * * * * + - cron: '30 1 * * 0' jobs: build_wheels: diff --git a/requirements-dev.txt b/requirements-dev.txt index f30d07f..6178c1b 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -16,12 +16,13 @@ psutil pyquickhelper pytest pytest-cov -rstcheck[toml,sphinx] +rstcheck[sphinx,toml] ruff scikit-learn skl2onnx sphinx sphinx-gallery +tomli tqdm wheel xgboost From 1e4834c09a5e7584551ae908bba580b8073c2960 Mon Sep 17 00:00:00 2001 From: xadupre Date: Fri, 2 Jun 2023 15:00:38 +0200 Subject: [PATCH 9/9] fix rstchecker --- .github/workflows/rstcheck.yml | 6 +++--- azure-pipelines.yml | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rstcheck.yml b/.github/workflows/rstcheck.yml index 32d61cf..3d4b2cc 100644 --- a/.github/workflows/rstcheck.yml +++ b/.github/workflows/rstcheck.yml @@ -1,4 +1,4 @@ -name: rstcheck +name: RST Check on: [push, pull_request] @@ -21,8 +21,8 @@ jobs: - name: Install requirements run: python -m pip install -r requirements.txt - - name: Install requirements-dev.txt - run: python -m pip install rstcheck[toml,sphinx] + - name: Install rstcheck + run: python -m pip install sphinx tomli rstcheck[toml,sphinx] - name: rstcheck run: rstcheck -r _doc onnx_array_api diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f972b3a..50b1795 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -76,9 +76,6 @@ jobs: - script: | ruff . displayName: 'Ruff' - - script: | - rstcheck --help - displayName: 'rstcheck help' - script: | rstcheck -r ./_doc ./onnx_array_api displayName: 'rstcheck'