python-poetry / python-poetry/poetry

`poetry build` follows symlinks for files but not for directories

Open
#1,998 8 comments 17 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/build-system kind/bug status/needs-consensus
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: MacOS Catalina, gitlab/gitlab-runner:latest
  • Poetry version: 1.0.3
  • Link of a Gist with the contents of your pyproject.toml file:

Issue

We are changing package structure of our project and want to keep some compatibility aliases via symlinks to make migration easier. Project structure is the following (package_c contains symlinks only):

package_a:
    module_aa
    module_ab
package_b:
    module_ba
    module_bb
package_c:
    package_a  # --> ../package_a
    module_ba  # --> ../package_b/module_ba
    module_bb  # --> ../package_b/module_ba

pyproject.toml contains following lines:

packages = [
    { include = "package_a", from = "src" },
    { include = "package_b", from = "src" },
    { include = "package_c", from = "src" }
]

Resulting wheel contains copies of module_ba and module_bb at package_c path (which is fine) but package_c/package_a path is ignored completely.

Current behavior: file symlinks are silently followed, targets are copied; directory symlinks are silently ignored

Expected behavior:
One of these:

  1. All symlinks inside project directory are followed and targets are copied to wheel
  2. Symlinks are ignored, warning printed during build
  3. Symlinks are prohibited, attempt to build project containing symlinks fails

I know symlinks in wheels have no official support (https://github.com/pypa/pip/issues/3500) but it would be nice if poetry will be at least more verbose when handling them.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the shown package_a, package_b, and package_c symlink structure and the pyproject.toml packages configuration, then run poetry build and inspect the generated wheel. Trace how file and directory symlinks are handled during the build; done means the behavior is made consistent and matches one of the stated handling policies.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.