diff --git a/.azure-pipelines/azure-pipelines-linux.yml b/.azure-pipelines/azure-pipelines-linux.yml deleted file mode 100644 index 6c9a423cb..000000000 --- a/.azure-pipelines/azure-pipelines-linux.yml +++ /dev/null @@ -1,35 +0,0 @@ -# Python package -# Create and test a Python package on multiple Python versions. -# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more: -# https://docs.microsoft.com/azure/devops/pipelines/languages/python - -jobs: -- job: linux - pool: - vmImage: ubuntu-latest - timeoutInMinutes: 360 - strategy: - matrix: - linux_python3.11: - python.version: '3.11' - - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '$(python.version)' - displayName: 'Use Python $(python.version)' - - - script: | - python -m pip install --upgrade pip - pip install .[dev,interop] - displayName: 'Install dependencies' - - - script: | - pip install pytest pytest-azurepipelines - coverage run -m pytest # Run the tests and check for test coverage. - coverage report -m # Generate test coverage report. - displayName: 'pytest and coverage' - - - script: | - make -C docs html # Build the documentation. - displayName: 'make documentation' diff --git a/.azure-pipelines/azure-pipelines-macos.yml b/.azure-pipelines/azure-pipelines-macos.yml deleted file mode 100644 index ee288fa49..000000000 --- a/.azure-pipelines/azure-pipelines-macos.yml +++ /dev/null @@ -1,30 +0,0 @@ -# Python package -# Create and test a Python package on multiple Python versions. -# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more: -# https://docs.microsoft.com/azure/devops/pipelines/languages/python - -jobs: -- job: macos - pool: - vmImage: macOS-latest - timeoutInMinutes: 360 - strategy: - matrix: - macos_python3.11: - python.version: '3.11' - - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '$(python.version)' - displayName: 'Use Python $(python.version)' - - - script: | - python -m pip install --upgrade pip - pip install .[all] - displayName: 'Install dependencies' - - - script: | - pip install pytest pytest-azurepipelines - pytest - displayName: 'pytest' diff --git a/.azure-pipelines/azure-pipelines-win.yml b/.azure-pipelines/azure-pipelines-win.yml deleted file mode 100644 index ff8ac0b16..000000000 --- a/.azure-pipelines/azure-pipelines-win.yml +++ /dev/null @@ -1,34 +0,0 @@ -# Python package -# Create and test a Python package on multiple Python versions. -# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more: -# https://docs.microsoft.com/azure/devops/pipelines/languages/python - -jobs: -- job: win - pool: - vmImage: windows-latest - timeoutInMinutes: 360 - strategy: - matrix: - win_python3.11: - python.version: '3.11' - - steps: - - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" - displayName: Add conda to PATH - - - script: conda create --yes --quiet --name andesEnv - displayName: Create Anaconda environment - - - script: | - call activate andesEnv - conda install --yes --quiet --name andesEnv python=%PYTHON_VERSION% - displayName: Install Anaconda packages - - - script: | - call activate andesEnv - python -m pip install --upgrade pip - pip install pytest pytest-azurepipelines - pip install .[dev,interop] - pytest - displayName: pytest diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 8eb432b55..b976990a7 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -3,48 +3,107 @@ name: Python application on: [push, pull_request] jobs: - build: - name: ANDES Tests - runs-on: ubuntu-latest + test: + name: Test (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] steps: - uses: actions/checkout@v4 with: - fetch-depth: 0 # Required for setuptools-scm - - uses: conda-incubator/setup-miniconda@v3 + fetch-depth: 0 + + - uses: actions/setup-python@v5 with: - miniforge-variant: Miniforge3 - miniforge-version: latest - use-mamba: true python-version: '3.11' - channels: conda-forge,defaults - channel-priority: true - activate-environment: test-env - - shell: bash -el {0} - name: Install dependencies - run: | - mamba install -y nbmake pytest-xdist line_profiler flake8 pytest build - pip install -e .[dev] - - shell: bash -el {0} - name: Run pip check - run: | - pip check - - shell: bash -el {0} - name: Lint with flake8 - if: github.event_name == 'pull_request' - run: | - flake8 . - - shell: bash -el {0} - name: Run tests + + - name: Install dependencies + run: pip install -e .[dev,interop] + + - name: Run tests with coverage + if: matrix.os == 'ubuntu-latest' run: | - pytest - pytest --nbmake examples --ignore=examples/verification - - shell: bash -el {0} - name: Build and publish if tagged - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + coverage run -m pytest + coverage report -m + + - name: Run tests + if: matrix.os != 'ubuntu-latest' + run: pytest + + lint: + name: Lint + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install flake8 + run: pip install flake8 + + - name: Lint with flake8 + run: flake8 . + + notebooks: + name: Notebook Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install dependencies + run: pip install -e .[dev,interop] + + - name: Run notebook tests + run: pytest --nbmake examples --ignore=examples/verification + + docs: + name: Build Docs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install dependencies + run: pip install -e .[dev,interop] + + - name: Build docs + run: make -C docs html + + publish: + name: Publish to PyPI + runs-on: ubuntu-latest + needs: [test, notebooks, docs] + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Build and publish run: | + pip install build twine python -m build - pip install twine twine upload dist/* env: TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.pypi_password }} \ No newline at end of file + TWINE_PASSWORD: ${{ secrets.pypi_password }} diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 79aa27eab..000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,4 +0,0 @@ -jobs: - - template: ./.azure-pipelines/azure-pipelines-linux.yml - - template: ./.azure-pipelines/azure-pipelines-macos.yml - - template: ./.azure-pipelines/azure-pipelines-win.yml \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 66375349a..5182d41af 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,9 +22,9 @@ classifiers = [ ] dependencies = [ - "kvxopt>=1.3.2.0", + "kvxopt>=1.3.2.0,<1.4", "numpy", - "scipy<1.14", + "scipy<=1.16.3", "sympy>=1.6,!=1.10.0", "pandas", "matplotlib", @@ -33,6 +33,7 @@ dependencies = [ "dill", "pathos", "tqdm", + "ipywidgets", "pyyaml", "coloredlogs", "chardet", @@ -45,7 +46,10 @@ dependencies = [ dev = [ "coverage", "pytest==7.4", + "pytest-xdist", + "nbmake", "flake8", + "line_profiler", "sphinx", "ipython", "numpydoc", @@ -68,7 +72,7 @@ doc = [ "mdit-py-plugins>=0.3.1,<0.4", ] interop = [ - "pandapower", + "pandapower>=3,<=3.3", "pypowsybl", ] web = [