Is there something like python's virtualenv in lua?
So I can install all required lua modules/rocks in a sandboxed environment. This is good for test, since I will not mess up with system-wide lua modules or another lua project's environment.
luarocks looks promising since its support of self-contained installation. But I'm interested that if there is some tool like virtualenv which automates the creation, maintenance and switch of sandboxed environments.
pipenv. pipenv- like venv - can be used to create virtual envelopes but additionally rolls-in package management and vulnerability checking functionality. Instead of using requirements. txt , pipenv delivers package management via Pipfile.
You can exit from the virtualenv using exit command, or by pressing Ctrl+d.
By deactivating, you basically leave the virtual environment. Without deactivating your venv, all other Python code you execute, even if it is outside your project directory, will also run inside of the venv.
Virtualenv has been deprecated in Python 3.8.
It should be fairly simple to switch between Lua installs by setting the LUA_PATH
environment variable. Quoting this page from the Lua documentation:
To determine its path, require first checks the global variable LUA_PATH. If the value of LUA_PATH is a string, that string is the path. Otherwise, require checks the environment variable LUA_PATH.
[...]
The components in a path are separated by semicolons (a character seldom used for file names in most operating systems). For instance, if the path is
?;?.lua;c:\windows\?;/usr/local/lua/?/?.lua
then the call require"lili" will try to open the following files:
lili
lili.lua
c:\windows\lili
/usr/local/lua/lili/lili.lua
Have you tried LuaDist?
It solves exactly this issue by using so called 'deployments' - it is a single directory in which all dependencies and libraries (and even Lua interpreter) are installed, independent of the whole system.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With