pyblish / pyblish-base

Pyblish base library - see https://github.com/pyblish/pyblish for details.
Other
123 stars 60 forks source link

Added fix for inspect.getargspec in Py3 #393

Closed munkybutt closed 1 year ago

munkybutt commented 1 year ago

This PR adds Py3 specific import for inspect.getfullargspec as inspect.getargspec is depreciated since Py3.0. More info here: https://docs.python.org/3/library/inspect.html#inspect.getargspec

This also removes warnings output from Pyblish upon plugin discovery which prints the following 3 times per plugin discovered: "DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec(), at line 350, in "...\pyblish\plugin.py"". This has a noticeable impact on startup performance for projects with a large number of plugins.

Py2: functionality remains unchanged Py3: tested in Py37 + Py39

antirotor commented 1 year ago

just hit the same issue, wanted to open PR for it and voila - its already here! Thanks

davidlatwe commented 1 year ago

Looks good to me. 🍻

I just did a quick codebase search and I found out that in here in pyblish/compat.py also uses deprecated inspect.getargspec. Should we also update that one?

The other appearance is in pyblish/vendor/mock.py, but it's for testing and it's a vendored module so maybe other PR when needed.

munkybutt commented 1 year ago

Really good point - I will fix those up too

munkybutt commented 1 year ago

looks like vendor/mock already has this handled: https://github.com/pyblish/pyblish-base/blob/master/pyblish/vendor/mock.py#L170

jedfrechette commented 1 year ago

inspect.getargspec has been removed from Python 3.11 so it's no longer just a matter of depreciation warnings and slower startup times. Pyblish currently will not run on the latest stable Python release because of this bug so it would be great to get this PR merged.

munkybutt commented 1 year ago

Bump - any chance of proceeding with a merge, especially as it is making Pyblish nonfunctional on Python 3.11

davidlatwe commented 1 year ago

Marcus is on vacation at the moment, should be back in a couple weeks. :)

munkybutt commented 1 year ago

Hey - any progress on getting this merged?

BigRoy commented 1 year ago

@mottosso @davidlatwe What's needed to get this merged?

mottosso commented 1 year ago

Hi everyone, sorry this slipped under my radar. Feel free to @mottosso me like the above to make it appear on my list of things todo.

As for the PR, this looks solid to me - short and sweet - and all tests still pass. Merging this!