# Third try on editable installs

**URL:** <https://discuss.python.org/t/third-try-on-editable-installs/3986>\
**Category:** Packaging\
**Created:** [April 23, 2020, 8:15pm UTC](https://discuss.python.org/t/third-try-on-editable-installs/3986 "2020-04-23T20:15:28Z")\
**Posts on this page:** 8\
**Page:** 3

<div class="post-metadata">

**Author:** ![takluyver](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/takluyver/32/513_2.png) [@takluyver](https://discuss.python.org/u/takluyver)\
**Post date:** [May 4, 2020, 7:46am UTC](https://discuss.python.org/t/third-try-on-editable-installs/3986/41 "2020-05-04T07:46:39Z")

</div>

Thanks, I now understand the argument for listing every single file so that frontends can choose how to implement editable installs. However, I still have a couple of concerns about implementing my preferred way of doing this (a symlink in `site-packages` pointing to a package directory) on top of this information.

1. As @dholth asks, how much can the mapping rearrange files? I’d need to find not just a common prefix of a list of paths, but a common prefix from the source files which maps to a common prefix in the ‘virtual wheel’. And check that no other source files are being mapped into my destination prefix. This is already starting to sound messy.
2. If a backend _doesn’t_ list some files under a package directory, and the frontend does the editable install in a way that exposes the entire directory, including those unlisted files, is that valid? I can imagine backend authors saying that’s a bug in the frontend.

More detail from the backend ostensibly lets frontends choose how to do an editable install. But I’m concerned that it could prove impractical to do anything except what the specification is designed for - symlinking each individual file in newly created directories.

---

<div class="post-metadata">

**Author:** ![pf\_moore](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/pf_moore/32/35_2.png) [@pf\_moore](https://discuss.python.org/u/pf_moore)\
**Post date:** [May 4, 2020, 9:33am UTC](https://discuss.python.org/t/third-try-on-editable-installs/3986/42 "2020-05-04T09:33:54Z")

</div>

**Summary:** There are a number of things that _really_ need to be clarified, IMO, before we have a workable spec. I’ve noted the key things for me below. Hopefully thrashing those out is the point of doing the POC, and we’ll work on getting answers.

(Edit: Accidentally hit “send” too early. But I was only proof-reading, and I can’t face more editing, so please accept my apologies for any typos or weird formatting).

> [@pganssle](#):
>
> The thread is not that long, I strongly suggest reading it, it would save a lot of effort recapping everything.

OK, I’ve re-read it. As you say it’s not that long, but I still find the discussion hard to follow, so my apologies if I’ve misunderstood something. It’s also possible some or all of my issues were discussed at the packaging summit, but in the absence of any details I’ll assume not (and I don’t expect it matters much now anyway, as people will quite probably not remember all of any discussions that were had).

Things that bother me are:

1. We’re discussing “editable installs” without a proper definition of what an editable install actually is. The obvious definition is “what `setup.py develop` does”, but we’ve explicitly decided _not_ to copy that behaviour in a number of ways:
  - Adding a new (Python) file needs a reinstall in the proposed approach.
  - The behaviour around excluded directories becomes a front-end problem.  
I don’t believe anyone has actually discussed whether or not these changes are acceptable to people who _use_ editable installs (if that was discussed, I missed it). I’m not going to bring up my own view again, the point here is that we shouldn’t be relying just on our own views if we’re going to change behaviour.

2. The front end behaviour is badly under-specified at the moment. The proposal suggests that the backend provide a list of files and the front-end “make the files available”. That’s not an implementable spec for front ends. There’s discussions about symlinks or `.pth` files, but no real meat. That becomes very obvious when talking about the excluded files issue. The proposal doesn’t _actually_ solve that problem, it just makes it the front-end’s issue, and gives front ends no support in how they handle it.

At this point I’m going to specifically put my “pip maintainer” hat on.

I’m not at all happy with how this proposal leaves all of the technical questions on how to implement editables up to the front end1, while passing responsibility for what you yourself describe as a “huge bug” to the front end and yet claiming that “front ends don’t need to fix this bug”. If it’s such a huge bug, then yes, they do, because users will demand it, and appealing to the fact that the PEP says we can ignore it won’t make any difference. And the point of providing full lists of files is to allow front ends to address this issue - so if I advocate for pip to ignore this problem because the PEP lets us, and I don’t view it as particularly critical, then what’s the point in having all that extra mechanism in the proposal?

Similarly, there’s been talk about using symlinks, but not all platforms have reliable symlinks. So any solution either needs to be implementable _without_ symlinks, or front ends need to be willing to offer degraded support on platforms without symlinks. I’m OK with this being a front end choice, but personally, I’d advocate for pip using `.pth` files. So again, anything that’s in support of front ends using symlinks, who’s it going to be used by?

So what I’d like to see is:

1. A background section that details what editable mode _is_, and explains how the standard version differs from the version as implemented currently, so that we’re open about the changes.
2. A section in the proposal that describes the standard runtime layout for editable installs2, so that front ends have something to work with, and potential consumers don’t have to rely on implementation-defined layouts.
3. Better clarity over what front ends MUST do, what they SHOULD do, and what they are allowed to ignore3.

**Note:** I get that we’re only in “write a POC” stage at the moment, and so the standard isn’t written yet. But the POC is triggering these questions, and if we don’t come up with proper answers as part of doing the POC, there’s not much point. And let’s be realistic here - if the POC works, it’s _very_ unlikely we’ll just throw it away and write something different. So the code needs to implement the behaviour we want to have as the reference implementation.

Also, we do have UX specialists currently working on pip’s user interface. We could, I suspect, ask them to collect data on how people use editable mode and what they want from it (@sumanah please correct me if I’m speaking out of turn here and that would be out of scope for the work they are funded to do). But I’d be cautious about doing that unless we have some good, focused questions we want answering. Just asking for ideas will probably get either nothing useful, or too much for us to deal with (we’re already stretched just covering the questions we know about!)

1 We’re supposed to be _avoiding_ implementation-defined behaviour…  
2 I’m OK with labelling such a description as “provisional”, or “version 1”, but there will be consumers of this layout, as well as front ends producing it, and we should acknowledge taht and document the format.  
3 Given that pip is, in practical terms, the only front end at the moment, I’d argue that any feature in the spec that frontends can ignore and that pip is expected to ignore, should be an obvious candidate for omission on the grounds of YAGNI.

---

<div class="post-metadata">

**Author:** ![steve.dower](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/steve.dower/32/56_2.png) [@steve.dower](https://discuss.python.org/u/steve.dower)\
**Post date:** [May 4, 2020, 10:19am UTC](https://discuss.python.org/t/third-try-on-editable-installs/3986/43 "2020-05-04T10:19:25Z")

</div>

I have my own opinions on how an editable install layout should work, but they aren’t really that important here - I structure my code in a way that makes it easy for me to do manually.

One thing we as a Python/packaging community are often accused of is not being opinionated enough. We try very hard to accommodate all scenarios and all preferences, often leading to extended discussions like this and eventual confusion for users.

Perhaps this is a case where we could try being highly opinionated? Simply set down “if you want editable installs, your sources must/must not include/exclude/whatever” and build a tool that works with that.

My general impression of packaging right now is that more than having their cases supported, users just want to know what they _should_ do. Why don’t we just tell them?

---

<div class="post-metadata">

**Author:** ![sumanah](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/sumanah/32/1722_2.png) [@sumanah](https://discuss.python.org/u/sumanah)\
**Post date:** [May 4, 2020, 2:12pm UTC](https://discuss.python.org/t/third-try-on-editable-installs/3986/44 "2020-05-04T14:12:38Z")

</div>

> [@pf\_moore](#):
>
> Also, we do have UX specialists currently working on pip’s user interface. We could, I suspect, ask them to collect data on how people use editable mode and what they want from it (@sumanah please correct me if I’m speaking out of turn here and that would be out of scope for the work they are funded to do). But I’d be cautious about doing that unless we have some good, focused questions we want answering. Just asking for ideas will probably get either nothing useful, or too much for us to deal with (we’re already stretched just covering the questions we know about!)

We could look at getting some of the user experience folks’ time in the second half of the year, in [the third phase of the current funded project](https://wiki.python.org/psf/Pip2020DonorFundedRoadmap#Phase_III_.28Maintenance_and_Sustainability_work.2C_June-December_2020.29). Especially if someone can plausibly explain that the intersection of the new dependency resolver with editable installs causes, or will cause, extra confusion.

If there’s a specific deadline someone is trying to meet to ship better editable installs, then it would be good to know that. Otherwise I think it’s ok to start developing some questions for user experience researchers to ask, and pause other discussion and development till we have some answers.

---

<div class="post-metadata">

**Author:** ![pf\_moore](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/pf_moore/32/35_2.png) [@pf\_moore](https://discuss.python.org/u/pf_moore)\
**Post date:** [May 4, 2020, 2:31pm UTC](https://discuss.python.org/t/third-try-on-editable-installs/3986/45 "2020-05-04T14:31:21Z")

</div>

Thanks @sumanah. My feeling is that we shouldn’t rush into trying to do UX work, we need to be very sure we have specific questions and goals before going down that route. And at the moment the discussion feels too broad to make for a good set of questions. But it’s useful to know the option is there if we do get to the point where we could get value from it.

---

<div class="post-metadata">

**Author:** ![EpicWink](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/epicwink/32/17968_2.png) [@EpicWink](https://discuss.python.org/u/EpicWink)\
**Post date:** [May 4, 2020, 3:07pm UTC](https://discuss.python.org/t/third-try-on-editable-installs/3986/46 "2020-05-04T15:07:22Z")

</div>

> [@steve.dower](#):
>
> My general impression of packaging right now is that more than having their cases supported, users just want to know what they _should_ do.

```bash
python -c 'import this' | python -c 'import sys; print(sys.stdin.read().splitlines()[-7])'

```

---

<div class="post-metadata">

**Author:** ![RonnyPfannschmidt](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/ronnypfannschmidt/32/1714_2.png) [@RonnyPfannschmidt](https://discuss.python.org/u/RonnyPfannschmidt)\
**Post date:** [May 7, 2020, 8:24am UTC](https://discuss.python.org/t/third-try-on-editable-installs/3986/47 "2020-05-07T08:24:50Z")

</div>

in gumby\_elf i experimented with a entirely different approach for editable installs

instead of letting the installer handle it, i generated a wheel, which had ` __init__.py` in the packages that would set up ` __path__ ` and then execute the real code

that way namespace packages and corret metadata was trivially installable as the installer wuld get a wheel with a `+editable` local tag and a `+editable` in the version metadata

---

<div class="post-metadata">

**Author:** ![bernatgabor](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/bernatgabor/32/3003_2.png) [@bernatgabor](https://discuss.python.org/u/bernatgabor)\
**Post date:** [May 7, 2020, 8:30am UTC](https://discuss.python.org/t/third-try-on-editable-installs/3986/48 "2020-05-07T08:30:29Z")

</div>

I think this is where we are at the moment under [Next steps for editable / develop proof of concept](https://discuss.python.org/t/next-steps-for-editable-develop-proof-of-concept/4118/2)

[Previous page](https://discuss.python.org/t/third-try-on-editable-installs/3986.md?page=2)
