-
-
Notifications
You must be signed in to change notification settings - Fork 139
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
Provide all of Lua 5.3/5.4 and LuaJIT in a single package #196
Comments
Hmm. Given how small the Lua implementations are, I think it would be cool if the Lupa wheels shipped just all available options, say, Lua 5.3/4 and LuaJIT, as a Package. Then importing "lupa" would just give you the latest Lua 5.x, as it's the case now, and importing "lupa.luajit2" would give you the same API but built with LuaJIT 2.x. This could all come from the current module implementation with a more elaborate build setup.
PR very welcome.
|
Module names to provide:
Basically, the It would probably also be a good idea to create a separate git submodule under |
I strongly support making lupa available with different Lua versions! I'm using lupa extensively for Wiktionary extraction (https://github.com/tatuylonen/wiktextract, or actually its subpackage https://github.com/tatuylonen/wikitextprocessor). Wiktionary uses Lua 5.2, and I have no way of upgrading the Wiktionary modules to Lua 5.3 or 5.4. I've coped with Lua 5.3 by patching the Lua source code using essentially a few dozen regexp-replaces, but it is a horrible kludge. Now with Lua 5.4, it has again changed in several incompatible ways, including changes in supported format strings and apparently the operation of metatables has also changed in subtle ways. It's coming to a point where I'll have to start building and releasing my own version of lupa compiled for an older version unless there is support for either selecting the version to use when creating a Lua context or installing a separate package. The proposed way of, e.g., lupa.lua53 works, but I would very much prefer using Lua 5.2. The English Wiktionary alone contains 322,000 lines of Lua 5.2 code, and when counting the other language editions and Wikipedia, it is probably millions of lines of Lua 5.2 code in Mediawiki projects alone. It is not going to get upgraded from Lua 5.2 any time soon, I think. I came to this repository with the intention of submitting an issue to request this feature. |
See #207 |
There is currently no build procedure for LuaJIT (although the sources are bundled) and building Lua 5.2.3 also fails. |
I got LuaJIT to build at least on Linux. That way, it can be used with a conditional import and a fallback to normal Lua. |
The PR is mostly working now. I'm not sure about the interface, though. It seems clumsy to write import lupa.lupa_lua54 as lupa Also, Rather, it would be nice to say import lupa.lua53 as lupa # or ... as lua ? and have Comments welcome. |
The incompatibility can be resolved with PEP 562 (module level That makes |
* Build multiple Lupa extension modules for the different bundled Lua versions. * Test all Lupa variants with all Lua versions, not just the latest. * setup.py: Make sure we always remove all known options from the command line, not just the ones that happen to be relevant. * Disable Py27 builds in appveyor due to certificate issues with the old git version. We still have Windows builds in Github Actions. * Improve output in case of LuaJIT build failures. * Import the latest extension module only on demand from "import lupa" (on Py3.7 and later, which have PEP 562: module __getattr__). * Update versions of dependencies and build matrix. Closes #196
The distributions from pip use the bundled Lua 5.3 implementation, not LuaJIT2.0.5 as the readme suggests
The text was updated successfully, but these errors were encountered: