Skip to content

refactor: move from deprecated pkg_resources#1202

Open
JGSweets wants to merge 15 commits intocapitalone:mainfrom
JGSweets:fix-pkg-resource
Open

refactor: move from deprecated pkg_resources#1202
JGSweets wants to merge 15 commits intocapitalone:mainfrom
JGSweets:fix-pkg-resource

Conversation

@JGSweets
Copy link
Contributor

@JGSweets JGSweets commented Feb 10, 2026

this pr:

  • refactors out a deprecated library that is removed in the latest setuptools
  • refactors to move resources into the DP package
  • updates setuptools to utilize include_package_data instead of data_files
  • limit pandas due to compatibility issues <3.0.0
  • aberrations between scipy versions cause slight differences past the 10th decimal. use almost to validate
    • due to cdf on p-values
@JGSweets
Copy link
Contributor Author

@ryanSoley Can we get a review on this? It will allow DP to continue working with new setuptools.

Otherwise, this library will not work in system that utilize the most up to date setuptools

@JGSweets
Copy link
Contributor Author

@mhmotamedi any chances we could get a review on this for fixes?

from .base_model import BaseModel

default_labeler_dir = pkg_resources.resource_filename("resources", "labelers")
default_labeler_dir = utils.find_resources_dir() / "labelers"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Something I noticed is that after the call we’re adding a subdir for each call. Can we maybe just take that as input and return the full path as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great idea! I'll resolve that. Do you want this pr'ed into dev instead of main?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shania-m done! LMK if you need other updates, thanks!

Copy link
Member

@ryanSoley ryanSoley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@JGSweets
Copy link
Contributor Author

@ryanSoley @shania-m

anything that needs to be done to get the other checks to pass or merge?

Thanks!

return check_module


def find_resources_dir(resource_path: str | Path | None = None) -> Traversable:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a unit test for this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is inherently checked by many the other unit / integration tests.
Do you want one specifically for this?

Are there inputs / outputs you specifically want to test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI @shania-m

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants