Skip to content
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

What is the effect of at operator? #5953

Closed
3 tasks done
a-takahashi223 opened this issue Jul 5, 2022 · 5 comments
Closed
3 tasks done

What is the effect of at operator? #5953

a-takahashi223 opened this issue Jul 5, 2022 · 5 comments
Labels
kind/bug Something isn't working as expected

Comments

@a-takahashi223
Copy link

a-takahashi223 commented Jul 5, 2022

  • 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: CentOS Stream

  • Poetry version: 1.1.13

  • Link of a Gist with the contents of your pyproject.toml file: None

Issue

The documentation says

When adding dependencies via poetry add, you can use the @ operator. This is understood similarly to the == syntax, but also allows prefixing any specifiers that are valid in pyproject.toml.

And it shows the example that poetry add django@^4.0.0 will add the line Django = "^4.0.0" to pyproject.toml. But what version is installed (written to poetry.lock) is not shown.
As "@ operator is understood similarly to the == syntax", django 4.0.0 is expected to be installed. But no.

$ poetry show django
name         : django
version      : 4.0.6

This result seems to be the same as poetry add django^4.0.0. What is the difference? What is the effect of @ operator?

#3142 and #5136 is the similar questions, and #5822 says it solved them, but I can't understand the effect of @ operator by reading the documentation.

@a-takahashi223 a-takahashi223 added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jul 5, 2022
@a-takahashi223
Copy link
Author

a-takahashi223 commented Jul 5, 2022

I tried some other patterns.

django@4.0.0 is the same as django==4.0.0.
django@latest add the dependency django = "^4.0.6" for now, the same as django (no specifiers). django^latest is not allowed.
django@^latest is not allowed.

So

Is there any case that does not follow the rules above?

@finswimmer
Copy link
Member

Hello @a-takahashi223,

I think you overlook the ^ in django@^4.0.0. The caret operator is described in the docs. In this case django@^4.0.0 would be equal to django>=4.0.0,<5.0

fin swimmer

@a-takahashi223
Copy link
Author

so django>=4.0.0,<5.0 is equal to django^4.0.0, then django@^4.0.0 is equal to django^4.0.0?

@Secrus
Copy link
Member

Secrus commented Jul 5, 2022

The @ operator is described in docs for version 1.2, as this is the main focus right now.

@Secrus Secrus closed this as completed Jul 5, 2022
@mkniewallner mkniewallner removed the status/triage This issue needs to be triaged label Jul 9, 2022
Copy link

github-actions bot commented Mar 1, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

4 participants