Skip to content

Remove pkg_resources dependency from sambar.py#380

Open
marouenbg wants to merge 2 commits intonetZoo:develfrom
marouenbg:fix/remove-pkg-resources
Open

Remove pkg_resources dependency from sambar.py#380
marouenbg wants to merge 2 commits intonetZoo:develfrom
marouenbg:fix/remove-pkg-resources

Conversation

@marouenbg
Copy link
Contributor

Summary

Replace pkg_resources.resource_filename() with os.path.join(os.path.dirname(__file__), ...) in sambar.py for locating package data files.

Motivation

pkg_resources (from setuptools) is deprecated and scheduled for removal. It also creates an implicit dependency on setuptools which isn't part of the standard library and may not be available in all environments (e.g. pixi).

The replacement uses os.path which is in the standard library and already imported in the file.

Fixes #363

Changes

  • netZooPy/sambar/sambar.py: replaced import pkg_resources and 4 calls to pkg_resources.resource_filename() with os.path.join() relative to __file__.

Replace pkg_resources.resource_filename() with os.path.join() relative
to __file__ for locating package data files. This removes the dependency
on setuptools/pkg_resources which is deprecated and scheduled for removal.

Fixes netZoo#363
- test_cobra: use numpy array for mean computation instead of pandas
  Series integer access (KeyError: 0 with string column index)
- condor: use .iloc for positional access on iterrows() Series
  (KeyError: 2 with string column labels)
- condor: use ki.sum() instead of float(sum(ki)) to avoid TypeError
  with np.matrix column vectors in newer numpy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant