Command Line Interface
@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.
Customizing virtual environment
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
What if the
glean command is called from inside an active virtual environment?
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.
Preventing automatic installation of
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)