Skip to content

ENH: add support for editable wheels #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ef3ad12
TST: bump mypy version
FFY00 Nov 30, 2022
1f2d517
MAINT: move cached_property backport to compat module
FFY00 Nov 24, 2022
ad00189
MAINT: add _WheelBuilder.normalized_name
FFY00 Nov 30, 2022
7c764be
ENH: add support for editable installs
FFY00 Nov 25, 2022
e99b3d0
MAINT: simplify Project.wheel
FFY00 Nov 30, 2022
72e88ea
MAINT: use pathlib.Path.as_posix in _WheelBuilder._install_path
FFY00 Nov 30, 2022
569a707
BUG: fix rebuild loop when the build tries to import the editable module
FFY00 Dec 9, 2022
c22ec4d
ENH: add editable-verbose config setting
FFY00 Dec 9, 2022
ebc70da
TST: add VEnv.python and VEnv.pip helpers
FFY00 Dec 10, 2022
f64dca1
TST: use pytest's tmp_path_factory fixture in venv creation
FFY00 Dec 10, 2022
0b4ac54
TST: add test for editable wheels
FFY00 Dec 10, 2022
72c8701
TST: add test for top_level_modules
FFY00 Dec 10, 2022
3416d0b
MAINT: use sysconfig in _debian_python on Python >=3.10
FFY00 Dec 13, 2022
1833569
MAINT: move top_level_modules to _WheelBuilder
FFY00 Dec 13, 2022
d0dc5d5
TST: ignore couldnt-parse warning in coverage
FFY00 Dec 13, 2022
7d7ff76
BUG: fix editable import path calculation when Meson does not match
FFY00 Dec 13, 2022
2305efb
MAINT: split path introspection into _introspection module
FFY00 Dec 13, 2022
920c4bd
BUG: fix deb_system sysconfing scheme addition version
FFY00 Dec 21, 2022
c10fc01
DOC: add simple editable installs documentation
FFY00 Dec 22, 2022
d0011ec
ENH: add error if we can't locate the project in the editable hook
FFY00 Dec 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.mesonpy-native-file.ini
.mesonpy/
docs/_build
*.pyc
.cache/
Expand Down
50 changes: 50 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,56 @@ frontend, like ``builddir``, to specify the build directory to use/re-use. You
can find more information about them in the `build options page`_.


Editable installs
-----------------

Editable installs allow you to install the project in such a way where you can
edit the project source and have those changes be reflected in the installed
module, without having to explicitly rebuild and reinstall.

The way it works on ``meson-python`` specifically, is that when you import a
module of the project, it will be rebuilt on the fly. This means that project
imports will take more time than usual.

You can use pip to install the project in editable mode.


.. code-block::

python -m pip install -e .


It might be helpful to see the output of the Meson_ commands. This is offered
as a **provisional** feature, meaning it is subject to change.

If you want to temporarily enable the output, you can set the
``MESONPY_EDITABLE_VERBOSE`` environment variable to a non-empty value. If this
environment variable is present during import, the Meson_ commands and their
output will be printed.


.. code-block::

MESONPY_EDITABLE_VERBOSE=1 python my_script.py



This behavior can also be enabled by default by passing the ``editable-verbose``
config setting when installing the project.


.. code-block::

python -m pip install -e . --config-settings editable-verbose=true


This way, you won't need to always set ``MESONPY_EDITABLE_VERBOSE`` environment
variable, the Meson_ commands and their output will always be printed.

The ``MESONPY_EDITABLE_VERBOSE`` won't have any effect during the project
install step.


How does it work?
=================

Expand Down
2 changes: 2 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ endif
py.install_sources(
'mesonpy/__init__.py',
'mesonpy/_compat.py',
'mesonpy/_editable.py',
'mesonpy/_elf.py',
'mesonpy/_introspection.py',
'mesonpy/_tags.py',
'mesonpy/_util.py',
'mesonpy/_wheelfile.py',
Expand Down
Loading