pysal / inequality

Measures of spatial (and non-spatial) inequality
https://pysal.org/inequality
BSD 3-Clause "New" or "Revised" License
28 stars 15 forks source link

deprecation of _indices #69

Closed sjsrey closed 2 months ago

sjsrey commented 5 months ago

xref #67

jGaboardi commented 5 months ago

Should we disable doctests for the _indices.py module to get CI green?

jGaboardi commented 5 months ago

@sjsrey shall we pick this back up again to get CI green?

martinfleis commented 5 months ago

Slight issue I see is that this warning is emitted by import inequality even if you're not interacting with the indices module. We may need to emit it in the functions themselves. Maybe a decorator?

jGaboardi commented 5 months ago

Looks like have a fresh exception being thrown by bleeding edge pandas now. If it's not something to simply let ride, we can open a new ticket for it.

201     >>> import libpysal
UNEXPECTED EXCEPTION: ImportError("cannot import name 'CachedAccessor' from 'pandas.core.accessor' (/home/runner/micromamba/envs/test/lib/python3.12/site-packages/pandas/core/accessor.py)")
Traceback (most recent call last):
  File "/home/runner/micromamba/envs/test/lib/python3.12/doctest.py", line 1361, in __run
    exec(compile(example.source, filename, "single",
  File "<doctest inequality.theil.TheilDSim[0]>", line 1, in <module>
  File "/home/runner/micromamba/envs/test/lib/python3.12/site-packages/libpysal/__init__.py", line 27, in <module>
    from . import cg, examples, io, weights
  File "/home/runner/micromamba/envs/test/lib/python3.12/site-packages/libpysal/cg/__init__.py", line 12, in <module>
    from .voronoi import *
  File "/home/runner/micromamba/envs/test/lib/python3.12/site-packages/libpysal/cg/voronoi.py", line 10, in <module>
    import geopandas as gpd
  File "/home/runner/micromamba/envs/test/lib/python3.12/site-packages/geopandas/__init__.py", line 4, in <module>
    from geopandas.geodataframe import GeoDataFrame
  File "/home/runner/micromamba/envs/test/lib/python3.12/site-packages/geopandas/geodataframe.py", line 8, in <module>
    from pandas.core.accessor import CachedAccessor
ImportError: cannot import name 'CachedAccessor' from 'pandas.core.accessor' (/home/runner/micromamba/envs/test/lib/python3.12/site-packages/pandas/core/accessor.py)
/home/runner/work/inequality/inequality/inequality/theil.py:201: UnexpectedException
jGaboardi commented 5 months ago

Should we disable doctests for the _indices.py module to get CI green?

We still need to address these failures, either by skipping or updating.

martinfleis commented 5 months ago

@jGaboardi that is fixed by https://github.com/geopandas/geopandas/pull/3288

sjsrey commented 2 months ago

The remaining failure is related to codecov on macos-13.

@jGaboardi any suggestions?

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 98.2%. Comparing base (eb15ef6) to head (9a28ef2). Report is 3 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/pysal/inequality/pull/69/graphs/tree.svg?width=650&height=150&src=pr&token=LJmAqzGxV5&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pysal)](https://app.codecov.io/gh/pysal/inequality/pull/69?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pysal) ```diff @@ Coverage Diff @@ ## main #69 +/- ## ======================================= + Coverage 98.0% 98.2% +0.2% ======================================= Files 4 4 Lines 301 334 +33 ======================================= + Hits 295 328 +33 Misses 6 6 ``` | [Files](https://app.codecov.io/gh/pysal/inequality/pull/69?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pysal) | Coverage Δ | | |---|---|---| | [inequality/\_indices.py](https://app.codecov.io/gh/pysal/inequality/pull/69?src=pr&el=tree&filepath=inequality%2F_indices.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pysal#diff-aW5lcXVhbGl0eS9faW5kaWNlcy5weQ==) | `100.0% <100.0%> (ø)` | | | [inequality/gini.py](https://app.codecov.io/gh/pysal/inequality/pull/69?src=pr&el=tree&filepath=inequality%2Fgini.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pysal#diff-aW5lcXVhbGl0eS9naW5pLnB5) | `92.6% <ø> (ø)` | |
jGaboardi commented 2 months ago

Seems that it's actually pre-commit that's complaining. Did you run ruff check inequality locally before pushing?

jGaboardi commented 2 months ago

pre-commit.ci run

jGaboardi commented 2 months ago

pre-commit.ci autofix

jGaboardi commented 2 months ago

The bot is having trouble auto fixing the import sorting for some reason. Running ruff check inequality --fix locally should resolve the issue.

jGaboardi commented 2 months ago

pre-commit.ci autofix