python 3.11 support
quillcraftsman opened this issue ยท 25 comments
We use inspect.getargspec
in many modules. It's not working with python 3.11. It was deprecated since 3.3 python version.
- Make it works on python 3.11
- Run tests for python 3.10 and python 3.11
- Use tests in GitHub actions on 3.10 and 3.11
- Change in readme and on website.
Roger that
During build, I get a slight error:
Extracting lava_cactus-1.1.2-py3.11.egg to f:\webnprog\pythons\lavacactus\.env\lib\site-packages
File "f:\webnprog\pythons\lavacactus\.env\lib\site-packages\lava_cactus-1.1.2-py3.11.egg\cactus\skeleton\plugins\haml.disabled.py", line 42
print path
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
File "f:\webnprog\pythons\lavacactus\.env\lib\site-packages\lava_cactus-1.1.2-py3.11.egg\cactus\tests\data\skeleton\plugins\haml.disabled.py", line 42
print path
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
The builds works good, so I don't know if this is significant or not
BTW, can someone tell me what's happening here,
plugin\manager.py
:
def preBuildPage(self, site, page, context, data):
"""
Special call as we have changed the API for this.
We have two calling conventions:
- The new one, which passes page, context, data
- The deprecated one, which also passes the site (Now accessible via the page)
"""
for plugin in self.plugins:
# Find the correct calling convention
new = [page, context, data]
deprecated = [site, page, context, data]
arg_lists = dict((len(l), l) for l in [deprecated, new])
try:
# Try to find the best calling convention
n_args = len(getargspec(plugin.preBuildPage).args)
# Just use the new calling convention if there's fancy usage of
# *args, **kwargs that we can't control.
arg_list = arg_lists.get(n_args, new)
except NotImplementedError:
# If we can't get the number of args, use the new one.
arg_list = new
# Call with the best calling convention we have.
# If that doesn't work, then we'll let the error escalate.
context, data = plugin.preBuildPage(*arg_list)
return context, data
After I fixed the inspect.getargspec
issue by using inspect.signature
and then converting the values to previous format:
# Basically to format the code in previous way so it creates a facade that returned value is unchanged
class ArgumentInfo:
def __init__(self, args, varargs, varkw, defaults):
self.args = args
self.varargs = varargs
self.varkw = varkw
self.defaults = defaults
def get_argument_info(spec):
args = [param.name for param in spec.parameters.values()]
varargs = None
varkw = None
defaults = ()
for param in spec.parameters.values():
if param.default != inspect.Parameter.empty:
defaults += (param.default,)
return ArgumentInfo(args, varargs, varkw, defaults)
When I go cactus build
, I don't get deprecated error anymore but:
Traceback (most recent call last):
File "F:\WebNProg\Pythons\lavacactus\.env\Scripts\cactus-script.py", line 33, in <module>
sys.exit(load_entry_point('lava-cactus==1.1.2', 'console_scripts', 'cactus')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\WebNProg\Pythons\lavacactus\.env\Lib\site-packages\lava_cactus-1.1.2-py3.11.egg\cactus\cli.py", line 162, in cli_entrypoint
main(sys.argv[1:])
File "F:\WebNProg\Pythons\lavacactus\.env\Lib\site-packages\lava_cactus-1.1.2-py3.11.egg\cactus\cli.py", line 158, in main
ns.target(**kwargs)
File "F:\WebNProg\Pythons\lavacactus\.env\Lib\site-packages\lava_cactus-1.1.2-py3.11.egg\cactus\cli.py", line 51, in build
site.build()
File "F:\WebNProg\Pythons\lavacactus\.env\Lib\site-packages\lava_cactus-1.1.2-py3.11.egg\cactus\site.py", line 307, in build
self.build_with_translation()
File "F:\WebNProg\Pythons\lavacactus\.env\Lib\site-packages\lava_cactus-1.1.2-py3.11.egg\cactus\site.py", line 295, in build_with_translation
mapper(lambda p: p.build(), self.pages())
File "F:\WebNProg\Pythons\lavacactus\.env\Lib\site-packages\lava_cactus-1.1.2-py3.11.egg\cactus\utils\helpers.py", line 64, in map_apply
return list(map(fn, iterable))
^^^^^^^^^^^^^^^^^^^^^^^
File "F:\WebNProg\Pythons\lavacactus\.env\Lib\site-packages\lava_cactus-1.1.2-py3.11.egg\cactus\site.py", line 295, in <lambda>
mapper(lambda p: p.build(), self.pages())
^^^^^^^^^
File "F:\WebNProg\Pythons\lavacactus\.env\Lib\site-packages\lava_cactus-1.1.2-py3.11.egg\cactus\page.py", line 116, in build
data = self.render() #TODO: This calls preBuild indirectly. Not great.
^^^^^^^^^^^^^
File "F:\WebNProg\Pythons\lavacactus\.env\Lib\site-packages\lava_cactus-1.1.2-py3.11.egg\cactus\page.py", line 107, in render
context, data = self.site.plugin_manager.preBuildPage(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\WebNProg\Pythons\lavacactus\.env\Lib\site-packages\lava_cactus-1.1.2-py3.11.egg\cactus\plugin\manager.py", line 63, in preBuildPage
context, data = plugin.preBuildPage(*arg_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ContextPlugin.preBuildPage() takes 4 positional arguments but 5 were given
Now 5 arguments has been send to preBuildPage
. Debug arg_list
to see the difference.
The builds works good, so I don't know if this is significant or not
It's not a problem if build works. May be later we will fix it too.
Now 5 arguments has been send to
preBuildPage
. Debugarg_list
to see the difference.
Yeah currently I am almost to the root of the problem...
Okay I've fixed the issue, are there any special guidelines on how to comment the changes or anything like that?
Hey now when I do cactus build
, it builds okay but I get:
/about.html: static resource does not exist: static/js/vendor/jquery-3.7.0.js
/about.html: static resource does not exist: static/js/vendor/bootstrap.js
/contact.html: static resource does not exist: static/js/vendor/jquery-3.7.0.js
/contact.html: static resource does not exist: static/js/vendor/bootstrap.js
/error.html: static resource does not exist: static/js/vendor/jquery-3.7.0.js
/error.html: static resource does not exist: static/js/vendor/bootstrap.js
/index.html: static resource does not exist: static/js/vendor/jquery-3.7.0.js
/index.html: static resource does not exist: static/js/vendor/bootstrap.js
is this normal?
Hey now when I do
cactus build
, it builds okay but I get:/about.html: static resource does not exist: static/js/vendor/jquery-3.7.0.js /about.html: static resource does not exist: static/js/vendor/bootstrap.js /contact.html: static resource does not exist: static/js/vendor/jquery-3.7.0.js /contact.html: static resource does not exist: static/js/vendor/bootstrap.js /error.html: static resource does not exist: static/js/vendor/jquery-3.7.0.js /error.html: static resource does not exist: static/js/vendor/bootstrap.js /index.html: static resource does not exist: static/js/vendor/jquery-3.7.0.js /index.html: static resource does not exist: static/js/vendor/bootstrap.js
is this normal?
Yes, it is normal
Okay I've fixed the issue, are there any special guidelines on how to comment the changes or anything like that?
I will see pull request and add some comments may be
@hind-sagar-biswas , good job. Please check two comments: #11
Sorry but I don't see any comments ececpt for:
This branch has no conflicts with the base branch
Only those with write access to this repository can merge pull requests.
It supposed to be on conversation page (at the bottom) and on file changed page (near the code) in pull request: #11
Also I'll fix the probs
Strange, should be. Anybody else, check the comment in pull request please
Also, I already made the changes, please review
Good, I've added another one
Good, I've added another one
@quillcraftsman
LoL I still can't see any. I even tried to check from a logged-out browser, and it's the same there.
@hind-sagar-biswas , try it again, may be I forgot to submit a review.
@hind-sagar-biswas , try it again, may be I forgot to submit a review.
Yeah I replied the review @quillcraftsman
@hind-sagar-biswas , pull request has been accepted, nice play. This issue contains also tests and readme, I will continue with its myself (want to realese with python 3.11 today). You are welcome to focuses on other issues
Now lavacactus support 3.8-3.11 python version. All task have been done
Done in new release 1.2.0