@mozilla/glean package exposes the
This utility installs
glean_parser in a virtual environment
and allows users to execute
glean_parser command through it.
In order to get a list of all commands available run
npx glean --help.
glean CLI will look for / create a
.venv virtual environment
at the directory it is called from and install
glean_parser there by default.
However, it is possible to customize the directory in which it looks for a virtual environment,
by setting the
VIRTUAL_ENV environment variable. Example:
VIRTUAL_ENV="my/venv/path" npx glean --help
By default Glean will try and use specific binaries based on the platform:
python.exe on windows and
python3 everywhere else. You can customize the Python binary used through environment variables. You are able to define both
export GLEAN_PYTHON=<path_to_python_binary> export GLEAN_PIP=<path_to_pip_binary>
SET GLEAN_PYTHON=<path_to_python_binary> SET GLEAN_PIP=<path_to_pip_binary>
VIRTUAL_ENVenvironment variable is automatically set while a virtual environment in active, in which case Glean will not create a new environment, but use the currently active one.
In order to prevent the
glean CLI from installing
glean_parser itself, it must be provided
with the path to a virtual environment that already has
When doing that it is important to keep the separate installation of
glean_parser in sync with
the version expected by the Glean SDK version in use. The
glean CLI exposes the
--glean-parser-version command that returns the expected version of
for such use cases.
With this command it is possible to something like:
pip install -U glean_parser==$(npx glean --glean-parser-version)