upathtype
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| UPath mkdocs_mknodes.appconfig.upathtype A Pydantic type for universal_pathlib.UPath. |
🛈 DocStrings¶
Pydantic types for universal_pathlib (upath.UPath) with validation capabilities.
This module provides a Pydantic-compatible type for upath.UPath, offering similar functionality to Pydantic's built-in Path type. It includes validators for existence checks and path type verification.
Example
from pydantic import BaseModel
class Config(BaseModel):
input_file: UPathFile
output_dir: UPathDir
temp_path: UPath
# Usage
config = Config(
input_file="data.csv",
output_dir="output",
temp_path="temp/workspace"
)
FileConfig
¶
Bases: BaseModel
Example configuration using UPath types.
Source code in mkdocs_mknodes/appconfig/upathtype.py
165 166 167 168 169 170 171 172 173 174 175 | |
UPath
¶
A Pydantic type for universal_pathlib.UPath.
This type handles conversion of strings and path-like objects to UPath objects, with proper serialization support. It can be used directly in Pydantic models and supports validation via the provided validator types.
Source code in mkdocs_mknodes/appconfig/upathtype.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
__get_pydantic_core_schema__
classmethod
¶
__get_pydantic_core_schema__(_source_type: Any, _handler: GetCoreSchemaHandler) -> CoreSchema
Generate the Pydantic core schema for UPath type.
Source code in mkdocs_mknodes/appconfig/upathtype.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
__get_pydantic_json_schema__
classmethod
¶
__get_pydantic_json_schema__(
_core_schema: CoreSchema, _handler: GetJsonSchemaHandler
) -> JsonSchemaValue
Generate the JSON schema for UPath type.
Source code in mkdocs_mknodes/appconfig/upathtype.py
145 146 147 148 149 150 151 152 | |