Skip to content

Commit

Permalink
Fix pandas version check, require Python ≥ 3.8 (#110)
Browse files Browse the repository at this point in the history
* Fix pandas version check

* Require python 3.8+

* Sort imports

* Update workflows to include Python 3.12 and use Python 3.10 as minimum version

---------

Co-authored-by: Tomas Capretto <tomicapretto@gmail.com>
  • Loading branch information
kddubey and tomicapretto authored Sep 22, 2024
1 parent 151db43 commit 1b91143
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: "3.9"
python-version: "3.10"

- name: Install Dependencies
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.9"
python-version: "3.10"

- name: Install dependencies
run: python3 -m pip install --upgrade build
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.9"
python-version: "3.10"

- name: Install twine
run: python3 -m pip install --upgrade twine
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.9"
python-version: "3.10"

- name: Install twine
run: python3 -m pip install --upgrade twine
Expand Down
4 changes: 3 additions & 1 deletion formulae/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import numpy as np
import pandas as pd

from packaging.version import Version


def listify(obj):
"""Wrap all non-list or tuple objects in a list.
Expand Down Expand Up @@ -44,7 +46,7 @@ def get_interaction_matrix(x, y):
def is_categorical_dtype(arr_or_dtype):
"""Check whether an array-like or dtype is of the pandas Categorical dtype."""
# https://pandas.pydata.org/docs/whatsnew/v2.1.0.html#other-deprecations
if pd.__version__ < "2.1.0":
if Version(pd.__version__) < Version("2.1.0"):
return pd.api.types.is_categorical_dtype(arr_or_dtype)
else:
if hasattr(arr_or_dtype, "dtype"): # it's an array
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ requires = ["setuptools>=61.0", "setuptools_scm>=8"]
[project]
name = "formulae"
description = "Formulas for mixed-effects models in Python"
requires-python = ">=3.7"
requires-python = ">=3.8"
readme = {file = "README.md", content-type = "text/markdown"}
license = {file = "LICENSE"}
dynamic = ["version"]
maintainers = [{ name = "Tomás Capretto", email = "tomicapretto@gmail.com" }]

dependencies = [
"numpy>=1.16",
"packaging",
"pandas>=1.0.0",
"scipy>=1.5.4"
]
Expand Down

0 comments on commit 1b91143

Please sign in to comment.