@@ -104,7 +104,7 @@ async def user_info(self) -> User:
104104 endpoint = "/users/me"
105105 resp = await self .client .get (endpoint )
106106 resp .raise_for_status ()
107- user = User .parse_obj (resp .json ())
107+ user = User .model_validate (resp .json ())
108108 self .add_tags_and_contextvars (user_id = str (user .id ))
109109 return user
110110
@@ -191,7 +191,7 @@ async def create_space(self, name: str, description: Optional[str] = None) -> Sp
191191 endpoint = "/spaces"
192192 resp = await self .client .post (endpoint , json = {"name" : name , "description" : description })
193193 resp .raise_for_status ()
194- space = Space .parse_obj (resp .json ())
194+ space = Space .model_validate (resp .json ())
195195 self .add_tags_and_contextvars (space_id = str (space .id ))
196196 return space
197197
@@ -200,7 +200,7 @@ async def get_space(self, space_id: uuid.UUID) -> Space:
200200 endpoint = f"/spaces/{ space_id } "
201201 resp = await self .client .get (endpoint )
202202 resp .raise_for_status ()
203- space = Space .parse_obj (resp .json ())
203+ space = Space .model_validate (resp .json ())
204204 return space
205205
206206 async def delete_space (self , space_id : uuid .UUID ) -> None :
@@ -216,7 +216,7 @@ async def list_space_projects(self, space_id: uuid.UUID) -> List[Project]:
216216 endpoint = f"/spaces/{ space_id } /projects"
217217 resp = await self .client .get (endpoint )
218218 resp .raise_for_status ()
219- projects = [Project .parse_obj (project ) for project in resp .json ()]
219+ projects = [Project .model_validate (project ) for project in resp .json ()]
220220 return projects
221221
222222 async def share_space (
@@ -267,7 +267,7 @@ async def create_project(
267267 },
268268 )
269269 resp .raise_for_status ()
270- project = Project .parse_obj (resp .json ())
270+ project = Project .model_validate (resp .json ())
271271 self .add_tags_and_contextvars (project_id = str (project .id ))
272272 return project
273273
@@ -276,15 +276,15 @@ async def get_project(self, project_id: uuid.UUID) -> Project:
276276 endpoint = f"/projects/{ project_id } "
277277 resp = await self .client .get (endpoint )
278278 resp .raise_for_status ()
279- project = Project .parse_obj (resp .json ())
279+ project = Project .model_validate (resp .json ())
280280 return project
281281
282282 async def delete_project (self , project_id : uuid .UUID ) -> Project :
283283 self .add_tags_and_contextvars (project_id = str (project_id ))
284284 endpoint = f"/projects/{ project_id } "
285285 resp = await self .client .delete (endpoint )
286286 resp .raise_for_status ()
287- project = Project .parse_obj (resp .json ())
287+ project = Project .model_validate (resp .json ())
288288 return project
289289
290290 async def share_project (
@@ -323,7 +323,7 @@ async def list_project_files(self, project_id: uuid.UUID) -> List[File]:
323323 endpoint = f"/projects/{ project_id } /files"
324324 resp = await self .client .get (endpoint )
325325 resp .raise_for_status ()
326- files = [File .parse_obj (file ) for file in resp .json ()]
326+ files = [File .model_validate (file ) for file in resp .json ()]
327327 return files
328328
329329 # Files are flat files (like text, csv, etc) or Notebooks.
@@ -355,7 +355,7 @@ async def _multi_step_file_create(
355355 upload_url = js ["presigned_upload_url_info" ]["parts" ][0 ]["upload_url" ]
356356 upload_id = js ["presigned_upload_url_info" ]["upload_id" ]
357357 upload_key = js ["presigned_upload_url_info" ]["key" ]
358- file = File .parse_obj (js )
358+ file = File .model_validate (js )
359359
360360 # (2) Upload to pre-signed url
361361 # TODO: remove this hack if/when we get containers in Skaffold to be able to translate
@@ -393,7 +393,7 @@ async def create_notebook(
393393 self .add_tags_and_contextvars (project_id = str (project_id ))
394394 if notebook is None :
395395 notebook = Notebook ()
396- content = notebook .json ().encode ()
396+ content = notebook .model_dump_json ().encode ()
397397 file = await self ._multi_step_file_create (project_id , path , "notebook" , content )
398398 self .add_tags_and_contextvars (file_id = str (file .id ))
399399 logger .info ("Created new notebook" , extra = {"file_id" : str (file .id )})
@@ -405,7 +405,7 @@ async def get_file(self, file_id: uuid.UUID) -> File:
405405 endpoint = f"/v1/files/{ file_id } "
406406 resp = await self .client .get (endpoint )
407407 resp .raise_for_status ()
408- file = File .parse_obj (resp .json ())
408+ file = File .model_validate (resp .json ())
409409 return file
410410
411411 async def get_file_content (self , file_id : uuid .UUID ) -> bytes :
@@ -433,15 +433,15 @@ async def get_file_versions(self, file_id: uuid.UUID) -> List[FileVersion]:
433433 endpoint = f"/files/{ file_id } /versions"
434434 resp = await self .client .get (endpoint )
435435 resp .raise_for_status ()
436- versions = [FileVersion .parse_obj (version ) for version in resp .json ()]
436+ versions = [FileVersion .model_validate (version ) for version in resp .json ()]
437437 return versions
438438
439439 async def delete_file (self , file_id : uuid .UUID ) -> File :
440440 self .add_tags_and_contextvars (file_id = str (file_id ))
441441 endpoint = f"/v1/files/{ file_id } "
442442 resp = await self .client .delete (endpoint )
443443 resp .raise_for_status ()
444- file = File .parse_obj (resp .json ())
444+ file = File .model_validate (resp .json ())
445445 return file
446446
447447 async def share_file (
@@ -497,7 +497,7 @@ async def launch_kernel(
497497 }
498498 resp = await self .client .post (endpoint , json = data )
499499 resp .raise_for_status ()
500- kernel_session = KernelSession .parse_obj (resp .json ())
500+ kernel_session = KernelSession .model_validate (resp .json ())
501501 self .add_tags_and_contextvars (kernel_session_id = str (kernel_session .id ))
502502 logger .info (
503503 "Launched new kernel" ,
@@ -517,7 +517,7 @@ async def get_output_collection(
517517 endpoint = f"/outputs/collection/{ output_collection_id } "
518518 resp = await self .client .get (endpoint )
519519 resp .raise_for_status ()
520- return KernelOutputCollection .parse_obj (resp .json ())
520+ return KernelOutputCollection .model_validate (resp .json ())
521521
522522 async def connect_realtime (self , file : Union [File , uuid .UUID , str ]) -> "RTUClient" : # noqa
523523 """
0 commit comments