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

dependency pydantic==2.9.1 causes error #2252

Closed
haraldschilly opened this issue Sep 10, 2024 · 3 comments
Closed

dependency pydantic==2.9.1 causes error #2252

haraldschilly opened this issue Sep 10, 2024 · 3 comments

Comments

@haraldschilly
Copy link
Contributor

I had to revert to pydantic<2.6.0 to make version 2.6.2 of pretext work again. Otherwise I run into this. So, I suggest it should be updated to work with newer version of pydantic.

Traceback (most recent call last):                                                                                                  
  File "/usr/local/bin/pretext", line 5, in <module>                                                                                
    from pretext.cli import main                                                                                                    
  File "/usr/local/lib/python3.10/dist-packages/pretext/cli.py", line 35, in <module>                                               
    from .project import Project                                                                                                    
  File "/usr/local/lib/python3.10/dist-packages/pretext/project/__init__.py", line 30, in <module>                                  
    import pydantic_xml as pxml                                                                                                     
  File "/usr/local/lib/python3.10/dist-packages/pydantic_xml/__init__.py", line 5, in <module>                                      
    from . import config, errors, model                                                                                             
  File "/usr/local/lib/python3.10/dist-packages/pydantic_xml/model.py", line 13, in <module>                                        
    from .serializers.factories.model import BaseModelSerializer                                                                    
  File "/usr/local/lib/python3.10/dist-packages/pydantic_xml/serializers/__init__.py", line 1, in <module>                          
    from . import factories, serializer                                                                                             
  File "/usr/local/lib/python3.10/dist-packages/pydantic_xml/serializers/factories/__init__.py", line 1, in <module>                
    from . import heterogeneous, homogeneous, is_instance, mapping, model, primitive, raw, tagged_union, typed_mapping              
  File "/usr/local/lib/python3.10/dist-packages/pydantic_xml/serializers/factories/heterogeneous.py", line 11, in <module>          
    class ElementSerializer(Serializer):                                                                                            
  File "/usr/local/lib/python3.10/dist-packages/pydantic_xml/serializers/factories/heterogeneous.py", line 13, in ElementSerializer 
    def from_core_schema(cls, schema: pcs.TuplePositionalSchema, ctx: Serializer.Context) -> 'ElementSerializer':                   
  File "/usr/local/lib/python3.10/dist-packages/pydantic_core/core_schema.py", line 4132, in __getattr__                            
    raise AttributeError(f"module 'pydantic_core' has no attribute '{attr_name}'")                                                  
AttributeError: module 'pydantic_core' has no attribute 'TuplePositionalSchema'. Did you mean: 'tuple_positional_schema'?           
@oscarlevin
Copy link
Member

This is a CLI issue. We can move it there and I'll take a look today.

@oscarlevin
Copy link
Member

I'm not able to replicate this. I'm using the following versions of the pydantic packages:

pydantic 2.9.1
pydantic_core 2.23.3
pydantic-xml 2.12.1

It looks like this was an issue before 2.9.0: dapper91/pydantic-xml#167

@haraldschilly
Copy link
Contributor Author

Thank you for checking, I got it to work as well. I think I only updated pydantic, but not that xml package as well.

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