Editable installs#
We have support for editable installs! To use it, simply pass the
-e
/--editable
option to pip.
$ pip install -e .
This will install the project in the current directory in editable mode. When a
meson-python
package is installed in editable mode, it will be re-built the
first time it is imported. That means, the first time you import a module from
your package, it will take a bit longer.
What is the scope of editable installs?
The editable installs feature only targets the Python modules of the project.
This does include, though, native modules, which can be written in C, C++,
Rust, Cython, etc. With meson-python
such modules will be
automatically rebuilt when using editable installs.
Metadata-based features, like entry points, and similar mechanisms will not be updated when using editable installs. This is a limitation of editable installs specification itself.
Verbose mode#
It might be useful for you to see the output of Meson when the package is being re-built. We provide a verbose mode that does this, and can be enabled either temporarily, after the install, or permanently, in the install.
To enable the verbose mode on any existing meson-python
editable install,
you simply need to set the MESONPY_EDITABLE_VERBOSE
environment variable
to any non-null value.
$ MESONPY_EDITABLE_VERBOSE=1 python
To enable verbose mode permanently, you simply need to set the
editable-verbose
config setting to any
non-null value when installing the package.
With pip, you can do this as follows:
$ python -m pip install -e . --config-settings editable-verbose=true
MESONPY_EDITABLE_VERBOSE
will have no effect here
Please note that the MESONPY_EDITABLE_VERBOSE
environment variable will
not have any effect on the installation, it simply forces verbose mode to
be enabled after the package has been installed.