Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deal with deprecated pkg_resources API #112

Closed
brews opened this issue Jul 20, 2023 · 1 comment · Fixed by #128
Closed

Deal with deprecated pkg_resources API #112

brews opened this issue Jul 20, 2023 · 1 comment · Fixed by #128
Assignees
Labels
bug Something isn't working

Comments

@brews
Copy link
Member

brews commented Jul 20, 2023

Doing anything with dscim spits out a

src/dscim/__init__.py:11
  /Users/username/Projects/dscim/src/dscim/__init__.py:11: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    import pkg_resources

because we're using pkg_resource in src/dscim/__init__.py and we're building with setuptools to build our package.

Need to rework this. There is a pretty good chance that this is setting __version__ to "999" because of the way it's coded.

@brews brews added the bug Something isn't working label Jul 20, 2023
@brews brews self-assigned this Jul 20, 2023
@brews
Copy link
Member Author

brews commented Jul 21, 2023

I ran into a similar problem updating parameterize_jobs, if we use hatchling and hatch-vcs to build the package instead of setuptools we can do something like this ClimateImpactLab/parameterize_jobs#131

This solves the problem because it keeps a __version__ attr and as far as I can tell this pkg_resources package is only used to get the package version.

The only alternative I know of is trying to import different packages that can get this version information -- and there are a couple of different packages that are all available or not available in different situations. I think xarray and textualize are two packages that opted for this solution. Choose your poison. I feel like the above solution we did for parameterize_jobs is the simplest. This is similar to how black solved the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant