-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
install: add warning if current project cannot be installed #8369
install: add warning if current project cannot be installed #8369
Conversation
Can you update the branch? I guess that will give it more chance to be reviewed |
0191744
to
9b23034
Compare
Hi @Secrus can you have a look at this one as well? python-poetry/poetry-core#629 |
…tpones validating the package so that packages created by build scripts are supported
9b23034
to
087dc3c
Compare
I'm confused about this new warning. What does "install the current project" mean in practice? Does it copy or symlink the current project's files into the virtualenv so that it can be imported by name? If above is true, I think this behaviour should be removed and users should just be required to install a self-dependency, eliminating this confusing warning for users who don't need this feature. |
It does an editable install. More specifically, it creates a The warning means that your package is probably broken. If you don't care and don't like to add |
Yes, my "package" contains no code, it's only used to run dependencies via |
Poetry 1.7.0 or higher will print a warning otherwise, see discussions: python-poetry/poetry#8369 python-poetry/poetry#1132
Poetry 1.7.0 or higher will print a warning otherwise, see discussions: python-poetry/poetry#8369 python-poetry/poetry#1132 > --no-root Do not install the root package (the current project).
Poetry 1.7.0 or higher will print a warning otherwise, see discussions: python-poetry/poetry#8369 python-poetry/poetry#1132 > --no-root Do not install the root package (the current project).
Backport #27919 by @silverwind Poetry 1.7.0 or higher will print a warning otherwise, see discussions: python-poetry/poetry#8369 python-poetry/poetry#1132 > --no-root Do not install the root package (the current project). Co-authored-by: silverwind <[email protected]>
Should this be triggered if |
I'm surprised by that. I'd think if the user explicitly specifies
|
I suppose the author of this part of the docs did not expect that somebody interprets "using packages" as setting it to an empty list. 😄
On the one hand "yes", but on the other hand: does it make sense to build a distribution without any package/module or do you only use In the latter case, I think it's probably better to introduce an explicit attribute to switch between package and non-package mode (cf #1132 (comment)). |
I don't think it makes sense to build a distribution without packages, although I suppose it shouldn't be disallowed since it's a technically valid distribution and metapackages are a thing. But that's not my use case so I don't want to opine too much. It does make a lot of sense to want to install a meta project with no source code of its own. So at the very least, this error should either be a warning or only apply to building a distribution.
Perhaps. But my stance is going to be that this was a breaking change on a non major version release (breaking not only the existing behavior but also the promises made by the documentation, even if they were ambiguous) and that the change itself is questionable in the first place so it should be at least partially reverted (maybe to only apply to building distributions). |
It is a warning as exit code is 0, but I agree the text output looks deceptively like an error. |
Also it seems to me like the goal was to prevent users from shooting themselves in the foot if they named their source code folder wrong or similar. Even if we made an exception for |
I don't consider printing a warning a breaking change. (Every change is a breaking change for someone. If we move on this level, every new version is a major version.)
That and in more complicated cases, editable builds can just fail and without this change you will just notice that something does not work in your environment although
I agree that we can make an exception for |
I thought it was an error. I agree a warning is not a breaking change, but still a confusing annoyance. |
This warning is printed in red so it definitely looks like an error. I also got confused and thought it was an actual error. |
After getting there and reading this issue, I understand this error-ish warning that contains the format |
Poetry 1.7.0 or higher will print a warning otherwise, see discussions: python-poetry/poetry#8369 python-poetry/poetry#1132 > --no-root Do not install the root package (the current project).
Poetry 1.7.0 or higher will print a warning otherwise, see discussions: python-poetry/poetry#8369 python-poetry/poetry#1132 > --no-root Do not install the root package (the current project).
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Companion to python-poetry/poetry-core#629
ModuleOrPackageNotFound
is now raised inEditableBuilder.build()
instead ofEditableBuilder.__init__()
Update: In the second commit, I changed the current behavior so that errors are no longer swallowed silently when the installation of the current project fails. I only added a warning and did not change the return code to avoid a breaking change. We can decide if we only want to go with the first commit or both commits.
Pro second commit: Currently, the user will not know if installing the current project succeeds or fails.
Contra second commit: Users who don't use
--no-root
and don't care about the current project being installed or not, might be annoyed by the warning.