-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Import setuptools at init #448
Comments
I'm sure I'm not alone in not liking adding hacks like this.
Can we find a root cause of this? Why is webargs importing distutils?
Are they unwilling to address the problem they are creating?
We could also reopen the issue which discussed removing webargs as a
dependency. Removing webargs might be much easier than removing marshmallow.
…On 9/9/20 2:18 AM, Ari Hartikainen wrote:
Our package needs |setuptools|. And recently there have been warnings
that |setuptools| should be imported before the |distutils|.
|.../python3.8/site-packages/setuptools/distutils_patch.py:25:
UserWarning: Distutils was imported before Setuptools. This usage is
discouraged and may exhibit undesirable behaviors or errors. Please use
Setuptools' objects directly or at least import Setuptools first. |
Following our import path (from |app.py|) there is import for |webargs|,
which imports |distutils| in their init.
https://github.com/marshmallow-code/webargs/blob/dev/src/webargs/__init__.py
To fix this issue, I suggest that we import |setuptools| at
|__init__.py| and delete it after import
|import setuptools del setuptools |
This procedure makes sure that our library will import |setuptools|
first and then |distutils|. It is not foolproof, but at least works when
used normally.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#448>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJQUBVSBAP6N6VCUBHDPKB3SE4M3NANCNFSM4RBGL7LA>.
|
Yeah, this hack is not nice. They have this
also, this problem doesn't affect them, because they don't use setuptools (at runtime). |
Perhaps webargs could be persuaded to switch to setuptools's distutils's LooseVersion. Removing the dependency on webargs would be great though. Getting rid of marshmallow will take work. Getting rid of webargs might be much easier. |
I suspect this is going to be resolved somehow. Lots of people are affected by this. See pypa/setuptools#2230 If it doesn't get resolved, let's open a new issue to remove the dependency on webargs. |
Our package needs
setuptools
. And recently there have been warnings thatsetuptools
should be imported before thedistutils
.Following our import path (from
app.py
) there is import forwebargs
, which importsdistutils
in their init.https://github.com/marshmallow-code/webargs/blob/dev/src/webargs/__init__.py
To fix this issue, I suggest that we import
setuptools
at__init__.py
and delete it after importThis procedure makes sure that our library will import
setuptools
first and thendistutils
. It is not foolproof, but at least works when used normally.The text was updated successfully, but these errors were encountered: