Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pydantic_extra_types/semver.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
from typing_extensions import Annotated

warnings.warn(
'Use from pydantic_extra_types.semver import SemanticVersion instead. Will be removed in 3.0.0.', DeprecationWarning
'Use from pydantic_extra_types.semantic_version import SemanticVersion instead. Will be removed in 3.0.0.',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @urasakikeisuke the file name is semver so changing this pydantic_extra_types.semantic_version require changing the name of the file

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @yezz123! The guidance in the warning “from pydantic_extra_types.semver import SemanticVersion” led to the following ImportError.

>>> from pydantic_extra_types.semver import SemanticVersion
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    from pydantic_extra_types.semver import SemanticVersion
ImportError: cannot import name 'SemanticVersion' from 'pydantic_extra_types.semver' (/home/user/.venv/lib/python3.13/site-packages/pydantic_extra_types/semver.py)

When I imported as follows, the error did not occur.

>>> from pydantic_extra_types.semantic_version import SemanticVersion
>>> 

The SemanticVersion class is in semantic_version.py so the change is fine I think.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you miss changing the files here is the file you should update https://github.com/urasakikeisuke/pydantic-extra-types/blob/main/pydantic_extra_types/semantic_version.py

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is my take here, we can merge both of them because they are duplicated logic and we can keep one of them

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this got closed without resolving the issue; the "fix" instruction in the deprecation warning emitted in semver.py is incorrect, and this PR would have resolved it. semver.py is deprecated in favor of semantic_version.py, so the warning should be changed in the manner that was recommended.

DeprecationWarning,
)


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ filterwarnings = [
'ignore:::pkg_resources',
# This ignore will be removed when pendulum fixes https://github.com/sdispater/pendulum/issues/834
'ignore:datetime.datetime.utcfromtimestamp.*:DeprecationWarning',
' ignore:Use from pydantic_extra_types.semver import SemanticVersion instead. Will be removed in 3.0.0.:DeprecationWarning'
' ignore:Use from pydantic_extra_types.semantic_version import SemanticVersion instead. Will be removed in 3.0.0.:DeprecationWarning'
]

# configuring https://github.com/pydantic/hooky
Expand Down
Loading