Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Specify MHKiT-Python version for tests and users #131

Merged
merged 14 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/code_compatibility_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ jobs:
fail-fast: false

matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
# os: [macos-13, ubuntu-latest, windows-latest]
os: [ubuntu-latest]
python-version: [3.8, 3.9, "3.10", 3.11]
matlab-version: [R2021b, R2022a, R2022b, R2023a, R2023b]

Expand All @@ -23,7 +24,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v2-beta
uses: matlab-actions/setup-matlab@v2
with:
release: ${{ matrix.matlab-version }}

Expand All @@ -38,7 +39,7 @@ jobs:
run: cat run.m

- name: Run code compatibility report
uses: matlab-actions/run-command@v1
uses: matlab-actions/run-command@v2
with:
command: run
startup-options: -noFigureWindows
49 changes: 32 additions & 17 deletions .github/workflows/unix_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:

env:
mhkit-python-dir: "MHKiT-Python"
MHKIT_PYTHON_VERSION: '0.7.0'
steps:
- name: Install & Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
Expand All @@ -41,18 +42,24 @@ jobs:
- name: Check out MHKiT-MATLAB
uses: actions/checkout@v4

- name: Check out MHKiT-Python
uses: actions/checkout@v4
with:
repository: "MHKiT-Software/MHKiT-Python"
path: ${{env.mhkit-python-dir}}
# - name: Check out MHKiT-Python
# uses: actions/checkout@v4
# with:
# repository: "MHKiT-Software/MHKiT-Python"
# path: ${{env.mhkit-python-dir}}

- name: pip install mhkit module from source
# - name: pip install mhkit module from source
# shell: bash -l {0}
# run: |
# conda activate mhkit_conda_env
# pip install -e .
# working-directory: ${{env.mhkit-python-dir}}

- name: pip install mhkit from pypi
shell: bash -l {0}
run: |
conda activate mhkit_conda_env
pip install -e .
working-directory: ${{env.mhkit-python-dir}}
pip install mhkit==$MHKIT_PYTHON_VERSION

- name: pip install mhkit-python-utils module from source
shell: bash -l {0}
Expand Down Expand Up @@ -122,6 +129,7 @@ jobs:
python-version: [3.8, 3.9, "3.10", 3.11]
# Note: It is preferred to use an actual release name as opposed to 'latest'
matlab-version: [R2021b, R2022a, R2022b, R2023a, R2023b, R2024a]
mhkit-python-version: ["0.7.0"]
exclude:
- python-version: "3.10" # cache_population job
matlab-version: R2022b
Expand Down Expand Up @@ -178,15 +186,16 @@ jobs:

env:
mhkit-python-dir: "MHKiT-Python"
MHKIT_PYTHON_VERSION: ${{ matrix.mhkit-python-version }}
steps:
- name: Check out MHKiT-MATLAB
uses: actions/checkout@v4

- name: Check out MHKiT-Python
uses: actions/checkout@v4
with:
repository: "MHKiT-Software/MHKiT-Python"
path: ${{env.mhkit-python-dir}}
# - name: Check out MHKiT-Python
# uses: actions/checkout@v4
# with:
# repository: "MHKiT-Software/MHKiT-Python"
# path: ${{env.mhkit-python-dir}}

- name: Install & Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
Expand Down Expand Up @@ -255,16 +264,22 @@ jobs:
conda activate mhkit_conda_env
python --version

- name: pip install mhkit module from source
working-directory: ${{env.mhkit-python-dir}}
# - name: pip install mhkit module from source
# working-directory: ${{env.mhkit-python-dir}}
# shell: bash -l {0}
# run: |
# conda activate mhkit_conda_env
# export PATH="${CONDA_PREFIX}/bin:${CONDA_PREFIX}/Library/bin:$PATH" # so setup.py finds nc-config
# pip install -e .

- name: pip install mhkit from pypi
shell: bash -l {0}
run: |
conda activate mhkit_conda_env
export PATH="${CONDA_PREFIX}/bin:${CONDA_PREFIX}/Library/bin:$PATH" # so setup.py finds nc-config
pip install -e .
pip install mhkit==$MHKIT_PYTHON_VERSION

- name: pip upgrade netcdf4
working-directory: ${{env.mhkit-python-dir}}
shell: bash -l {0}
run: |
conda activate mhkit_conda_env
Expand Down
54 changes: 37 additions & 17 deletions .github/workflows/windows_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:

env:
mhkit-python-dir: "MHKiT-Python"
MHKIT_PYTHON_VERSION: '0.7.0'
steps:
- name: Install/Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
Expand All @@ -37,17 +38,23 @@ jobs:
- name: Check out MHKiT-MATLAB
uses: actions/checkout@v4

- name: Check out MHKiT-Python
uses: actions/checkout@v4
with:
repository: "MHKiT-Software/MHKiT-Python"
path: ${{env.mhkit-python-dir}}
# - name: Check out MHKiT-Python
# uses: actions/checkout@v4
# with:
# repository: "MHKiT-Software/MHKiT-Python"
# path: ${{env.mhkit-python-dir}}

- name: pip install mhkit from source
working-directory: ${{env.mhkit-python-dir}}
# - name: pip install mhkit from source
# working-directory: ${{env.mhkit-python-dir}}
# run: |
# conda activate mhkit_conda_env
# pip3 install -e .

- name: pip install mhkit from pypi
shell: bash -l {0}
run: |
conda activate mhkit_conda_env
pip install -e .
pip install mhkit==$MHKIT_PYTHON_VERSION

- name: pip install mhkit-python-utils module from source
run: |
Expand Down Expand Up @@ -117,6 +124,7 @@ jobs:
os: [windows-latest]
python-version: [3.8, 3.9, "3.10", 3.11]
matlab-version: [R2021b, R2022a, R2022b, R2023a, R2023b, R2024a]
mhkit-python-version: ["0.7.0"]
exclude:
- matlab-version: R2022a
python-version: 3.9
Expand Down Expand Up @@ -152,6 +160,7 @@ jobs:

env:
mhkit-python-dir: "MHKiT-Python"
MHKIT_PYTHON_VERSION: ${{ matrix.mhkit-python-version }}
steps:
- name: Install/Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
Expand All @@ -164,41 +173,52 @@ jobs:

# This is necessary to fix any issues with netcdf4 and hdf5 headers
- name: "Conda install netcdf4, hdf5"
shell: bash -l {0}
run: |
conda activate mhkit_conda_env
conda install netcdf4 hdf5

- name: Output python executable
shell: bash -l {0}
run: |
conda activate mhkit_conda_env
python -c "import sys; print(sys.executable)"

- name: Print Python Version
shell: bash -l {0}
run: |
conda activate mhkit_conda_env
python --version

- name: Check out MHKiT-MATLAB
uses: actions/checkout@v4

- name: Check out MHKiT-Python
uses: actions/checkout@v4
with:
repository: "MHKiT-Software/MHKiT-Python"
path: ${{env.mhkit-python-dir}}
# - name: Check out MHKiT-Python
# uses: actions/checkout@v4
# with:
# repository: "MHKiT-Software/MHKiT-Python"
# path: ${{env.mhkit-python-dir}}

- name: pip install mhkit from source
working-directory: ${{env.mhkit-python-dir}}
# - name: pip install mhkit from source
# working-directory: ${{env.mhkit-python-dir}}
# run: |
# conda activate mhkit_conda_env
# pip3 install -e .

- name: pip install mhkit from pypi
shell: bash -l {0}
run: |
conda activate mhkit_conda_env
pip3 install -e .
pip install mhkit==$MHKIT_PYTHON_VERSION

- name: pip install mhkit-python-utils module from source
shell: bash -l {0}
run: |
conda activate mhkit_conda_env
pip3 install -e .

- name: List installed pip modules
shell: bash -l {0}
run: |
conda activate mhkit_conda_env
pip3 freeze
Expand Down Expand Up @@ -236,7 +256,7 @@ jobs:
conda activate mhkit_conda_env
printf "getenv('path')\nsetenv('path', ['%s;', getenv('path')])\ngetenv('path')\n" $(python -c "import sys; import os; print(os.path.dirname(sys.executable))") >> run.m

# OutOfProcess works reliably on linux and macos, on Windows
# OutOfProcess works reliably on linux, macos, and windows
- name: Configure MATLAB pyenv Version and ExecutionMode
shell: bash -l {0}
run: |
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,26 @@ See the [documentation](https://mhkit-software.github.io/MHKiT/) for more inform

## Installation

**NOTE:** MHKiT-MATLAB now requires the user to install a specific version of MHKiT-Python,
currently version `0.7.0`. You can achieve this by executing the following commands in the Anaconda
environment where MHKiT-Python is installed:

1. Uninstall the current version of MHKiT-Python:
```bash
pip uninstall mhkit
```

2. Install MHKiT-Python version `0.7.0`:
```bash
pip install mhkit==0.7.0
```

3. Verify the MHKiT-Python version:
```bash
python -c "import mhkit; print(mhkit.__version__)"
```


### Software Requirements

MHKiT-MATLAB utilizes Python functions from MHKiT-Python and requires the user to have
Expand Down