Skip to content

Commit c10fc01

Browse files
committed
DOC: add simple editable installs documentation
Signed-off-by: Filipe Laíns <[email protected]>
1 parent 920c4bd commit c10fc01

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

docs/index.rst

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,56 @@ frontend, like ``builddir``, to specify the build directory to use/re-use. You
4949
can find more information about them in the `build options page`_.
5050

5151

52+
Editable installs
53+
-----------------
54+
55+
Editable installs allow you to install the project in such a way where you can
56+
edit the project source and have those changes be reflected in the installed
57+
module, without having to explicitly rebuild and reinstall.
58+
59+
The way it works on ``meson-python`` specifically, is that when you import a
60+
module of the project, it will be rebuilt on the fly. This means that project
61+
imports will take more time than usual.
62+
63+
You can use pip to install the project in editable mode.
64+
65+
66+
.. code-block::
67+
68+
python -m pip install -e .
69+
70+
71+
It might be helpful to see the output of the Meson_ commands. This is offered
72+
as a **provisional** feature, meaning it is subject to change.
73+
74+
If you want to temporarily enable the output, you can set the
75+
``MESONPY_EDITABLE_VERBOSE`` environment variable to a non-empty value. If this
76+
environment variable is present during import, the Meson_ commands and their
77+
output will be printed.
78+
79+
80+
.. code-block::
81+
82+
MESONPY_EDITABLE_VERBOSE=1 python my_script.py
83+
84+
85+
86+
This behavior can also be enabled by default by passing the ``editable-verbose``
87+
config setting when installing the project.
88+
89+
90+
.. code-block::
91+
92+
python -m pip install -e . --config-settings editable-verbose=true
93+
94+
95+
This way, you won't need to always set ``MESONPY_EDITABLE_VERBOSE`` environment
96+
variable, the Meson_ commands and their output will always be printed.
97+
98+
The ``MESONPY_EDITABLE_VERBOSE`` won't have any effect during the project
99+
install step.
100+
101+
52102
How does it work?
53103
=================
54104

0 commit comments

Comments
 (0)