Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lua equivalent of virtualenv? [closed]

Tags:

virtualenv

lua

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.

like image 560
weakish Avatar asked Dec 05 '10 12:12

weakish


People also ask

Is Pipenv the same as venv?

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.

How do I close virtualenv?

You can exit from the virtualenv using exit command, or by pressing Ctrl+d.

What happens when you deactivate a venv?

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.

Is virtualenv deprecated?

Virtualenv has been deprecated in Python 3.8.


2 Answers

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

like image 129
Zecc Avatar answered Oct 04 '22 04:10

Zecc


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.

like image 32
Michal Kottman Avatar answered Oct 04 '22 04:10

Michal Kottman