python-poetry

What does ^ mean in poetry?


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!


Solution

  • 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.