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.

Installing directory poetry package with dependencies in secondary source fails

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).
  • MacOS 10.14:
  • 1.0.0b8:

Issue

Due to https://github.com/pypa/pip/issues/7444 installing a directory which is managed by poetry or has a pyproject.toml file present will cause the --no-deps argument to be ignored.

This can go unnoticed as long as you are only working with pypi dependencies but when your package depends on a private pypi repository this causes installs to fail.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
wakemaster39commented, Dec 8, 2019

Ok many many hours later I have sorted out the behaviour of PEP 517 and PEP 518 and what its going on here causing the problem.

I don’t know the full implications, but here is the issue

https://github.com/sdispater/poetry/blob/e943a4e127b0a658e76386006c60b79954a8fa57/poetry/masonry/api.py#L21-L29

And here is the snippet from pip

        # Install any extra build dependencies that the backend requests.
        # This must be done in a second pass, as the pyproject.toml
        # dependencies must be installed before we can call the backend.
        with self.req.build_env:
            runner = runner_with_spinner_message(
                "Getting requirements to build wheel"
            )
            backend = self.req.pep517_backend
            with backend.subprocess_runner(runner):
                reqs = backend.get_requires_for_build_wheel()

        conflicting, missing = self.req.build_env.check_requirements(reqs)
        if conflicting:
            _raise_conflicts("the backend dependencies", conflicting)
        self.req.build_env.install_requirements(
            finder, missing, 'normal',
            "Installing backend dependencies"
        )

Basically at this point, pip has gone into the build isolation and poetry has been retrieved and installed. pip then queries poetry and asks “what else is required for me to build this wheel”. To which poetry is responding with the dependencies of the package.

I do not know enough about packaging, but I think returning all the dependencies is a mistake. The build system doesn’t need my dependencies to package up my wheel, I only need it to use the wheel.

I have been able to test this out hacking at pip to be the following:

            with backend.subprocess_runner(runner):
                reqs = backend.get_requires_for_build_wheel()
                reqs = []

By doing this none of my dependencies are installed and the wheel is generated and installed the way I expect.

I don’t know how this impact C extensions or if those are even supported with poetry right now but I think that get_requires_for_build_wheel(config_settings=None) should be modified to return an empty list. That is all that is required to build the wheel, poetry and nothing else.

0reactions
wakemaster39commented, Jan 13, 2020

Looks good now to me as its the same hack I have been running for a month now.

Thanks for providing a proper fix for it. I will close our my old hacky PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installing directory poetry package with dependencies in secondary ...
Installing directory poetry package with dependencies in secondary source fails.
Read more >
Dependency Management With Python Poetry
Learn how Python Poetry will help you start new projects, maintain existing ones, and master dependency management.
Read more >
python - Poetry trying to install everything from private repository
poetry first checks if the project is in your private-pypi and then checks public-pypi . Here the error is mostly because of 403...
Read more >
Dependency specification | master | Documentation - Poetry
Dependency specification Dependencies for a project can be specified in various forms, which depend on the type of the dependency and on the...
Read more >
Managing Python Dependencies with Poetry
And this rings the bell of good and solid unit testing. If you fail to create a solid test suite that would eventually...
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