Skip to main content

frontend-editables is a library for installing Python packages for development, originally created as a proof of concept for PEP 662. It supports installing prospective “editable” wheels using one of four different methods:

  • “Lax” symlinking

    Symlinks top-level packages and modules only – the contents of packages can differ from those in the published distribution.

  • “Strict” symlinking

    Symlinks files only, faithfully mirroring the structure of packages as they would appear in the published distribution.

  • Redirector

    Generates a custom module finder which is used to load packages and modules from another location on disk and is injected in the sys.meta_path on start-up using a dynamic .pth file. This works similarly to the “lax” symlinking method – for more details, see editables.

  • Static .pth file

    Creates a .pth file which lists directories containing the distribution’s packages and modules, to add to the Python path. This will expose miscellaneous packages and modules which might be in the same folder.

Installation

$ python -m pip install frontend-editables

Basic usage

import sysconfig

import frontend_editables

path_mapping = ...  # Will have been returned by the backend.
installed_files = frontend_editables.install(
    [frontend_editables.PthFileInstaller],
    "name",
    sysconfig.get_path("purelib"),
    path_mapping,
)
# Then append the ``installed_files`` to the distribution's ``RECORD``,
# optionally by passing ``append_to_record=<path to RECORD>`` to ``install``.

The paths must map would-be wheel files to their absolute paths on disk; folder paths are invalid.

CLI

frontend_editables includes an extremely hacky CLI which serves a stopgap until editable installation is standardised. You can use this in place of python -m pip install -e .... The CLI supports all of the same layouts and installation methods supported by the library. Some examples:

  • To install a project with a single module foo.py, symlinking it: python -m frontend_editables.transitional_cli -m strict_symlink foo.py foo.py.

  • To install a project with a package foo, located in <project-root>/src/foo, with the aid of a pth file: python -m frontend_editables.transitional_cli -m pth_file src/foo foo.

  • To install a project with multiple packages at different locations, using the redirecting path finder: python -m frontend_editables.transitional_cli -m redirector {src/,}foo {lib/,}bar

Editable distributions can be uninstalled with pip as normal.

usage: python -m frontend_editables.transitional_cli [-h] --method
                                                     {lax_symlink,pth_file,redirector,strict_symlink}
                                                     [--spec SPEC]
                                                     path_pairs [path_pairs ...]

Wacky transitional editable project installer.

positional arguments:
  path_pairs            pairs of path on disk and corresponding path in the
                        virtual wheel (posix)

optional arguments:
  -h, --help            show this help message and exit
  --method {lax_symlink,pth_file,redirector,strict_symlink}, -m {lax_symlink,pth_file,redirector,strict_symlink}
                        editable installation method to use (default: None)
  --spec SPEC           requirement specifier (default: .)

Contributing

You can use frontend-editables to install frontend-editables for development:

$ PYTHONPATH=src python -m frontend_editables.transitional_cli \
    --spec .[test] {src/,}frontend_editables

Before opening a merge request, install nox and run nox. The type checking step has an external dependency on npm.

Happy hacking!

Metadata

Release files for frontend-editables 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for frontend-editables 0.2.0
File Size Uploaded
frontend-editables-0.2.0.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for frontend-editables 0.2.0
File Interpreter ABI Platform
frontend_editables-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.5 kB

Release files / frontend-editables-0.2.0.tar.gz

Download URL frontend-editables-0.2.0.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3fc3e48cb9f44c80174abf8f5c574fdd03f47ba721f40bbabff74991ba7a5fa6
BLAKE2b-256 checksum
How to use checksums
39de8bc54b1893ee71f5f813d1397490b7ace62d3a4f02503abda5ccd82b2497
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6

Release files / frontend_editables-0.2.0-py3-none-any.whl

Download URL frontend_editables-0.2.0-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d46cf45218a07bdff6932bbd2bc5e2674047b03f422493d4146b94455889ad4
BLAKE2b-256 checksum
How to use checksums
56b833bb07f0ab78a9007c27fe85bd2310dae1790ee2ce289ac0e39485a5fc26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page