Skip to content

Update config.py (fix for python 3.9 version) #3689

Update config.py (fix for python 3.9 version)

Update config.py (fix for python 3.9 version) #3689

Workflow file for this run

# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
concurrency:
# automatically cancel the previously triggered workflows when there's a newer version
group: build-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
deps_check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- if: runner.os == 'Linux'
name: Cleanup (Linux only)
run: |
rm -rf /opt/hostedtoolcache
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install -r requirements.txt
build:
runs-on: ubuntu-latest
env:
MONAI_ZOO_AUTH_TOKEN: ${{ github.token }}
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
rm -rf /opt/hostedtoolcache
sudo apt-get install openslide-tools -y
python -m pip install --upgrade pip wheel
pip install -r requirements-dev.txt
- name: Clean
run: |
$(pwd)/runtests.sh --clean
- name: PyType
run: |
echo $(pwd)/runtests.sh --pytype
- name: Unit Tests
run: |
$(pwd)/runtests.sh --unittests
- name: Upload coverage
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: false
file: ./coverage.xml
packaging:
runs-on: ubuntu-latest
env:
MONAI_ZOO_AUTH_TOKEN: ${{ github.token }}
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: cache weekly timestamp
id: pip-cache
run: |
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
- name: cache for pip
uses: actions/cache@v4
id: cache
with:
path: |
~/.cache/pip
~/.cache/torch
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
- name: Install dependencies
run: |
rm -rf /opt/hostedtoolcache
sudo apt-get install openslide-tools -y
python -m pip install --user --upgrade pip setuptools wheel
python -m pip install torch torchvision
- name: Build Package
run: |
./runtests.sh --clean
BUILD_OHIF=true python setup.py sdist bdist_wheel
ls -l dist
- name: Verify Package
run: |
tmp_dir=$(mktemp -d)
cp dist/monailabel* "$tmp_dir"
rm -r build monailabel*.egg-info
# install from wheel
python -m pip install "$tmp_dir"/monailabel*.whl
python -c 'import monailabel; monailabel.print_config()' 2>&1 | grep -iv "unknown"
python -c 'import monailabel; print(monailabel.__file__)'
# install test utilities
python -m pip install pytest
# start the monailabel server in the background and run the integration tests
./runtests.sh --net
# cleanup
python -m pip uninstall -y monailabel
rm -r "$tmp_dir"
env:
shell: bash
build-docs:
runs-on: ubuntu-latest
env:
MONAI_ZOO_AUTH_TOKEN: ${{ github.token }}
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: cache weekly timestamp
id: pip-cache
run: |
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
- name: cache for pip
uses: actions/cache@v4
id: cache
with:
path: |
~/.cache/pip
~/.cache/torch
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
- name: Install dependencies
run: |
rm -rf /opt/hostedtoolcache
sudo apt-get install openslide-tools -y
python -m pip install --upgrade pip wheel
python -m pip install -r docs/requirements.txt
- name: Make html
run: |
export PYTHONPATH=$(pwd)
cd docs/
make clean
make html 2>&1 | tee tmp_log
if [[ $(grep -c "WARNING:" tmp_log) != 0 ]]; then echo "found warnings"; grep "WARNING:" tmp_log; exit 1; fi
shell: bash