Skip to content

Fixing / documenting how editable installs with --install-dir=$path work #2589

Open
@dwt

Description

@dwt

Hi there,

since pypa/pip#9636 got merged, setuptools is now next in line. :-)

I'd like some input on how to proceed here, as I am still quite new to setuptools.

Some immediate thoughts, I think it would be safe to document that right now (i.e. with the next version of pip) it will work to use pip install --target $target --editable path/to/package which is then equivalent to… I'm actually not quite sure yet, python setup.py develop --install-dir=$targetI think? And to activate the packages in that directory code like this can be used:

def add_site(path):
    """This adds a path to as proper site packages to all associated import
    systems.  Primarily it invokes `site.addsitedir` and also configures
    pkg_resources' metadata accordingly.
    """
    site.addsitedir(path)
    ws = pkg_resources.working_set
    ws.entry_keys.setdefault(path, [])
    ws.entries.append(path)
    for dist in pkg_resources.find_distributions(path, False):
        ws.add(dist, path, insert=True)

Then, second would be the question how to best proceed with this in setuptools? A simple thing could be to add code like this in setuptools to ensure .egg-link's in directories on the python path are recognised? I have actually not yet started looking into how setuptools can actually do something there.

I'm not sure yet how backwards compatibility concerns play a role here, but flit allows to just symlink the installed package or allows using .pth files to achieve the same effect.

It is my understanding that even Windows supports symlinks nowadays, so maybe that is a really attractive option to change the install and simplify all the code in question?

Well, some code reading is probably next, but I wanted to open a space for discussion on how to proceed here, so: feedback welcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions