Skip to content

poetry: Skip packages with directory source in lockfile#213

Open
sin-ack wants to merge 1 commit intojvolkman:mainfrom
sin-ack:poetry-package-source
Open

poetry: Skip packages with directory source in lockfile#213
sin-ack wants to merge 1 commit intojvolkman:mainfrom
sin-ack:poetry-package-source

Conversation

@sin-ack
Copy link

@sin-ack sin-ack commented Jan 14, 2026

Path dependencies are apparently added to poetry.lock as directory-sourced packages, and this was causing issues.

This fixes the following error:

Traceback (most recent call last):
  File ".../tools/poetry_translator.py", line 333, in <module>
    main(parse_flags())
  File ".../tools/poetry_translator.py", line 274, in main
    lock_set = translate(
               ^^^^^^^^^^
  File ".../tools/poetry_translator.py", line 204, in translate
    files = files_by_package_name[package_listed_name]
            ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
KeyError: 'path-dependency'

Path dependencies are apparently added to poetry.lock as
directory-sourced packages, and this was causing issues.

This fixes the following error:

    Traceback (most recent call last):
      File ".../tools/poetry_translator.py", line 333, in <module>
        main(parse_flags())
      File ".../tools/poetry_translator.py", line 274, in main
        lock_set = translate(
                   ^^^^^^^^^^
      File ".../tools/poetry_translator.py", line 204, in translate
        files = files_by_package_name[package_listed_name]
                ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
    KeyError: 'path-dependency'
@njlr
Copy link
Contributor

njlr commented Jan 14, 2026

Given that skip is probably not the expected behavior, should this be behind a flag?

    directory_deps = "ignore",

@sin-ack
Copy link
Author

sin-ack commented Jan 14, 2026

It's the expected behavior since we do the same for path dependencies listed in pyproject.toml:

if "path" in pin_info:
# Skip path dependencies.
continue

@sin-ack
Copy link
Author

sin-ack commented Jan 14, 2026

(Though I agree that the established behavior can be surprising, so I could create a separate issue for that if you'd like. This one fixes the immediate build failure.)

@njlr
Copy link
Contributor

njlr commented Jan 14, 2026

(Though I agree that the established behavior can be surprising, so I could create a separate issue for that if you'd like. This one fixes the immediate build failure.)

Not my repo, just a user 🙂

@jvolkman
Copy link
Owner

Just for my understanding, do you have a small example that causes this scenario?

@sin-ack
Copy link
Author

sin-ack commented Jan 25, 2026

Just for my understanding, do you have a small example that causes this scenario?

Created one here: https://github.com/sin-ack/pycross-pr213-repro/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants