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

poetry lock --no-update fails for renamed path dependencies #6828

Closed
adriangb opened this issue Oct 18, 2022 · 2 comments · Fixed by python-poetry/poetry-core#520
Closed
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@adriangb
Copy link
Contributor

poetry -V
Poetry (version 1.3.0.dev0)

Example: https://github.com/adriangb/public-dump/tree/poetry

Scenario: you renamed pathdep/subproj to pathdep/subprojnew.
Note that it doesn't have to be pathdep/subproj it could be flat as long as path is then specified as ../subproj.

Run poetry lock --no-update -vvv and you get the following traceback. poetry lock works fine.

  12  ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/cleo/application.py:329 in run
       327│ 
       328│             try:
     → 329│                 exit_code = self._run(io)
       330│             except Exception as e:
       331│                 if not self._catch_exceptions:

  11  ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/poetry/console/application.py:185 in _run
       183│         self._load_plugins(io)
       184│ 
     → 185│         exit_code: int = super()._run(io)
       186│         return exit_code
       187│ 

  10  ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/cleo/application.py:423 in _run
       421│             io.input.set_stream(stream)
       422│ 
     → 423│         exit_code = self._run_command(command, io)
       424│         self._running_command = None
       425│ 

   9  ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/cleo/application.py:465 in _run_command
       463│ 
       464│         if error is not None:
     → 465│             raise error
       466│ 
       467│         return event.exit_code

   8  ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/cleo/application.py:449 in _run_command
       447│ 
       448│             if event.command_should_run():
     → 449│                 exit_code = command.run(io)
       450│             else:
       451│                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

   7  ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/cleo/commands/base_command.py:119 in run
       117│         io.input.validate()
       118│ 
     → 119│         status_code = self.execute(io)
       120│ 
       121│         if status_code is None:

   6  ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/cleo/commands/command.py:83 in execute
        81│ 
        82│         try:
     →  83│             return self.handle()
        84│         except KeyboardInterrupt:
        85│             return 1

   5  ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/poetry/console/commands/lock.py:54 in handle
        52│         self.installer.lock(update=not self.option("no-update"))
        53│ 
     →  54│         return self.installer.run()
        55│ 

   4  ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/poetry/installation/installer.py:103 in run
       101│         # Check if refresh
       102│         if not self._update and self._lock and self._locker.is_locked():
     → 103│             return self._do_refresh()
       104│ 
       105│         # Force update if there is no lock file present

   3  ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/poetry/installation/installer.py:195 in _do_refresh
       193│                 raise ValueError(f"Extra [{extra}] is not specified.")
       194│ 
     → 195│         locked_repository = self._locker.locked_repository()
       196│         solver = Solver(
       197│             self._package,

   2  ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/poetry/packages/locker.py:215 in locked_repository
       213│ 
       214│                 package.add_dependency(
     → 215│                     Factory.create_dependency(dep_name, constraint, root_dir=root_dir)
       216│                 )
       217│ 

   1  ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/poetry/core/factory.py:316 in create_dependency
       314│                     )
       315│                 else:
     → 316│                     dependency = DirectoryDependency(
       317│                         name,
       318│                         path,

  ValueError

  Directory subproj does not exist

  at ~/.pyenv/versions/3.10.6/lib/python3.10/site-packages/poetry/core/packages/directory_dependency.py:38 in __init__
       34│ 
       35│         self._develop = develop
       36│ 
       37│         if not self._full_path.exists():
    →  38│             raise ValueError(f"Directory {self._path} does not exist")
       39│ 
       40│         if self._full_path.is_file():
       41│             raise ValueError(f"{self._path} is a file, expected a directory")
       42│

I think poetry is trying to "cache" information about the path dependencies but IMO it should at the very least check if any info in the path dependency's pyproject.toml changed and if so invalidate it's cache and the cache of all it's sub-dependencies.

@adriangb adriangb added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 18, 2022
@adriangb
Copy link
Contributor Author

I've found when running with --no-update even when dependencies didn't move there are no errors but no updates are propagated from the path dependency to the main project.

@radoering radoering changed the title poetry lock --no-update fails for nested path dependencies poetry lock --no-update fails for renamed path dependencies Nov 16, 2022
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant