AllenInstitute / AllenSDK

code for reading and processing Allen Institute for Brain Science data
https://allensdk.readthedocs.io/en/latest/
Other
333 stars 149 forks source link

Update Dependency Compatibility #2716

Closed mikejhuang closed 10 months ago

mikejhuang commented 10 months ago

Include Python 3.11 compatibility, unpeg all dependencies and fix breaking changes from updated packages or downgrade packages.

Steps

1.Unpin requirements.txt

  1. Use poetry to setup supported python version range into pyproject.toml
  2. Add requirements.txt dependencies with poetry and resolve Python version compatibility issues
  3. xarray, scipy, and numpy versions adjusted to meet python version requirements
  4. Run tests by creating virtualenv with 3.8, 3.9, 3.10, 3.11
  5. For failing tests, either fix code or revert package version Final explicitly defined requirements
  6. Remove poetry created files (pyproject.toml, poetry.lock)

Fixes for compatibility

  1. pandas 1.1.5 -> 2.0.3
    • Int64Index deprecated https://github.com/pandas-dev/pandas/issues/42717
    • pd.Series.str.replace must specify regex=True if regex is used.
    • pd.Series.reindex with a MultiIndex can no longer take in single integer Index as an input
    • check_less_precise is a deprecated parameter in pd.testing.assert_series_equal. This is replaced with r_tol and a_tol
  2. numpy 1.23.5
    • np.bool, np.float, np.int are deprecated. Use 'bool', 'float', or 'int' instead.

Reverting versions instead of fixing

  1. hdmf=<3.4.7
  2. pandas<2.0.0
    • padas==2.0.3: VisualBehaviorProjectCache.get_ophys_session_table( index_column="ophys_experiment_id").index is type 'object', expected int64 All the values in this index are int64 so I'm not sure why it was loaded as an object type.