Update dependency mypy to v1.20.2 #285
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
| name: Formatting and tests | |
| on: [push, pull_request] | |
| jobs: | |
| formatting: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Get full git history | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.14.0' | |
| - name: Install package | |
| run: | | |
| pip install --upgrade pip | |
| pip install uv | |
| uv venv --python 3.10.17 | |
| uv pip install -e ".[dev]" --torch-backend=auto | |
| - name: Pytest | |
| run: | | |
| source .venv/bin/activate | |
| make pylint | |
| make pycodestyle | |
| make mypy | |
| make black | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Get full git history | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libopenblas-dev | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.14.0' | |
| - name: Download and install Miniconda | |
| run: | | |
| # Check if we're running in act (local testing) | |
| if [ -n "$ACT" ]; then | |
| echo "Running in act (local environment)" | |
| fi | |
| # Detect system architecture and OS | |
| ARCH=$(uname -m) | |
| OS=$(uname -s) | |
| echo "Detected OS: $OS, Architecture: $ARCH" | |
| # Determine the correct Miniconda download URL | |
| if [[ "$OS" == "Linux" ]]; then | |
| if [[ "$ARCH" == "x86_64" ]]; then | |
| MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh" | |
| elif [[ "$ARCH" == "aarch64" || "$ARCH" == "arm64" ]]; then | |
| MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh" | |
| else | |
| echo "Unsupported Linux architecture: $ARCH" | |
| exit 1 | |
| fi | |
| elif [[ "$OS" == "Darwin" ]]; then | |
| if [[ "$ARCH" == "x86_64" ]]; then | |
| MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh" | |
| elif [[ "$ARCH" == "arm64" ]]; then | |
| MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh" | |
| else | |
| echo "Unsupported macOS architecture: $ARCH" | |
| exit 1 | |
| fi | |
| else | |
| echo "Unsupported OS: $OS" | |
| exit 1 | |
| fi | |
| echo "Downloading Miniconda from: $MINICONDA_URL" | |
| curl -sSL "$MINICONDA_URL" -o miniconda.sh | |
| # Install Miniconda | |
| bash miniconda.sh -b -p $HOME/miniconda | |
| # Initialize conda | |
| source $HOME/miniconda/bin/activate | |
| conda init bash | |
| # Add to PATH for current and future steps | |
| echo "$HOME/miniconda/bin" >> $GITHUB_PATH | |
| export PATH="$HOME/miniconda/bin:$PATH" | |
| # Verify installation | |
| conda --version | |
| # Delete .sh file | |
| rm miniconda.sh | |
| - name: Create conda environment | |
| run: | | |
| export PATH="$HOME/miniconda/bin:$PATH" | |
| conda create -n myenv python=3.10 -y | |
| conda info --envs | |
| - name: Install dependencies | |
| run: | | |
| # from aihwkit-lightning one up | |
| cd ../ | |
| pwd | |
| which python # /usr/bin/python (system Python) | |
| which pip | |
| export PATH="$HOME/miniconda/bin:$PATH" | |
| source $HOME/miniconda/bin/activate myenv | |
| which python # conda | |
| which pip | |
| pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu | |
| # Check disk space before triton installation | |
| echo "=== Disk space before triton installation ===" | |
| df -h | |
| # triton | |
| git clone https://github.com/triton-lang/triton.git | |
| cd triton | |
| git checkout c1ed673b74e1c9aa69416459a4ae9f4fcf8cc6da | |
| pwd | |
| pip install -r python/requirements.txt --no-deps | |
| cd python | |
| MAX_JOBS=8 pip install -v -e . | |
| cd ../.. | |
| python -c "import triton ; print(f'Triton imported successfully from {triton.__file__}')" | |
| # Check disk space after triton installation | |
| echo "=== Disk space after triton installation ===" | |
| df -h | |
| # Clean up triton build artifacts and temp files | |
| echo "=== Cleaning up triton build artifacts ===" | |
| rm -rf triton | |
| # Clean up tmp directory | |
| echo "=== Cleaning up /tmp directory ===" | |
| sudo rm -rf /tmp/* | |
| # Check disk space after cleanup | |
| echo "=== Disk space after cleanup ===" | |
| df -h | |
| # aihwkit | |
| pwd | |
| git clone https://github.com/IBM/aihwkit.git | |
| cd aihwkit | |
| git checkout ee8bbf066f1c2a38b4a50f60c357a5581b33e916 | |
| pip install -r requirements.txt | |
| pip install -r requirements-dev.txt | |
| conda install -c conda-forge openblas -y | |
| make build_inplace | |
| export PYTHONPATH=$(pwd)/src | |
| echo "PYTHONPATH set to $PYTHONPATH" | |
| cd .. | |
| # aihwkit-lightning | |
| cd aihwkit-lightning | |
| pip install -r requirements_dev.txt | |
| pip install -v -e . | |
| # actually execute the tests | |
| make pytest |