Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip-sync 7.0.0 uninstalls pyproject-hooks #1917

Closed
tomazfs opened this issue Jul 17, 2023 · 11 comments · Fixed by #1919
Closed

pip-sync 7.0.0 uninstalls pyproject-hooks #1917

tomazfs opened this issue Jul 17, 2023 · 11 comments · Fixed by #1919
Labels
bug Something is not working

Comments

@tomazfs
Copy link

tomazfs commented Jul 17, 2023

pip-sync uninstalls pyproject-hooks, which is requirement of build package and indirectly requirement of pip-tools. End result is broken pip-tools installation.

Environment Versions

Windows 10
Python version: Python 3.11.4
pip version: pip 23.2
pip-tools version: pip-compile, version 7.0.0

Steps to replicate

  1. Create and activate venv
  2. Install pip-tools
  3. Create empty requirements.txt
  4. Run: pip-sync

Expected result

Everything up-to-date

Actual result

Found existing installation: pyproject_hooks 1.0.0
Uninstalling pyproject_hooks-1.0.0:
Successfully uninstalled pyproject_hooks-1.0.0

@atugushev
Copy link
Member

Confirmed. Thanks for the issue!

$ cat requirements.in
django

$ pip-compile
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
#    pip-compile
#
asgiref==3.7.2
    # via django
django==4.2.3
    # via -r requirements.in
sqlparse==0.4.4
    # via django

$ pip-sync -a
Would uninstall:
  pyproject_hooks
Would install:
  asgiref==3.7.2
  django==4.2.3
  sqlparse==0.4.4
Would you like to proceed with these changes? [y/N]:

@atugushev atugushev added the bug Something is not working label Jul 17, 2023
@AxelBjork
Copy link

I have got a similar bug with jaraco.classes

$ pip-sync requirements.txt

Found existing installation: jaraco.classes 3.2.3
Uninstalling jaraco.classes-3.2.3:
  Successfully uninstalled jaraco.classes-3.2.3
Looking in indexes: pypi/pip/simple
Collecting jaraco-classes==3.2.3 (from -r C:\Users\abc123\AppData\Local\Temp\tmp1dt72f1b (line 1))
  Using cached pypi/pip/packages/packages/60/28/220d3ae0829171c11e50dded4355d17824d60895285631d7eb9dee0ab5e5/jaraco.classes-3.2.3-py3-none-any.whl (6.0 kB)
Requirement already satisfied: more-itertools in c:\venv\lib\site-packages (from jaraco-classes==3.2.3->-r C:\Users\abc123\AppData\Local\Temp\tmp1dt72f1b (line 1)) (9.1.0)
Installing collected packages: jaraco-classes
Successfully installed jaraco-classes-3.2.3

This is done every sync, the requirements file contains the following line,

jaraco-classes==3.2.3

I have confirmed this does not happen with pip-tools-6.14.0 with the same requirements file.

@atugushev
Copy link
Member

t seems this PR #1885 might have broken pip-sync. There was some refactoring on the diff (what to install and what to uninstall) calculation.

cc @siddharthab

@atugushev
Copy link
Member

@tomazfs @AxelBjork could you test this fix #1919? Does it resolve the issue?

pip install git+https://github.com/atugushev/pip-tools@fix-broken-sync-diff

@AxelBjork
Copy link

$ pip install git+https://github.com/atugushev/pip-tools@fix-broken-sync-diff
Successfully built pip-tools
Installing collected packages: pip-tools
  Attempting uninstall: pip-tools
    Found existing installation: pip-tools 7.0.0
    Uninstalling pip-tools-7.0.0:
      Successfully uninstalled pip-tools-7.0.0
Successfully installed pip-tools-3.2.1.dev1039

$ pip-sync requirements.txt
Everything up-to-date

This works like expected again

@looztra
Copy link

looztra commented Jul 17, 2023

We faces the same problem, the fix works for us too ❤️

@siddharthab
Copy link
Contributor

Thank you for the fix. I should have paid more attention to canonicalizing the package name.

@atugushev
Copy link
Member

Thank you for the fix. I should have paid more attention to canonicalizing the package name.

@subhaminion, no worries! Unfortunately, pip-tools does not have as many integration tests for pip-sync as pip-compile does.

@tomazfs
Copy link
Author

tomazfs commented Jul 18, 2023

@tomazfs @AxelBjork could you test this fix #1919? Does it resolve the issue?

pip install git+https://github.com/atugushev/pip-tools@fix-broken-sync-diff

This works as expected.

@sshishov
Copy link

sshishov commented Jul 20, 2023

@atugushev @siddharthab , maybe you will add the test guys for you to have example requirements.in file with different cases, suffixes like [toml] etc to make sure that the regression will not happen?

UPDATE: see the tests were added in the MR 👍 Great Job!

@atugushev
Copy link
Member

@sshishov Thanks for pointing that out. I've added the necessary tests for each case. However, if you believe that something is missing, please feel free to open a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants