Skip to content

Unable to Import PhoneNumberValidator on Python v3.8 - v3.10 & v3.12 #214

@hassamsolanomorel

Description

@hassamsolanomorel

Hey team! I've got kinda of a strange one for you.

When trying to use PhoneNumberValidator, as show in the Pydantic documentation example, I keep running into ImportError: cannot import name 'PhoneNumberValidator' from 'pydantic_extra_types.phone_numbers'.

Whats even stranger is I have no such issue importing pydantic_extra_types.phone_numbers.PhoneNumber. I've tried the import statement on several python versions, which I've listed below, and was only able to properly import on version 3.11.3.

My ultimate goal is to replicate NANumber as you have it in your tests almost exactly.

Hoping it's something I'm missing, but wanted to bring this to your attention.

Tested Versions

Python: 3.8.16, 3.9.19, 3.10.15, 3.11.3 (works on this version), 3.12.6
Pydantic: 2.9.1
phonenumbers: 8.13.45

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions