vdoc.models package

Subpackages

Submodules

vdoc.models.project module

Contains all project model definitions.

class vdoc.models.project.Project(**data)

Bases: BaseModel

Pydantic model for a project.

property category_id: int | None

Returns the category ID of the project if configured, otherwise None.

Returns:

The optional project category ID.

Return type:

int | None

property display_name: str

Returns the display name of the project if configured, otherwise the project name.

Returns:

The project display name.

Return type:

str

classmethod get_version_and_docs_path(name, version)

Returns the validated version and the path containing the documentation.

Parameters:
  • name (str) – The project name.

  • version (str) – The project version. If latest, the path to the newest version will be returned.

Raises:
Return type:

tuple[str, Path]

Returns:

The validated version and the path containing the documentation.

property latest: str

Returns the latest version available of the project.

Returns:

_description_

classmethod list(search_path=None)

Returns a list of all projects.

Parameters:

search_path (Path | None) – Optional search path. If None, the docs_dir of the settings will be used.

Return type:

list[Project]

Returns:

A a list of all projects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
classmethod validate_project_exists(value)

Validates the project’s existence.

Parameters:

value (str) – The project name.

Raises:

ProjectNotFound – If the project doesn’t exist.

Return type:

str

Returns:

The validated project name.

property versions: Dict[Version, str]

Returns a list of all available project versions.

Raises:

ProjectNotFound – If the project doesn’t exist.

Returns:

A list of all versions of the project.

vdoc.models.project_category module

Contains the project category model.

class vdoc.models.project_category.ProjectCategory(**data)

Bases: BaseModel

Pydantic model for a project category.

id: Annotated[int]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str

Module contents

Contains all models.