-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switched from miniconda-setup to micromamba-setup for mypy workflow (#…
…781) * Switched from miniconda to micromamba for mypy workflow * setup-micromamba for test.yml * Specified environment-name for test.yml * Changed mamba to micromamba for test.yml
- Loading branch information
Showing
2 changed files
with
81 additions
and
90 deletions.
There are no files selected for viewing
This file contains 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 file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,11 +55,11 @@ jobs: | |
matrix: | ||
python-version: ["3.10", "3.12"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: pre-commit/[email protected] | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: pre-commit/[email protected] | ||
|
||
test_ubuntu: | ||
name: "Test py${{ matrix.python-version }} : fast-compile ${{ matrix.fast-compile }} : float32 ${{ matrix.float32 }} : ${{ matrix.part }}" | ||
|
@@ -72,8 +72,8 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
python-version: ["3.10", "3.12"] | ||
fast-compile: [0,1] | ||
float32: [0,1] | ||
fast-compile: [0, 1] | ||
float32: [0, 1] | ||
install-numba: [0] | ||
install-jax: [0] | ||
part: | ||
|
@@ -84,7 +84,7 @@ jobs: | |
- "tests/tensor/conv" | ||
- "tests/tensor/rewriting" | ||
- "tests/tensor/test_math.py" | ||
- "tests/tensor/test_basic.py tests/tensor/test_inplace.py" | ||
- "tests/tensor/test_basic.py tests/tensor/test_inplace.py" | ||
- "tests/tensor/test_blas.py tests/tensor/test_elemwise.py tests/tensor/test_math_scipy.py" | ||
exclude: | ||
- python-version: "3.10" | ||
|
@@ -121,11 +121,13 @@ jobs: | |
with: | ||
fetch-depth: 0 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: conda-incubator/setup-miniconda@v3 | ||
uses: mamba-org/setup-micromamba@v1 | ||
with: | ||
miniforge-variant: Mambaforge | ||
miniforge-version: latest | ||
python-version: ${{ matrix.python-version }} | ||
environment-name: pytensor-test | ||
micromamba-version: "latest" | ||
init-shell: bash | ||
post-cleanup: "all" | ||
create-args: python=${{ matrix.python-version }} | ||
|
||
- name: Create matrix id | ||
id: matrix-id | ||
|
@@ -138,13 +140,13 @@ jobs: | |
echo "id=$MATRIX_ID" >> $GITHUB_OUTPUT | ||
- name: Install dependencies | ||
shell: bash -l {0} | ||
shell: micromamba-shell {0} | ||
run: | | ||
mamba install --yes -q "python~=${PYTHON_VERSION}=*_cpython" mkl numpy scipy pip mkl-service graphviz cython pytest coverage pytest-cov pytest-benchmark pytest-mock sympy | ||
if [[ $INSTALL_NUMBA == "1" ]]; then mamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" "numba>=0.57"; fi | ||
if [[ $INSTALL_JAX == "1" ]]; then mamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" jax jaxlib numpyro && pip install tensorflow-probability; fi | ||
micromamba install --yes -q "python~=${PYTHON_VERSION}=*_cpython" mkl numpy scipy pip mkl-service graphviz cython pytest coverage pytest-cov pytest-benchmark pytest-mock sympy | ||
if [[ $INSTALL_NUMBA == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" "numba>=0.57"; fi | ||
if [[ $INSTALL_JAX == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" jax jaxlib numpyro && pip install tensorflow-probability; fi | ||
pip install -e ./ | ||
mamba list && pip freeze | ||
micromamba list && pip freeze | ||
python -c 'import pytensor; print(pytensor.config.__str__(print_doc=False))' | ||
python -c 'import pytensor; assert pytensor.config.blas__ldflags != "", "Blas flags are empty"' | ||
env: | ||
|
@@ -153,7 +155,7 @@ jobs: | |
INSTALL_JAX: ${{ matrix.install-jax }} | ||
|
||
- name: Run tests | ||
shell: bash -l {0} | ||
shell: micromamba-shell {0} | ||
run: | | ||
if [[ $FAST_COMPILE == "1" ]]; then export PYTENSOR_FLAGS=$PYTENSOR_FLAGS,mode=FAST_COMPILE; fi | ||
if [[ $FLOAT32 == "1" ]]; then export PYTENSOR_FLAGS=$PYTENSOR_FLAGS,floatX=float32; fi | ||
|
@@ -175,55 +177,57 @@ jobs: | |
path: coverage/coverage-${{ steps.matrix-id.outputs.id }}.xml | ||
|
||
benchmarks: | ||
name: "Benchmarks" | ||
needs: | ||
- changes | ||
- style | ||
runs-on: ubuntu-latest | ||
if: ${{ needs.changes.outputs.changes == 'true' && needs.style.result == 'success' }} | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Python 3.10 | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
miniforge-variant: Mambaforge | ||
miniforge-version: latest | ||
- name: Install dependencies | ||
shell: bash -l {0} | ||
run: | | ||
mamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" mkl numpy scipy pip mkl-service cython pytest "numba>=0.57" jax jaxlib pytest-benchmark | ||
pip install -e ./ | ||
mamba list && pip freeze | ||
python -c 'import pytensor; print(pytensor.config.__str__(print_doc=False))' | ||
python -c 'import pytensor; assert pytensor.config.blas__ldflags != "", "Blas flags are empty"' | ||
env: | ||
PYTHON_VERSION: 3.10 | ||
- name: Download previous benchmark data | ||
uses: actions/cache@v4 | ||
with: | ||
path: ./cache | ||
key: ${{ runner.os }}-benchmark | ||
- name: Run benchmarks | ||
shell: bash -l {0} | ||
run: | | ||
export PYTENSOR_FLAGS=mode=FAST_COMPILE,warn__ignore_bug_before=all,on_opt_error=raise,on_shape_error=raise,gcc__cxxflags=-pipe | ||
python -m pytest --runslow --benchmark-only --benchmark-json output.json | ||
- name: Store benchmark result | ||
uses: benchmark-action/github-action-benchmark@v1 | ||
with: | ||
name: Python Benchmark with pytest-benchmark | ||
tool: 'pytest' | ||
output-file-path: output.json | ||
external-data-json-path: ./cache/benchmark-data.json | ||
alert-threshold: '200%' | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
comment-on-alert: false | ||
fail-on-alert: false | ||
auto-push: false | ||
name: "Benchmarks" | ||
needs: | ||
- changes | ||
- style | ||
runs-on: ubuntu-latest | ||
if: ${{ needs.changes.outputs.changes == 'true' && needs.style.result == 'success' }} | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Python 3.10 | ||
uses: mamba-org/setup-micromamba@v1 | ||
with: | ||
environment-name: pytensor-test | ||
micromamba-version: "latest" | ||
init-shell: bash | ||
post-cleanup: "all" | ||
- name: Install dependencies | ||
shell: micromamba-shell {0} | ||
run: | | ||
micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" mkl numpy scipy pip mkl-service cython pytest "numba>=0.57" jax jaxlib pytest-benchmark | ||
pip install -e ./ | ||
micromamba list && pip freeze | ||
python -c 'import pytensor; print(pytensor.config.__str__(print_doc=False))' | ||
python -c 'import pytensor; assert pytensor.config.blas__ldflags != "", "Blas flags are empty"' | ||
env: | ||
PYTHON_VERSION: 3.10 | ||
- name: Download previous benchmark data | ||
uses: actions/cache@v4 | ||
with: | ||
path: ./cache | ||
key: ${{ runner.os }}-benchmark | ||
- name: Run benchmarks | ||
shell: micromamba-shell {0} | ||
run: | | ||
export PYTENSOR_FLAGS=mode=FAST_COMPILE,warn__ignore_bug_before=all,on_opt_error=raise,on_shape_error=raise,gcc__cxxflags=-pipe | ||
python -m pytest --runslow --benchmark-only --benchmark-json output.json | ||
- name: Store benchmark result | ||
uses: benchmark-action/github-action-benchmark@v1 | ||
with: | ||
name: Python Benchmark with pytest-benchmark | ||
tool: "pytest" | ||
output-file-path: output.json | ||
external-data-json-path: ./cache/benchmark-data.json | ||
alert-threshold: "200%" | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
comment-on-alert: false | ||
fail-on-alert: false | ||
auto-push: false | ||
|
||
all-checks: | ||
if: ${{ always() }} | ||
|