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

Open
#2,589 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
python
Domain
build-system

Research direction

The issue names pip install --target ... --editable, python setup.py develop --install-dir, and site.addsitedir with pkg_resources, but no repository files or tests. First establish current setuptools behavior and compatibility constraints; done requires a decided, reproducible behavior with either documentation scope or an implementation plan.

Written by the indexing model from the issue text.

Description

Hi there,

since https://github.com/pypa/pip/pull/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.

Dominant language
Python
Stars
2.9k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pypa/setuptools

All issues in pypa/setuptools

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.