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

DeprecationWarning for distutils package #52

Open
woidda opened this issue Mar 22, 2022 · 4 comments
Open

DeprecationWarning for distutils package #52

woidda opened this issue Mar 22, 2022 · 4 comments

Comments

@woidda
Copy link

woidda commented Mar 22, 2022

It seems that distutils will be soon be obsolete.

/usr/local/lib/python3.10/site-packages/dataclass_csv/dataclass_reader.py:5
  /usr/local/lib/python3.10/site-packages/dataclass_csv/dataclass_reader.py:5: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
    from distutils.util import strtobool
@dfurtado
Copy link
Owner

Hi Walter!

Oh, good catch! Thank you so much for letting me know. 👍🏼

I will fix that. 👷🏼

@dupuyarc
Copy link

dupuyarc commented Apr 25, 2024

Python 3.12 has been out for a few months, I tried to use the dataclass-csv package and I'm getting this error:

...lib/python3.12/site-packages/dataclass_csv/dataclass_reader.py", line 5, in <module>
    from distutils.util import strtobool
ModuleNotFoundError: No module named 'distutils'

The dataclass I am using for this doesn't even have any bool attributes, just some Optional[str] and mostly just str.

@dupuyarc
Copy link

dupuyarc commented Apr 25, 2024

For what it's worth, adding a dependency on setuptools in my package works around the problem (since setuptools implements most or all of distutils, and patches sys.modules so that distutils references go to setuptools.

fkleon added a commit to fkleon/lsetwatch-csv that referenced this issue May 26, 2024
@theta-lin
Copy link

Also to confirm here that distutils is removed from Python 3.12, which is also mentioned in What's New In Python 3.12. Manually installing setuptools indeed fixes this issue. However, as I can see that distutil's only use is to convert string to bool, I guess implementing strtobool() manually wouldn't hurt.

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

No branches or pull requests

4 participants