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

safety-schemas 0.0.7 requires outdated pydantic version that fails install on Python 3.13 #620

Open
1 task done
andy-maier opened this issue Oct 24, 2024 · 2 comments
Open
1 task done

Comments

@andy-maier
Copy link

andy-maier commented Oct 24, 2024

Checklist

Safety version

safety-schemas 0.0.7

Python version

3.13

Operating System

macos, Ubuntu, Windows

Describe the problem you'd like to have solved

I am using the safety issue tracker for reporting this issue of safety-schemas, because I'm not aware of an issue tracker for safety-schemas.

The safety-schemas package version 0.0.7 has the following package dependencies:

$ python -m pipdeptree -p safety-schemas
safety-schemas==0.0.7
├── dparse [required: >=0.6.4b0, installed: 0.6.4b0]
│   └── packaging [required: Any, installed: 24.1]
├── packaging [required: >=21.0, installed: 24.1]
├── pydantic [required: ~=2.5.0, installed: 2.5.3]
│   ├── annotated-types [required: >=0.4.0, installed: 0.7.0]
│   ├── pydantic_core [required: ==2.14.6, installed: 2.14.6]
│   │   └── typing_extensions [required: >=4.6.0,!=4.7.0, installed: 4.12.2]
│   └── typing_extensions [required: >=4.6.1, installed: 4.12.2]
├── ruamel.yaml [required: >=0.17.21, installed: 0.18.6]
│   └── ruamel.yaml.clib [required: >=0.2.7, installed: 0.2.12]
└── typing_extensions [required: >=4.7.1, installed: 4.12.2]

This dependency chain pulls in pydantic-core 2.14.6 and which has a bug that causes its installation to fail on Python 3.13.
That bug has been reported in pydantic/pydantic-core#1366 and again in pydantic/pydantic-core#1500 and has been fixed with pydantic/pydantic-core#1299 in pydantic-core version 2.18.3.

pydantic-core version 2.18.3 was for the first time pulled in by pydantic version 2.7.2.

However, pydantic 2.7.2 has other install issues on Python 3.13, and I found that I needed pydantic>=2.8.0 to successfully install on Python 3.13.

Note that pydantic and pydantic-core are very tightly coupled in their dependencies: pydantic specifies the exact and only version of pydantic-core to be used.

The current dependency safety-schemas 0.0.7 specifies for the pydantic package is ~=2.5.0 which uses the so-called compatibility operator ~= which is equivalent to >=2.5.0, <2.6.0. This prevents installing the version of pydantic that has the bug fix.

safety-schemas 0.0.5 allowed any version for the pydantic package; That's why this issue started to occur with the release of safety-schemas 0.0.7.

Describe the ideal solution

Do not specify an upper limit for the pydantic dependency, at least not an upper 2.x minor version.

Specifying pydantic ~= 2.5 might be ok, because that is equivalent to >=2.5.0, <3.0.0

Alternatives and current workarounds

Our circumvention is to exclude safety-schemas 0.0.7, hoping that a subsequent safety-schemas version will no longer pin pydantic to <2.6.0.

Additional context

No response

What I Did

On Python 3.13:

pip install safety
Copy link

Hi @andy-maier, thank you for opening this issue!

We appreciate your effort in reporting this. Our team will review it and get back to you soon.
If you have any additional details or updates, feel free to add them to this issue.

Note: If this is a serious security issue that could impact the security of Safety CLI users, please email [email protected] immediately.

Thank you for contributing to Safety CLI!

@andy-maier andy-maier changed the title safety-schemas 0.0.7 requires outdated pydantic version that causes problems on Python 3.13 safety-schemas 0.0.7 requires outdated pydantic version that fails install on Python 3.13 Oct 24, 2024
@Dresdn
Copy link

Dresdn commented Nov 22, 2024

I didn't want to open a new ticket, so I'm piggybacking here since the core issue is the same.

Can we revisit the decision to enforce an upper bound on the Pydantic version at the minor level @SafetyQuincyF @dylanpulver? With safety-schemas v0.0.9 (released Nov 4), the dependency is currently specified as "pydantic>=2.6.0,<2.10.0". However, Pydantic has since released versions 2.10.0 and 2.10.1, and this strict pinning is unnecessarily blocking the use of newer versions and their fixes/features.

Can we consider loosening the dependency to allow for major version compatibility instead, e.g., pydantic>=2.6.0,<3.0.0? This would be a much more sustainable and developer-friendly approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants