File tree Expand file tree Collapse file tree 5 files changed +42
-187
lines changed Expand file tree Collapse file tree 5 files changed +42
-187
lines changed Original file line number Diff line number Diff line change 11import os
22from pathlib import Path
33
4- from pydantic import ValidationError
4+ import msgspec
55
66from .compatibility import run_pixi
77from .types import PixiInfo
@@ -20,8 +20,8 @@ async def envs_from_path(path: Path) -> list[str]:
2020 return [DEFAULT_ENVIRONMENT ]
2121
2222 try :
23- pixi_info = PixiInfo . model_validate_json (stdout , strict = True )
24- except ValidationError :
23+ pixi_info = msgspec . json . decode (stdout , type = PixiInfo )
24+ except msgspec . MsgspecError :
2525 return [DEFAULT_ENVIRONMENT ]
2626
2727 if len (pixi_info .environments ) == 0 :
Original file line number Diff line number Diff line change 22import logging
33from pathlib import Path
44
5- from pydantic import ValidationError
5+ import msgspec
66from returns .result import Failure , Result , Success
77
88from .compatibility import has_compatible_pixi , run_pixi
@@ -48,8 +48,8 @@ async def verify_env_readiness(
4848 return Failure (f"Failed to run 'pixi info': { stderr } " )
4949
5050 try :
51- pixi_info = PixiInfo . model_validate_json (stdout , strict = True )
52- except ValidationError as exception :
51+ pixi_info = msgspec . json . decode (stdout , type = PixiInfo )
52+ except msgspec . MsgspecError as exception :
5353 return Failure (f"Failed to parse 'pixi info' output: { stdout } \n { exception } " )
5454
5555 if pixi_info .project is None :
Original file line number Diff line number Diff line change 22
33from typing import Optional
44
5- from pydantic import BaseModel , Field
5+ import msgspec
66
77
8- class PixiInfo (BaseModel ):
9- environments : list [Environment ] = Field ( alias = "environments_info" )
10- project : Optional [Project ] = Field ( alias = "project_info" )
8+ class PixiInfo (msgspec . Struct , frozen = True , kw_only = True ):
9+ environments : list [Environment ] = msgspec . field ( name = "environments_info" )
10+ project : Optional [Project ] = msgspec . field ( name = "project_info" )
1111
1212
13- class Environment (BaseModel ):
13+ class Environment (msgspec . Struct , frozen = True , kw_only = True ):
1414 name : str
1515 dependencies : list [str ]
1616 pypi_dependencies : list [str ]
1717 prefix : str
1818
1919
20- class Project (BaseModel ):
20+ class Project (msgspec . Struct , frozen = True , kw_only = True ):
2121 manifest_path : str
Original file line number Diff line number Diff line change @@ -35,8 +35,8 @@ requires-python = ">=3.9,<4.0"
3535dependencies = [
3636 " ipykernel>=6" ,
3737 " jupyter-client>=7" ,
38- " jupyter_server>=2.4.0 " ,
39- " pydantic>=2 " ,
38+ " jupyter_server>=2.4" ,
39+ " msgspec>=0.18 " ,
4040 " returns>=0.23" ,
4141 " tomli>=2; python_version<'3.11'" ,
4242]
@@ -50,7 +50,7 @@ Repository = "https://github.com/renan-r-santos/pixi-kernel"
5050dev-dependencies = [
5151 " jupyter-kernel-test>=0.7" ,
5252 " jupyterlab>=4" ,
53- " msgspec[toml]>=0.19.0 " ,
53+ " msgspec[toml]>=0.18 " ,
5454 " mypy>=1" ,
5555 " pytest>=8" ,
5656 " pytest-asyncio>=1" ,
You can’t perform that action at this time.
0 commit comments