Is there a #python tool to automatically take a Python codebase and make it compatible with 3.11 *without dropping older versions*? (Hence: pyupgrade doesn't work for me IIUC)

In particular, I'm dealing with a project that uses `inspect.getargspec`, deprecated since Python 3.0 and finally removed in Python 3.11.

Follow

@astrojuanlu if those areas are not critical you could wrap them in a a conditional that checks that the python version is less than 3.11

docs.python.org/3/library/sys.

stackoverflow.com/a/1093331

@derickflorian Thanks for the suggestion! I was looking for a tool that would do that for me though :D

@astrojuanlu For sure, sorry I was just spitballing. The closest I can think of is to check if it’s less than 3.11. If it is then import inspect.getargspec.

If not do something like

inspect.getargspec = def blank_func():
pass

Since it’s python you can redefine it to just do nothing.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.