question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Having `from` with multiple packages will use last `from` for all of them

See original GitHub issue
  • 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: python:3.7 Docker image

  • Poetry version: 1.0.0

Issue

If there is more than one package in packages with from set, the last one will be used for all. Even worse, packages without from will also be attempted to be resolved inside the last from directory.

So with:

packages = [
	{ include = "apple" },
    { include = "pear", from="pear_tree" },
    { include = "orange", from="orange_tree" },
]

Poetry will try to resolve both apple and pear from inside orange_tree as far as I observed from debug output.

If it’s a known limitation that using from only one package should be defined then the docs (at https://python-poetry.org/docs/pyproject/#packages) should definitely mention it as I was stumped by it for hours.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
abadgercommented, May 24, 2020

Oops, I see that when I initially posted the simple reproducer for this, I left off the URL for the tarball containing the reproducer. That’s fixed now.

I saw that in develop branch there’s been some changes to install which could be relevant. I tested the reproducer against that. The good news is that install now completes successfully. The bad news is that it didn’t do the right thing.

poetry install for this test case generates a fruit.pth that points to the toplevel dir:

$ cat /home/badger/.cache/pypoetry/virtualenvs/trees-qCG1GaiB-py3.8/lib/python3.8/site-packages/fruit.pth 
/var/tmp/fruit

But neither of the packages in the test case reside in the toplevel dir. They reside in the subdirs, /var/tmp/fruit/src and /var/tmp/fruit/lib. So there needs to be two new pth entries, one for each of those.

Poetry hash on the develop branch which I tested: abee30f07c8351ad19b2830d1c8605b97be2c58a

0reactions
dmohnscommented, Sep 17, 2020

If I understand correctly the code that is causing this issue is https://github.com/python-poetry/poetry-core/blob/master/poetry/core/masonry/builders/sdist.py#L134-L135

I was tinkering around with something like this

if pkg_dir is not None:
    package_dir[include.package] = os.path.join(
        os.path.relpath(pkg_dir, str(self._path)),
        include.package
    )

but this is also not doing the right thing. I have to admit I know to little about setuptools to understand what is the correct way to go here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple packages in the same file have ... - CAST Highlight
Avoid several packages in the same file because it requires Oracle to recompile every stored program that references the packages.
Read more >
What is the best way to handle executing multiple packages ...
Its better to create One job and using multiple steps by defining sequence between them you can execute all package in one single...
Read more >
Why does loading multiple packages in R produce warnings?
Produces a warning for each new package. I have tried sapply outside a loop as well and the same warnings appear. Warning in...
Read more >
Create Automation Rules for Multiple Packages
If you have an order for 3 units, you can create a multi-carton Package Set and set an automation rule to do the...
Read more >
Consolidate Multiple Manage Packages With Dependency?
Let's list down pros and cons. Pros of using multiple packages and dependencies. Application design is modular; In future if the application ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found