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

Update: Pydantic V2 #1889

Merged
merged 9 commits into from
May 21, 2024
Merged

Update: Pydantic V2 #1889

merged 9 commits into from
May 21, 2024

Conversation

opendansor
Copy link
Contributor

@opendansor opendansor commented May 15, 2024

Update Pydantic from V1 to V2. Some of the changes between V1 and V2 have breaking impacts, and our tests will need to be adjusted to reflect those changes.

@opendansor opendansor requested a review from a team May 15, 2024 23:11
@opendansor opendansor added enhancement New feature or request bittensor labels May 15, 2024
Copy link
Contributor

@mjurbanski-reef mjurbanski-reef left a comment

Choose a reason for hiding this comment

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

You may want to use https://docs.pydantic.dev/latest/migration/#code-transformation-tool , while it won't solve everything it will be a good starting point.

requirements/prod.txt Outdated Show resolved Hide resolved
requirements/prod.txt Outdated Show resolved Hide resolved
@opendansor opendansor linked an issue May 17, 2024 that may be closed by this pull request
@opendansor opendansor marked this pull request as ready for review May 20, 2024 20:54
@thewhaleking
Copy link
Contributor

test_fail.log

Getting a number of errors when I run the tests locally. Not sure why.

@ibraheem-opentensor ibraheem-opentensor requested review from ibraheem-opentensor and removed request for mjurbanski-reef May 21, 2024 16:24
Copy link
Contributor

@thewhaleking thewhaleking left a comment

Choose a reason for hiding this comment

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

Hey Dan, all looks good, but I did run bump-pydantic --diff bittensor/ to check, and I got this:

[19:40:24] Start bump-pydantic.                                                                                                                                       main.py:61
           Found 66 files to process.                                                                                                                                 main.py:78
--- bittensor/tensor.py
+++ bittensor/tensor.py
@@ -171,7 +171,7 @@
 
     # Represents the tensor buffer data.
     buffer: Optional = Field(
-        title="buffer",
+        None, title="buffer",
         description="Tensor buffer data. This field stores the serialized representation of the tensor data.",
         examples=["0x321e13edqwds231231231232131"],
         frozen=True,
[19:41:04] Found 1 errors. Please check the log.txt file.  

and the log.txt file shows:

==SUPRESS==
^A syntax error happened on bittensor/utils/__init__.py. This file cannot be formatted.
Check https://github.com/pydantic/bump-pydantic/issues/124 for more information.
Syntax Error @ 1:1.
parser error: error at 1:2: expected one of (, *, +, -, ..., AWAIT, EOF, False, NAME, NUMBER, None, True, [, break, continue, lambda, match, not, pass, ~

Just check into those.

@opendansor
Copy link
Contributor Author

opendansor commented May 21, 2024

@thewhaleking I have addressed the Pydantic bump change.

@opendansor opendansor merged commit bfef073 into staging May 21, 2024
11 checks passed
@gus-opentensor gus-opentensor mentioned this pull request May 21, 2024
@opendansor opendansor deleted the feature/opendansor/PydanticV2Update branch May 22, 2024 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bittensor enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pydantic V2 integration into Synapse
4 participants