Skip to content

Commit

Permalink
Pin Python to 3.9 for statsmodels dev version (mlflow#10771)
Browse files Browse the repository at this point in the history
Signed-off-by: B-Step62 <[email protected]>
  • Loading branch information
B-Step62 committed Jan 9, 2024
1 parent a5f20de commit 8bc8297
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/cross-version-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,7 @@ jobs:
- name: Get python version
id: get-python-version
run: |
if { [ "${{ matrix.package }}" = "tensorflow" ] || [ "${{ matrix.package }}" = "scikit-learn" ]; } && [ "${{ matrix.version }}" = "dev" ]; then
python_version=3.9
else
python_version=$(python dev/get_minimum_required_python.py -p ${{ matrix.package }} -v ${{ matrix.version }} --python-versions "3.8,3.9")
fi
python_version=$(python dev/get_minimum_required_python.py -p ${{ matrix.package }} -v ${{ matrix.version }} --python-versions "3.8,3.9")
echo "version=$python_version" >> $GITHUB_OUTPUT
- uses: ./.github/actions/setup-python
with:
Expand Down
10 changes: 10 additions & 0 deletions dev/get_minimum_required_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,18 @@
from packaging.specifiers import SpecifierSet
from packaging.version import Version

# "dev" versions are installed from source so we can't programmatically get the required python.
_DEV_PACKAGES_PYTHON_VERSIONS = {
"tensorflow": ">=3.9",
"scikit-learn": ">=3.9",
"statsmodels": ">=3.9",
}


def get_requires_python(package: str, version: str) -> t.Optional[str]:
if version == "dev" and package in _DEV_PACKAGES_PYTHON_VERSIONS:
return _DEV_PACKAGES_PYTHON_VERSIONS[package]

resp = requests.get(f"https://pypi.python.org/pypi/{package}/json")
resp.raise_for_status()
return next(
Expand Down

0 comments on commit 8bc8297

Please sign in to comment.