What Is an Editable Install?

An editable install (also called a “development install”) installs a Python package so that changes to the source code are immediately reflected in the environment without requiring reinstallation. This creates a live link between the package’s source code and the Python environment where it’s installed.

ℹ️
Editable installs are primarily used during package development when you frequently modify the code and test changes. They are not typically used in production environments.

How Editable Installs Work

When you perform an editable install of a package, instead of copying the package files into your Python environment’s site-packages directory (as in a normal install), the package is installed using a special .pth file that points Python’s import system to your development directory containing the source code.

This means:

  1. Changes to your source code are immediately reflected when importing the package
  2. You don’t need to reinstall the package after each code change
  3. Your IDE can find and interact with the actual source code
  4. Any compiled extensions aren’t automatically rebuilt on changes

Limitations and Considerations

Editable installs have some limitations to keep in mind:

  • Not all build backends support editable installs
  • Compiled extensions require manual recompilation
  • Editable installs can be fragile if source files are moved
  • Some package features (like data files) may behave differently

Modern Editable Installs

PEP 660 introduced a standardized approach to editable installs that modern build backends can implement. This new mechanism addresses some historical limitations and inconsistencies across tools.

The implementation details vary by build backend, but the core concept remains: providing a development-friendly way to work on packages while testing them in a real Python environment.

Last updated on

Please submit corrections and feedback...