^在诗歌中意味着什么?

发布于 2025-02-09 01:03:47 字数 127 浏览 1 评论 0原文

我还没有在文档中找到它,但是我在pyproject.toml文件中看到了诗歌中的文件:

psycopg2-binary="^2.9.1"

^是什么意思?

谢谢!

I haven't found it in the docs, but I see in pyproject.toml files in poetry things like:

psycopg2-binary="^2.9.1"

what does the ^ mean?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

青柠芒果 2025-02-16 01:03:47

您可以将其读取为psycopg2-binary =“ 2.x”

我看到的方式是,它实际上是psycopg2-binary =“ 〜2.1.0” juntergy的扩展,它指示“ 2.1.x”

编辑:请参阅此相关文章:为什么依赖项下的pubspec.yaml`文件中有一个 ^ cap符号

示例:

meta: ^1.1.6 - equivalent to >=1.1.6 <2.0
equatable: ^0.2.3 - equivalent to >=0.2.3 <0.3.0
cupertino_icons: ^0.1.2 - equivalent to >=0.1.2 <0.2.0

编辑2:在&lt; 1.0&gt; 1.0中的差异上方注意。版本。当主要版本为零时,软件包版本被视为“不稳定”。版本仅从1.0开始就被认为稳定( https://semver.org/#spec-emver.org/#spec-item-44 )。当软件包版本不稳定时,次要版本可以包含破坏更改:

^1.27.0 ==比或等于1.27.0,但小于2.0.0

^0.27.0 ==大于或等于0.27.0,但小于0.28.0

You can read it as psycopg2-binary="2.x".

The way I see it, is that it's effectively an extension of the psycopg2-binary="~2.1.0" convention, which indicates "2.1.x".

EDIT: See this related post: Why there is a ^ Cap symbol in `pubspec.yaml` file under dependencies

Examples:

meta: ^1.1.6 - equivalent to >=1.1.6 <2.0
equatable: ^0.2.3 - equivalent to >=0.2.3 <0.3.0
cupertino_icons: ^0.1.2 - equivalent to >=0.1.2 <0.2.0

EDIT 2: Note above the difference in <1.0 and >1.0 versions. When the Major version is zero, then the package version is considered "unstable". Versions are considered stable only starting from 1.0 (https://semver.org/#spec-item-4). When a package version is unstable, minor versions can contain breaking changes:

^1.27.0 == than or equal to 1.27.0 but less than 2.0.0

^0.27.0 == greater than or equal to 0.27.0 but less than 0.28.0.

幽梦紫曦~ 2025-02-16 01:03:47

“将最左的非零号码保持固定。右侧的任何数字都可以增加。” - 可能是足够短的解释,可以记住。

"The leftmost non-zero number is kept fixed. Any number to the right of it may be incremented." - possibly short enough explanation to be memorized.

空城仅有旧梦在 2025-02-16 01:03:47

Caret符号(^)表明诗歌可以免费安装与版本字符串的最左侧非零数字匹配的任何版本。例如,如果请求库发布了新版本2.99.99,则诗歌将认为这是您项目的可接受候选人。但是,不允许版本3.0。

此背后的想法遵循语义版本掌握方案(Major.minor.patch),其中次要更新和补丁更新不应引入向后不兼容的更改。尽管如此,这只是一个可能破坏您的构建的假设,一些著名的Python开发人员不同意代表诗歌选择的默认情况。

参考: https://realpython.com/depperency-management-management-management-management-python-poetry/

The caret symbol (^) indicates that Poetry is free to install any version matching the leftmost non-zero digit of the version string. For example, if the Requests library releases a new version 2.99.99, then Poetry will consider it an acceptable candidate for your project. However, version 3.0 wouldn’t be allowed.

The idea behind this follows the semantic versioning scheme (major.minor.patch), where minor and patch updates shouldn’t introduce backward-incompatible changes. Still, this is just an assumption that could break your builds, and some notable Python developers disagree with such a choice of defaults on behalf of Poetry.

Ref: https://realpython.com/dependency-management-python-poetry/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文