Skip to content

Conversation

@andreicuceu
Copy link
Contributor

We need to stop using pkg_resources, as it's deprecated. This error has been appearing for a while, and it's now critical that we address it.

picca/py/picca/constants.py:10: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.

As far as I can tell, there are 3 places we use it:

I started this pull request to clean up the first instance because this also gets called from Vega. The part of the code that uses this function is very outdated, so I decided to remove that functionality entirely. This relates to an old blinding setup that was used at the level of the correlation function.

@iprafols could you please have a look at the other two instances? I think in the case of the true continuum, we still need the functionality, so we need to find a replacement. I recommend switching to pathlib, and having something like this function from lyatools: https://github.com/andreicuceu/lyatools/blob/main/lyatools/submit_utils.py#L194-L231. Also tagging @p-slash in case he has knows another clean way to replace it.

@andreicuceu
Copy link
Contributor Author

Note that we'll need to push an update to Vega at the same time as this is merged to maintain compatibility, because Vega directly calls picca_constants.Cosmo.

@iprafols
Copy link
Collaborator

I replaced its functionality by switching to importlib in TrueContinuum. For the tests, I used an alternative solution using os that we were already using for other tests. I think the code is now not using pkg_resources anywhere. I also needed to sligthly modify py/picca/constants.py due to some merge conflicts with master @andreicuceu can you double-check that you are happy with the changes? If so, I think we are ready to merge once @corentinravoux reviews the PR

Copy link
Contributor

@corentinravoux corentinravoux left a comment

Choose a reason for hiding this comment

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

The changes are minor, and it seems like the removed part is an unused blinding strategy.
Since this is passing all tests, I approve the PR.

@iprafols
Copy link
Collaborator

@andreicuceu , if you are happy with the changes we can merge this branch. Are you doing it to coordinate the Vega update?

@corentinravoux corentinravoux changed the title Clean-up pkg_resources [bump minor] Clean-up pkg_resources Sep 29, 2025
@corentinravoux
Copy link
Contributor

After sofware telecon: This will be merge along with a new vega public version that will contain similar changes

@andreicuceu andreicuceu added this pull request to the merge queue Oct 1, 2025
Merged via the queue into master with commit fb2b8ea Oct 1, 2025
12 of 16 checks passed
@corentinravoux corentinravoux deleted the remove_pkg_resources branch October 6, 2025 08:26
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.

4 participants