Monday, April 07, 2025

Re: relax py-pydantic version requirement on py-pydantic-core

Le Mon, Apr 07, 2025 at 08:31:28AM +0200, Renaud Allard a écrit :
>
>
> On 4/5/25 6:30 PM, Landry Breuil wrote:
> > hi,
> >
> > while working on an update to py-rio-cogeo, runtime testing blowed
> > strangely:
> >
> > geo/py-rasterio/ $rio cogeo --help
> >
> > Warning: entry point could not be loaded. Contact its author for help.
> > Traceback (most recent call last):
> > File "/usr/local/lib/python3.12/site-packages/click_plugins/core.py", line 37, in decorator
> > group.add_command(entry_point.load())
> > ^^^^^^^^^^^^^^^^^^
> > File "/usr/local/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2775, in load
> > self.require(*args, **kwargs) # type: ignore[arg-type]
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > File "/usr/local/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2803, in require
> > items = working_set.resolve(reqs, env, installer, extras=self.extras)
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > File "/usr/local/lib/python3.12/site-packages/pkg_resources/__init__.py", line 892, in resolve
> > dist = self._resolve_dist(
> > ^^^^^^^^^^^^^^^^^^^
> > File "/usr/local/lib/python3.12/site-packages/pkg_resources/__init__.py", line 938, in _resolve_dist
> > raise VersionConflict(dist, req).with_context(dependent_req)
> > pkg_resources.ContextualVersionConflict: (pydantic-core 2.27.0 (/usr/local/lib/python3.12/site-packages), Requirement.parse('pydantic-core==2.23.4'), {'pydantic'})
> >
> > digging further i found the 'hard' requirement here:
> > /usr/local/lib/python3.12/site-packages/pydantic-2.9.2.dist-info/METADATA:Requires-Dist: pydantic-core==2.23.4
> >
> > seems upstream sets hard requirements between both modules, and recently started enforcing it even more:
> > https://github.com/pydantic/pydantic/commit/ea3f18dea95e253d300c0a90095bb7005b1da90b
> >
> > something to fix/comment in the port for forthcoming updates, but for release
> > maybe this is ok ? it fixes 'rio cogeo' here at least, and i dunno what other
> > ports having an RDEP on pydantic might be affected by that.
> >
>
> That should be OK given we didn't change anything else, so it should not
> affect other ports if they were already working.

given that only pygeoapi and synapse use pydantic in -current (what i
saw was in a wip update for rio-cogeo, adding pydantic as a dep), we'll
keep what we have for now.

but post-unlock, both pydantic & pydantic-core need to be updated to
versions that match the upstream version requirement (with comments in
both ports to remind ppl to update them in one go)

Landry

Re: relax py-pydantic version requirement on py-pydantic-core

I think that, after unlock, we should update both ports to current versions and add a warning comment reminding that they should be kept in sync with each other.

-- 
  Sent from a phone, apologies for poor formatting.


On 7 April 2025 07:31:34 Renaud Allard <renaud@allard.it> wrote:

On 4/5/25 6:30 PM, Landry Breuil wrote:
hi,

while working on an update to py-rio-cogeo, runtime testing blowed
strangely:

geo/py-rasterio/ $rio cogeo --help

Warning: entry point could not be loaded. Contact its author for help.
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/click_plugins/core.py", line 37, in decorator
group.add_command(entry_point.load())
               ^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2775, in load
self.require(*args, **kwargs)  # type: ignore[arg-type]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2803, in require
items = working_set.resolve(reqs, env, installer, extras=self.extras)
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pkg_resources/__init__.py", line 892, in resolve
dist = self._resolve_dist(
    ^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pkg_resources/__init__.py", line 938, in _resolve_dist
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (pydantic-core 2.27.0 (/usr/local/lib/python3.12/site-packages), Requirement.parse('pydantic-core==2.23.4'), {'pydantic'})

digging further i found the 'hard' requirement here:
/usr/local/lib/python3.12/site-packages/pydantic-2.9.2.dist-info/METADATA:Requires-Dist: pydantic-core==2.23.4

seems upstream sets hard requirements between both modules, and recently started enforcing it even more:
https://github.com/pydantic/pydantic/commit/ea3f18dea95e253d300c0a90095bb7005b1da90b

something to fix/comment in the port for forthcoming updates, but for release
maybe this is ok ?  it fixes 'rio cogeo' here at least, and i dunno what other
ports having an RDEP on pydantic might be affected by that.


That should be OK given we didn't change anything else, so it should not 
affect other ports if they were already working.