Skip to content

Editable Installer: Handle changes cleanly #2855

Closed

Description

@abn

Today, the editable installer (poetry>1.0.10), does not handle removals of files (includes, console scripts etc.) cleanly. This needs to be improved.

There are two potential approaches,

  1. Handle the delta manually by using the *.dist-info/RECORD csv file. We could load the list prior to new install and then identify the delta after installation.
  2. Uninstall editable package explicitly (this today might need to use pip until poetry has an internal mechanism) prior to installation again. This might be cleaner as this should separate the concerns cleanly.

Reproduction

This issue can be reproduced as follows.

poetry new foo
pushd foo
sed -i /pytest/d pyproject.toml
echo 'def main(): print("hello world")' >> foo/__init__.py
printf '\n\n[tool.poetry.scripts]\nhello = "foo:main"' >> pyproject.toml
poetry install
sed -i s/hello/world/g pyproject.toml
poetry install

Today, once this is done, the following happens.

$ poetry run type hello
hello is /tmp/foo/.venv/bin/hello

We expect this to happen.

$ poetry run type hello
/usr/bin/type: line 2: type: hello: not found

Activity

  1. added
    area/installer
    kind/enhancement
    on Aug 26, 2020
  2. bhallaY commented on Sep 12, 2020

    @bhallaY

    Hi, I would like to attempt to resolve this issue! I can try to follow way 2 you specify.

  3. finswimmer commented on Nov 1, 2020

    @finswimmer
    Member

    Hello @bhallaY ,

    do you still like to work on this issue?

    fin swimmer

  4. akeeman commented on Nov 5, 2020

    @akeeman
    Contributor

    Just to be complete, as #3289 mentions, a set of related reproduction steps:

    # assuming poetry 1.1.4, in-project venv, and python 3.8:
    poetry new foo
    cd foo
    poetry install
    poetry version minor
    poetry install

    then

    ls .venv/lib/python3.8/site-packages/foo-*.dist-info

    outputs something similar to

    .venv/lib/python3.8/site-packages/foo-0.1.0.dist-info:
    INSTALLER  METADATA  RECORD
    
    .venv/lib/python3.8/site-packages/foo-0.2.0.dist-info:
    INSTALLER  METADATA  RECORD
    

    Therefore

    poetry run python -c "from importlib.metadata import version; print(version('foo'))"
    

    outputs

    0.1.0
    

    instead of the expected

    0.2.0
    

    .venv/lib/python3.8/site-packages/foo-0.1.0.dist-info should have been removed.

  5. abn commented on Apr 14, 2021

    @abn
    MemberAuthor

    Resolved by: #3900

  6. github-actions commented on Mar 2, 2024

    @github-actions

    This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  7. locked as resolved and limited conversation to collaborators on Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/installerkind/enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions