downloads

Downloads domain.

class OS[source]

Bases: AuditBase, ContentManageableMixin, NameSlugMixin

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created: Mapped[datetime]
created_at: Mapped[datetime.datetime]

Date/time of instance creation.

creator
creator_id
id: Mapped[UUID]

UUID Primary key column.

last_modified_by
last_modified_by_id
name: Mapped[str]
slug: Mapped[str]
updated: Mapped[datetime]
updated_at: Mapped[datetime.datetime]

Date/time of instance last update.

class DownloadPageData[source]

Bases: BaseModel

Schema for download page template data.

model_config: ClassVar[ConfigDict] = {}

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

class DownloadsPageController[source]

Bases: Controller

Controller for download HTML pages.

after_request: AfterRequestHookHandler | None

A sync or async function executed before a Request is passed to any route handler.

If this function returns a value, the request will not reach the route handler, and instead this value will be used.

after_response: AfterResponseHookHandler | None

A sync or async function called after the response has been awaited.

It receives the Request instance and should not return any values.

before_request: BeforeRequestHookHandler | None

A sync or async function called immediately before calling the route handler.

It receives the Request instance and any non-None return value is used for the response, bypassing the route handler.

cache_control: CacheControlHeader | None

A CacheControlHeader header to add to route handlers of this controller.

Can be overridden by route handlers.

dependencies: Dependencies | None

A string keyed dictionary of dependency Provider instances.

dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for (de)serializing and validation of request data.

etag: ETag | None

An etag header of type ETag to add to route handlers of this controller.

Can be overridden by route handlers.

exception_handlers: ExceptionHandlersMap | None

A map of handler functions to status codes and/or exception types.

guards: Sequence[Guard] | None

A sequence of Guard callables.

include_in_schema: bool | EmptyType

A boolean flag dictating whether the route handler should be documented in the OpenAPI schema

middleware: Sequence[Middleware] | None

A sequence of Middleware.

opt: Mapping[str, Any] | None

A string key mapping of arbitrary values that can be accessed in Guards or wherever you have access to Request or ASGI Scope.

owner: Router

The Router or Litestar app that owns the controller.

This value is set internally by Litestar and it should not be set when subclassing the controller.

parameters: ParametersMap | None

A mapping of Parameter definitions available to all application paths.

path: str

A path fragment for the controller.

All route handlers under the controller will have the fragment appended to them. If not set it defaults to /.

request_class: type[Request] | None

A custom subclass of Request to be used as the default request for all route handlers under the controller.

request_max_body_size: int | None | EmptyType

Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.

response_class: type[Response] | None

A custom subclass of Response to be used as the default response for all route handlers under the controller.

response_cookies: ResponseCookies | None

A list of Cookie instances.

response_headers: ResponseHeaders | None

A string keyed dictionary mapping ResponseHeader instances.

return_dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for serializing outbound response data.

security: Sequence[SecurityRequirement] | None

A sequence of dictionaries that to the schema of all route handlers under the controller.

signature_namespace: dict[str, Any]

A mapping of names to types for use in forward reference resolution during signature modelling.

signature_types: Sequence[Any]

A sequence of types for use in forward reference resolution during signature modelling.

These types will be added to the signature namespace using their __name__ attribute.

tags: Sequence[str] | None

A sequence of string tags that will be appended to the schema of all route handlers under the controller.

type_decoders: TypeDecodersSequence | None

A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.

type_encoders: TypeEncodersMap | None

A mapping of types to callables that transform them into types supported for serialization.

websocket_class: type[WebSocket] | None

A custom subclass of WebSocket to be used as the default websocket for all route handlers under the controller.

class OSController[source]

Bases: Controller

Controller for OS CRUD operations.

after_request: AfterRequestHookHandler | None

A sync or async function executed before a Request is passed to any route handler.

If this function returns a value, the request will not reach the route handler, and instead this value will be used.

after_response: AfterResponseHookHandler | None

A sync or async function called after the response has been awaited.

It receives the Request instance and should not return any values.

before_request: BeforeRequestHookHandler | None

A sync or async function called immediately before calling the route handler.

It receives the Request instance and any non-None return value is used for the response, bypassing the route handler.

cache_control: CacheControlHeader | None

A CacheControlHeader header to add to route handlers of this controller.

Can be overridden by route handlers.

dependencies: Dependencies | None

A string keyed dictionary of dependency Provider instances.

dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for (de)serializing and validation of request data.

etag: ETag | None

An etag header of type ETag to add to route handlers of this controller.

Can be overridden by route handlers.

exception_handlers: ExceptionHandlersMap | None

A map of handler functions to status codes and/or exception types.

guards: Sequence[Guard] | None

A sequence of Guard callables.

include_in_schema: bool | EmptyType

A boolean flag dictating whether the route handler should be documented in the OpenAPI schema

middleware: Sequence[Middleware] | None

A sequence of Middleware.

opt: Mapping[str, Any] | None

A string key mapping of arbitrary values that can be accessed in Guards or wherever you have access to Request or ASGI Scope.

owner: Router

The Router or Litestar app that owns the controller.

This value is set internally by Litestar and it should not be set when subclassing the controller.

parameters: ParametersMap | None

A mapping of Parameter definitions available to all application paths.

path: str

A path fragment for the controller.

All route handlers under the controller will have the fragment appended to them. If not set it defaults to /.

request_class: type[Request] | None

A custom subclass of Request to be used as the default request for all route handlers under the controller.

request_max_body_size: int | None | EmptyType

Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.

response_class: type[Response] | None

A custom subclass of Response to be used as the default response for all route handlers under the controller.

response_cookies: ResponseCookies | None

A list of Cookie instances.

response_headers: ResponseHeaders | None

A string keyed dictionary mapping ResponseHeader instances.

return_dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for serializing outbound response data.

security: Sequence[SecurityRequirement] | None

A sequence of dictionaries that to the schema of all route handlers under the controller.

signature_namespace: dict[str, Any]

A mapping of names to types for use in forward reference resolution during signature modelling.

signature_types: Sequence[Any]

A sequence of types for use in forward reference resolution during signature modelling.

These types will be added to the signature namespace using their __name__ attribute.

tags: Sequence[str] | None

A sequence of string tags that will be appended to the schema of all route handlers under the controller.

type_decoders: TypeDecodersSequence | None

A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.

type_encoders: TypeEncodersMap | None

A mapping of types to callables that transform them into types supported for serialization.

websocket_class: type[WebSocket] | None

A custom subclass of WebSocket to be used as the default websocket for all route handlers under the controller.

class OSCreate[source]

Bases: OSBase

Schema for creating a new OS.

model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'name': 'macOS', 'slug': 'macos'}}}

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

class OSRead[source]

Bases: OSBase

Schema for reading OS data.

model_config: ClassVar[ConfigDict] = {'from_attributes': True, 'json_schema_extra': {'example': {'created_at': '2025-01-01T00:00:00Z', 'id': '550e8400-e29b-41d4-a716-446655440001', 'name': 'macOS', 'slug': 'macos', 'updated_at': '2025-01-01T00:00:00Z'}}}

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

class OSRepository[source]

Bases: SQLAlchemyAsyncRepository[OS]

Repository for OS database operations.

async get_by_slug(slug)[source]

Get an OS by slug.

Parameters:

slug (str) – The slug to search for.

Return type:

OS | None

Returns:

The OS if found, None otherwise.

model_type

alias of OS

class OSService[source]

Bases: SQLAlchemyAsyncRepositoryService[OS, Any]

Service for OS business logic.

async get_by_slug(slug)[source]

Get an OS by slug.

Parameters:

slug (str) – The slug to search for.

Return type:

OS | None

Returns:

The OS if found, None otherwise.

match_fields: ClassVar[Optional[Union[list[str], str]]] = ['slug']

List of dialects that prefer to use field.id = ANY(:1) instead of field.id IN (...).

repository_type

alias of OSRepository

class PythonVersion[source]

Bases: StrEnum

__new__(value)
class Release[source]

Bases: AuditBase, ContentManageableMixin, NameSlugMixin

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created: Mapped[datetime]
created_at: Mapped[datetime.datetime]

Date/time of instance creation.

creator
creator_id
id: Mapped[UUID]

UUID Primary key column.

property is_eol: bool

Check if this release series has reached end of life.

Returns:

True if status is EOL or eol_date has passed.

property is_prerelease: bool

Check if this is a pre-release version (alpha, beta, RC).

Returns:

True if status is prerelease or pre_release flag is set.

last_modified_by
last_modified_by_id
property major_version: str

Extract major version string (e.g., ‘3’ from ‘3.12.1’).

Returns:

Major version string or full name if parsing fails.

property minor_version: str

Extract minor version string (e.g., ‘3.12’ from ‘3.12.1’).

Returns:

Minor version string or full name if parsing fails.

name: Mapped[str]
slug: Mapped[str]
property status_label: str

Get human-readable status label.

Returns:

Status label string.

updated: Mapped[datetime]
updated_at: Mapped[datetime.datetime]

Date/time of instance last update.

class ReleaseController[source]

Bases: Controller

Controller for Release CRUD operations.

after_request: AfterRequestHookHandler | None

A sync or async function executed before a Request is passed to any route handler.

If this function returns a value, the request will not reach the route handler, and instead this value will be used.

after_response: AfterResponseHookHandler | None

A sync or async function called after the response has been awaited.

It receives the Request instance and should not return any values.

before_request: BeforeRequestHookHandler | None

A sync or async function called immediately before calling the route handler.

It receives the Request instance and any non-None return value is used for the response, bypassing the route handler.

cache_control: CacheControlHeader | None

A CacheControlHeader header to add to route handlers of this controller.

Can be overridden by route handlers.

dependencies: Dependencies | None

A string keyed dictionary of dependency Provider instances.

dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for (de)serializing and validation of request data.

etag: ETag | None

An etag header of type ETag to add to route handlers of this controller.

Can be overridden by route handlers.

exception_handlers: ExceptionHandlersMap | None

A map of handler functions to status codes and/or exception types.

guards: Sequence[Guard] | None

A sequence of Guard callables.

include_in_schema: bool | EmptyType

A boolean flag dictating whether the route handler should be documented in the OpenAPI schema

middleware: Sequence[Middleware] | None

A sequence of Middleware.

opt: Mapping[str, Any] | None

A string key mapping of arbitrary values that can be accessed in Guards or wherever you have access to Request or ASGI Scope.

owner: Router

The Router or Litestar app that owns the controller.

This value is set internally by Litestar and it should not be set when subclassing the controller.

parameters: ParametersMap | None

A mapping of Parameter definitions available to all application paths.

path: str

A path fragment for the controller.

All route handlers under the controller will have the fragment appended to them. If not set it defaults to /.

request_class: type[Request] | None

A custom subclass of Request to be used as the default request for all route handlers under the controller.

request_max_body_size: int | None | EmptyType

Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.

response_class: type[Response] | None

A custom subclass of Response to be used as the default response for all route handlers under the controller.

response_cookies: ResponseCookies | None

A list of Cookie instances.

response_headers: ResponseHeaders | None

A string keyed dictionary mapping ResponseHeader instances.

return_dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for serializing outbound response data.

security: Sequence[SecurityRequirement] | None

A sequence of dictionaries that to the schema of all route handlers under the controller.

signature_namespace: dict[str, Any]

A mapping of names to types for use in forward reference resolution during signature modelling.

signature_types: Sequence[Any]

A sequence of types for use in forward reference resolution during signature modelling.

These types will be added to the signature namespace using their __name__ attribute.

tags: Sequence[str] | None

A sequence of string tags that will be appended to the schema of all route handlers under the controller.

type_decoders: TypeDecodersSequence | None

A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.

type_encoders: TypeEncodersMap | None

A mapping of types to callables that transform them into types supported for serialization.

websocket_class: type[WebSocket] | None

A custom subclass of WebSocket to be used as the default websocket for all route handlers under the controller.

class ReleaseCreate[source]

Bases: ReleaseBase

Schema for creating a new release.

model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'content': 'Python 3.13.1 is the first maintenance release of Python 3.13...', 'eol_date': '2029-10-31', 'is_latest': True, 'is_published': True, 'name': 'Python 3.13.1', 'pre_release': False, 'release_date': '2025-01-15', 'release_notes_url': 'https://docs.python.org/release/3.13.1/whatsnew/changelog.html', 'release_page_id': '550e8400-e29b-41d4-a716-446655440100', 'show_on_download_page': True, 'slug': 'python-3131', 'status': 'bugfix', 'version': 'python3'}}}

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

class ReleaseDetailPageData[source]

Bases: BaseModel

Schema for release detail page template data.

model_config: ClassVar[ConfigDict] = {}

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

class ReleaseFile[source]

Bases: AuditBase, ContentManageableMixin, NameSlugMixin

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created: Mapped[datetime]
created_at: Mapped[datetime.datetime]

Date/time of instance creation.

creator
creator_id
id: Mapped[UUID]

UUID Primary key column.

last_modified_by
last_modified_by_id
name: Mapped[str]
slug: Mapped[str]
updated: Mapped[datetime]
updated_at: Mapped[datetime.datetime]

Date/time of instance last update.

class ReleaseFileController[source]

Bases: Controller

Controller for ReleaseFile CRUD operations.

after_request: AfterRequestHookHandler | None

A sync or async function executed before a Request is passed to any route handler.

If this function returns a value, the request will not reach the route handler, and instead this value will be used.

after_response: AfterResponseHookHandler | None

A sync or async function called after the response has been awaited.

It receives the Request instance and should not return any values.

before_request: BeforeRequestHookHandler | None

A sync or async function called immediately before calling the route handler.

It receives the Request instance and any non-None return value is used for the response, bypassing the route handler.

cache_control: CacheControlHeader | None

A CacheControlHeader header to add to route handlers of this controller.

Can be overridden by route handlers.

dependencies: Dependencies | None

A string keyed dictionary of dependency Provider instances.

dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for (de)serializing and validation of request data.

etag: ETag | None

An etag header of type ETag to add to route handlers of this controller.

Can be overridden by route handlers.

exception_handlers: ExceptionHandlersMap | None

A map of handler functions to status codes and/or exception types.

guards: Sequence[Guard] | None

A sequence of Guard callables.

include_in_schema: bool | EmptyType

A boolean flag dictating whether the route handler should be documented in the OpenAPI schema

middleware: Sequence[Middleware] | None

A sequence of Middleware.

opt: Mapping[str, Any] | None

A string key mapping of arbitrary values that can be accessed in Guards or wherever you have access to Request or ASGI Scope.

owner: Router

The Router or Litestar app that owns the controller.

This value is set internally by Litestar and it should not be set when subclassing the controller.

parameters: ParametersMap | None

A mapping of Parameter definitions available to all application paths.

path: str

A path fragment for the controller.

All route handlers under the controller will have the fragment appended to them. If not set it defaults to /.

request_class: type[Request] | None

A custom subclass of Request to be used as the default request for all route handlers under the controller.

request_max_body_size: int | None | EmptyType

Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.

response_class: type[Response] | None

A custom subclass of Response to be used as the default response for all route handlers under the controller.

response_cookies: ResponseCookies | None

A list of Cookie instances.

response_headers: ResponseHeaders | None

A string keyed dictionary mapping ResponseHeader instances.

return_dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for serializing outbound response data.

security: Sequence[SecurityRequirement] | None

A sequence of dictionaries that to the schema of all route handlers under the controller.

signature_namespace: dict[str, Any]

A mapping of names to types for use in forward reference resolution during signature modelling.

signature_types: Sequence[Any]

A sequence of types for use in forward reference resolution during signature modelling.

These types will be added to the signature namespace using their __name__ attribute.

tags: Sequence[str] | None

A sequence of string tags that will be appended to the schema of all route handlers under the controller.

type_decoders: TypeDecodersSequence | None

A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.

type_encoders: TypeEncodersMap | None

A mapping of types to callables that transform them into types supported for serialization.

websocket_class: type[WebSocket] | None

A custom subclass of WebSocket to be used as the default websocket for all route handlers under the controller.

class ReleaseFileCreate[source]

Bases: ReleaseFileBase

Schema for creating a new release file.

model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'description': 'macOS 64-bit universal2 installer', 'download_button': True, 'filesize': 45678901, 'is_source': False, 'md5_sum': 'abc123def456...', 'name': 'python-3.13.1-macos11.pkg', 'os_id': '550e8400-e29b-41d4-a716-446655440001', 'release_id': '550e8400-e29b-41d4-a716-446655440010', 'sha256_sum': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'slug': 'python-3131-macos11-pkg', 'url': 'https://www.python.org/ftp/python/3.13.1/python-3.13.1-macos11.pkg'}}}

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

class ReleaseFileRead[source]

Bases: ReleaseFileBase

Schema for reading release file data.

model_config: ClassVar[ConfigDict] = {'from_attributes': True, 'json_schema_extra': {'example': {'created_at': '2025-01-15T00:00:00Z', 'description': 'macOS 64-bit universal2 installer', 'download_button': True, 'filesize': 45678901, 'gpg_signature_file': '', 'id': '550e8400-e29b-41d4-a716-446655440020', 'is_source': False, 'md5_sum': 'abc123def456...', 'name': 'python-3.13.1-macos11.pkg', 'os_id': '550e8400-e29b-41d4-a716-446655440001', 'release_id': '550e8400-e29b-41d4-a716-446655440010', 'sbom_spdx2_file': '', 'sha256_sum': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'sigstore_bundle_file': '', 'sigstore_cert_file': '', 'sigstore_signature_file': '', 'slug': 'python-3131-macos11-pkg', 'updated_at': '2025-01-15T00:00:00Z', 'url': 'https://www.python.org/ftp/python/3.13.1/python-3.13.1-macos11.pkg'}}}

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

class ReleaseFileRepository[source]

Bases: SQLAlchemyAsyncRepository[ReleaseFile]

Repository for ReleaseFile database operations.

async get_by_os_id(os_id, limit=100)[source]

Get all files for a specific OS.

Parameters:
  • os_id (UUID) – The OS ID to search for.

  • limit (int) – Maximum number of files to return.

Return type:

list[ReleaseFile]

Returns:

List of release files.

async get_by_release_id(release_id)[source]

Get all files for a specific release.

Parameters:

release_id (UUID) – The release ID to search for.

Return type:

list[ReleaseFile]

Returns:

List of release files.

async get_by_slug(slug)[source]

Get a release file by slug.

Parameters:

slug (str) – The slug to search for.

Return type:

ReleaseFile | None

Returns:

The release file if found, None otherwise.

async get_source_files(release_id)[source]

Get all source files for a release.

Parameters:

release_id (UUID) – The release ID to search for.

Return type:

list[ReleaseFile]

Returns:

List of source release files.

model_type

alias of ReleaseFile

class ReleaseFileService[source]

Bases: SQLAlchemyAsyncRepositoryService[ReleaseFile, Any]

Service for ReleaseFile business logic.

async get_by_os_id(os_id, limit=100)[source]

Get all files for a specific OS.

Parameters:
  • os_id (UUID) – The OS ID to search for.

  • limit (int) – Maximum number of files to return.

Return type:

list[ReleaseFile]

Returns:

List of release files.

async get_by_release_id(release_id)[source]

Get all files for a specific release.

Parameters:

release_id (UUID) – The release ID to search for.

Return type:

list[ReleaseFile]

Returns:

List of release files.

async get_by_slug(slug)[source]

Get a release file by slug.

Parameters:

slug (str) – The slug to search for.

Return type:

ReleaseFile | None

Returns:

The release file if found, None otherwise.

async get_download_button_file(release_id, os_id)[source]

Get the download button file for a release and OS.

Parameters:
  • release_id (UUID) – The release ID.

  • os_id (UUID) – The OS ID.

Return type:

ReleaseFile | None

Returns:

The release file marked as download button, None if not found.

async get_source_files(release_id)[source]

Get all source files for a release.

Parameters:

release_id (UUID) – The release ID to search for.

Return type:

list[ReleaseFile]

Returns:

List of source release files.

match_fields: ClassVar[Optional[Union[list[str], str]]] = ['slug']

List of dialects that prefer to use field.id = ANY(:1) instead of field.id IN (...).

repository_type

alias of ReleaseFileRepository

class ReleaseFileWithOS[source]

Bases: ReleaseFileRead

Schema for release file with OS information.

model_config: ClassVar[ConfigDict] = {'from_attributes': True, 'json_schema_extra': {'example': {'created_at': '2025-01-15T00:00:00Z', 'description': 'macOS 64-bit universal2 installer', 'download_button': True, 'filesize': 45678901, 'id': '550e8400-e29b-41d4-a716-446655440020', 'is_source': False, 'md5_sum': 'abc123def456...', 'name': 'python-3.13.1-macos11.pkg', 'os': {'created_at': '2025-01-01T00:00:00Z', 'id': '550e8400-e29b-41d4-a716-446655440001', 'name': 'macOS', 'slug': 'macos', 'updated_at': '2025-01-01T00:00:00Z'}, 'os_id': '550e8400-e29b-41d4-a716-446655440001', 'release_id': '550e8400-e29b-41d4-a716-446655440010', 'slug': 'python-3131-macos11-pkg', 'updated_at': '2025-01-15T00:00:00Z', 'url': 'https://www.python.org/ftp/python/3.13.1/python-3.13.1-macos11.pkg'}}}

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

class ReleaseList[source]

Bases: BaseModel

Schema for release list items.

model_config: ClassVar[ConfigDict] = {'from_attributes': True, 'json_schema_extra': {'example': {'eol_date': '2029-10-31', 'id': '550e8400-e29b-41d4-a716-446655440010', 'is_latest': True, 'is_published': True, 'name': 'Python 3.13.1', 'pre_release': False, 'release_date': '2025-01-15', 'slug': 'python-3131', 'status': 'bugfix', 'version': 'python3'}}}

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

class ReleaseRead[source]

Bases: ReleaseBase

Schema for reading release data.

model_config: ClassVar[ConfigDict] = {'from_attributes': True, 'json_schema_extra': {'example': {'content': 'Python 3.13.1 is the first maintenance release...', 'created_at': '2025-01-15T00:00:00Z', 'eol_date': '2029-10-31', 'id': '550e8400-e29b-41d4-a716-446655440010', 'is_latest': True, 'is_published': True, 'name': 'Python 3.13.1', 'pre_release': False, 'release_date': '2025-01-15', 'release_notes_url': 'https://docs.python.org/release/3.13.1/whatsnew/changelog.html', 'release_page_id': '550e8400-e29b-41d4-a716-446655440100', 'show_on_download_page': True, 'slug': 'python-3131', 'status': 'bugfix', 'updated_at': '2025-01-15T00:00:00Z', 'version': 'python3'}}}

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

class ReleaseRepository[source]

Bases: SQLAlchemyAsyncRepository[Release]

Repository for Release database operations.

async get_by_slug(slug)[source]

Get a release by slug.

Parameters:

slug (str) – The slug to search for.

Return type:

Release | None

Returns:

The release if found, None otherwise.

async get_by_version(version, limit=100)[source]

Get all releases for a specific Python version.

Parameters:
  • version (PythonVersion) – The Python version to filter by.

  • limit (int) – Maximum number of releases to return.

Return type:

list[Release]

Returns:

List of releases for the specified version.

async get_for_download_page(limit=100)[source]

Get releases marked to show on the download page.

Parameters:

limit (int) – Maximum number of releases to return.

Return type:

list[Release]

Returns:

List of releases for download page ordered by release date descending.

async get_latest(version=PythonVersion.PYTHON3)[source]

Get the latest stable release for a Python version.

Parameters:

version (PythonVersion) – The Python version to search for.

Return type:

Release | None

Returns:

The latest release if found, None otherwise.

async get_published(limit=100, offset=0)[source]

Get all published releases.

Parameters:
  • limit (int) – Maximum number of releases to return.

  • offset (int) – Number of releases to skip.

Return type:

list[Release]

Returns:

List of published releases ordered by release date descending.

model_type

alias of Release

class ReleaseService[source]

Bases: SQLAlchemyAsyncRepositoryService[Release, Any]

Service for Release business logic.

async get_by_slug(slug)[source]

Get a release by slug.

Parameters:

slug (str) – The slug to search for.

Return type:

Release | None

Returns:

The release if found, None otherwise.

async get_by_version(version, limit=100)[source]

Get all releases for a specific Python version.

Parameters:
  • version (PythonVersion) – The Python version to filter by.

  • limit (int) – Maximum number of releases to return.

Return type:

list[Release]

Returns:

List of releases for the specified version.

async get_files_grouped_by_os(release_id)[source]

Get release files grouped by OS slug.

Parameters:

release_id (UUID) – The release ID to get files for.

Return type:

dict[str, list[ReleaseFile]]

Returns:

Dictionary mapping OS slug to list of release files.

async get_for_download_page(limit=100)[source]

Get releases marked to show on the download page.

Parameters:

limit (int) – Maximum number of releases to return.

Return type:

list[Release]

Returns:

List of releases for download page.

async get_latest(version=PythonVersion.PYTHON3)[source]

Get the latest stable release for a Python version.

Parameters:

version (PythonVersion) – The Python version to search for.

Return type:

Release | None

Returns:

The latest release if found, None otherwise.

async get_published(limit=100, offset=0)[source]

Get all published releases.

Parameters:
  • limit (int) – Maximum number of releases to return.

  • offset (int) – Number of releases to skip.

Return type:

list[Release]

Returns:

List of published releases.

async get_releases_grouped_by_minor_version(limit=500)[source]

Get releases grouped by major and then minor version.

Returns a nested dict structure:

{
    "3": {
        "3.14": [releases...],
        "3.13": [releases...],
        ...
    },
    "2": {
        "2.7": [releases...],
    }
}
Parameters:

limit (int) – Maximum number of releases to fetch.

Return type:

dict[str, dict[str, list[Release]]]

Returns:

Nested dictionary mapping major version -> minor version -> releases.

async mark_as_latest(release_id, version)[source]

Mark a release as the latest for its Python version.

This will unmark any other releases as latest for the same version.

Parameters:
  • release_id (UUID) – The release ID to mark as latest.

  • version (PythonVersion) – The Python version.

Return type:

Release

Returns:

The updated release instance.

match_fields: ClassVar[Optional[Union[list[str], str]]] = ['slug']

List of dialects that prefer to use field.id = ANY(:1) instead of field.id IN (...).

repository_type

alias of ReleaseRepository

class ReleaseUpdate[source]

Bases: BaseModel

Schema for updating a release.

model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'content': 'Updated release notes for Python 3.13.1...', 'is_latest': True, 'is_published': True, 'status': 'bugfix'}}}

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

get_downloads_dependencies()[source]

Get all downloads domain dependency providers.

Return type:

dict

models

Downloads domain models.

class PythonVersion[source]

Bases: StrEnum

__new__(value)
class ReleaseStatus[source]

Bases: StrEnum

__new__(value)
class OS[source]

Bases: AuditBase, ContentManageableMixin, NameSlugMixin

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created: Mapped[datetime]
created_at: Mapped[datetime.datetime]

Date/time of instance creation.

creator
creator_id
id: Mapped[UUID]

UUID Primary key column.

last_modified_by
last_modified_by_id
name: Mapped[str]
slug: Mapped[str]
updated: Mapped[datetime]
updated_at: Mapped[datetime.datetime]

Date/time of instance last update.

class Release[source]

Bases: AuditBase, ContentManageableMixin, NameSlugMixin

property minor_version: str

Extract minor version string (e.g., ‘3.12’ from ‘3.12.1’).

Returns:

Minor version string or full name if parsing fails.

property major_version: str

Extract major version string (e.g., ‘3’ from ‘3.12.1’).

Returns:

Major version string or full name if parsing fails.

property is_eol: bool

Check if this release series has reached end of life.

Returns:

True if status is EOL or eol_date has passed.

property is_prerelease: bool

Check if this is a pre-release version (alpha, beta, RC).

Returns:

True if status is prerelease or pre_release flag is set.

property status_label: str

Get human-readable status label.

Returns:

Status label string.

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created: Mapped[datetime]
created_at: Mapped[datetime.datetime]

Date/time of instance creation.

creator
creator_id
id: Mapped[UUID]

UUID Primary key column.

last_modified_by
last_modified_by_id
name: Mapped[str]
slug: Mapped[str]
updated: Mapped[datetime]
updated_at: Mapped[datetime.datetime]

Date/time of instance last update.

class ReleaseFile[source]

Bases: AuditBase, ContentManageableMixin, NameSlugMixin

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created: Mapped[datetime]
created_at: Mapped[datetime.datetime]

Date/time of instance creation.

creator
creator_id
id: Mapped[UUID]

UUID Primary key column.

last_modified_by
last_modified_by_id
name: Mapped[str]
slug: Mapped[str]
updated: Mapped[datetime]
updated_at: Mapped[datetime.datetime]

Date/time of instance last update.

class DownloadStatistic[source]

Bases: UUIDAuditBase

Daily download statistics for release files.

Stores aggregated download counts per file per day for analytics. Redis provides real-time counters; this table provides historical data.

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at: Mapped[datetime.datetime]

Date/time of instance creation.

id: Mapped[UUID]

UUID Primary key column.

updated_at: Mapped[datetime.datetime]

Date/time of instance last update.

schemas

Downloads domain Pydantic schemas.

class OSBase[source]

Bases: BaseModel

Base OS schema with common fields.

model_config: ClassVar[ConfigDict] = {}

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

class OSCreate[source]

Bases: OSBase

Schema for creating a new OS.

model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'name': 'macOS', 'slug': 'macos'}}}

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

class OSRead[source]

Bases: OSBase

Schema for reading OS data.

model_config: ClassVar[ConfigDict] = {'from_attributes': True, 'json_schema_extra': {'example': {'created_at': '2025-01-01T00:00:00Z', 'id': '550e8400-e29b-41d4-a716-446655440001', 'name': 'macOS', 'slug': 'macos', 'updated_at': '2025-01-01T00:00:00Z'}}}

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

class ReleaseBase[source]

Bases: BaseModel

Base release schema with common fields.

model_config: ClassVar[ConfigDict] = {}

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

class ReleaseCreate[source]

Bases: ReleaseBase

Schema for creating a new release.

model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'content': 'Python 3.13.1 is the first maintenance release of Python 3.13...', 'eol_date': '2029-10-31', 'is_latest': True, 'is_published': True, 'name': 'Python 3.13.1', 'pre_release': False, 'release_date': '2025-01-15', 'release_notes_url': 'https://docs.python.org/release/3.13.1/whatsnew/changelog.html', 'release_page_id': '550e8400-e29b-41d4-a716-446655440100', 'show_on_download_page': True, 'slug': 'python-3131', 'status': 'bugfix', 'version': 'python3'}}}

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

class ReleaseUpdate[source]

Bases: BaseModel

Schema for updating a release.

model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'content': 'Updated release notes for Python 3.13.1...', 'is_latest': True, 'is_published': True, 'status': 'bugfix'}}}

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

class ReleaseRead[source]

Bases: ReleaseBase

Schema for reading release data.

model_config: ClassVar[ConfigDict] = {'from_attributes': True, 'json_schema_extra': {'example': {'content': 'Python 3.13.1 is the first maintenance release...', 'created_at': '2025-01-15T00:00:00Z', 'eol_date': '2029-10-31', 'id': '550e8400-e29b-41d4-a716-446655440010', 'is_latest': True, 'is_published': True, 'name': 'Python 3.13.1', 'pre_release': False, 'release_date': '2025-01-15', 'release_notes_url': 'https://docs.python.org/release/3.13.1/whatsnew/changelog.html', 'release_page_id': '550e8400-e29b-41d4-a716-446655440100', 'show_on_download_page': True, 'slug': 'python-3131', 'status': 'bugfix', 'updated_at': '2025-01-15T00:00:00Z', 'version': 'python3'}}}

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

class ReleaseList[source]

Bases: BaseModel

Schema for release list items.

model_config: ClassVar[ConfigDict] = {'from_attributes': True, 'json_schema_extra': {'example': {'eol_date': '2029-10-31', 'id': '550e8400-e29b-41d4-a716-446655440010', 'is_latest': True, 'is_published': True, 'name': 'Python 3.13.1', 'pre_release': False, 'release_date': '2025-01-15', 'slug': 'python-3131', 'status': 'bugfix', 'version': 'python3'}}}

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

class ReleaseFileBase[source]

Bases: BaseModel

Base release file schema with common fields.

model_config: ClassVar[ConfigDict] = {}

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

class ReleaseFileCreate[source]

Bases: ReleaseFileBase

Schema for creating a new release file.

model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'description': 'macOS 64-bit universal2 installer', 'download_button': True, 'filesize': 45678901, 'is_source': False, 'md5_sum': 'abc123def456...', 'name': 'python-3.13.1-macos11.pkg', 'os_id': '550e8400-e29b-41d4-a716-446655440001', 'release_id': '550e8400-e29b-41d4-a716-446655440010', 'sha256_sum': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'slug': 'python-3131-macos11-pkg', 'url': 'https://www.python.org/ftp/python/3.13.1/python-3.13.1-macos11.pkg'}}}

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

class ReleaseFileRead[source]

Bases: ReleaseFileBase

Schema for reading release file data.

model_config: ClassVar[ConfigDict] = {'from_attributes': True, 'json_schema_extra': {'example': {'created_at': '2025-01-15T00:00:00Z', 'description': 'macOS 64-bit universal2 installer', 'download_button': True, 'filesize': 45678901, 'gpg_signature_file': '', 'id': '550e8400-e29b-41d4-a716-446655440020', 'is_source': False, 'md5_sum': 'abc123def456...', 'name': 'python-3.13.1-macos11.pkg', 'os_id': '550e8400-e29b-41d4-a716-446655440001', 'release_id': '550e8400-e29b-41d4-a716-446655440010', 'sbom_spdx2_file': '', 'sha256_sum': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'sigstore_bundle_file': '', 'sigstore_cert_file': '', 'sigstore_signature_file': '', 'slug': 'python-3131-macos11-pkg', 'updated_at': '2025-01-15T00:00:00Z', 'url': 'https://www.python.org/ftp/python/3.13.1/python-3.13.1-macos11.pkg'}}}

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

class ReleaseFileWithOS[source]

Bases: ReleaseFileRead

Schema for release file with OS information.

model_config: ClassVar[ConfigDict] = {'from_attributes': True, 'json_schema_extra': {'example': {'created_at': '2025-01-15T00:00:00Z', 'description': 'macOS 64-bit universal2 installer', 'download_button': True, 'filesize': 45678901, 'id': '550e8400-e29b-41d4-a716-446655440020', 'is_source': False, 'md5_sum': 'abc123def456...', 'name': 'python-3.13.1-macos11.pkg', 'os': {'created_at': '2025-01-01T00:00:00Z', 'id': '550e8400-e29b-41d4-a716-446655440001', 'name': 'macOS', 'slug': 'macos', 'updated_at': '2025-01-01T00:00:00Z'}, 'os_id': '550e8400-e29b-41d4-a716-446655440001', 'release_id': '550e8400-e29b-41d4-a716-446655440010', 'slug': 'python-3131-macos11-pkg', 'updated_at': '2025-01-15T00:00:00Z', 'url': 'https://www.python.org/ftp/python/3.13.1/python-3.13.1-macos11.pkg'}}}

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

class DownloadPageData[source]

Bases: BaseModel

Schema for download page template data.

model_config: ClassVar[ConfigDict] = {}

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

class ReleaseDetailPageData[source]

Bases: BaseModel

Schema for release detail page template data.

model_config: ClassVar[ConfigDict] = {}

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

services

Downloads domain services for business logic.

class OSService[source]

Bases: SQLAlchemyAsyncRepositoryService[OS, Any]

Service for OS business logic.

repository_type

alias of OSRepository

match_fields: ClassVar[Optional[Union[list[str], str]]] = ['slug']

List of dialects that prefer to use field.id = ANY(:1) instead of field.id IN (...).

async get_by_slug(slug)[source]

Get an OS by slug.

Parameters:

slug (str) – The slug to search for.

Return type:

OS | None

Returns:

The OS if found, None otherwise.

class ReleaseService[source]

Bases: SQLAlchemyAsyncRepositoryService[Release, Any]

Service for Release business logic.

repository_type

alias of ReleaseRepository

match_fields: ClassVar[Optional[Union[list[str], str]]] = ['slug']

List of dialects that prefer to use field.id = ANY(:1) instead of field.id IN (...).

async get_by_slug(slug)[source]

Get a release by slug.

Parameters:

slug (str) – The slug to search for.

Return type:

Release | None

Returns:

The release if found, None otherwise.

async get_latest(version=PythonVersion.PYTHON3)[source]

Get the latest stable release for a Python version.

Parameters:

version (PythonVersion) – The Python version to search for.

Return type:

Release | None

Returns:

The latest release if found, None otherwise.

async get_published(limit=100, offset=0)[source]

Get all published releases.

Parameters:
  • limit (int) – Maximum number of releases to return.

  • offset (int) – Number of releases to skip.

Return type:

list[Release]

Returns:

List of published releases.

async get_for_download_page(limit=100)[source]

Get releases marked to show on the download page.

Parameters:

limit (int) – Maximum number of releases to return.

Return type:

list[Release]

Returns:

List of releases for download page.

async get_by_version(version, limit=100)[source]

Get all releases for a specific Python version.

Parameters:
  • version (PythonVersion) – The Python version to filter by.

  • limit (int) – Maximum number of releases to return.

Return type:

list[Release]

Returns:

List of releases for the specified version.

async get_files_grouped_by_os(release_id)[source]

Get release files grouped by OS slug.

Parameters:

release_id (UUID) – The release ID to get files for.

Return type:

dict[str, list[ReleaseFile]]

Returns:

Dictionary mapping OS slug to list of release files.

async get_releases_grouped_by_minor_version(limit=500)[source]

Get releases grouped by major and then minor version.

Returns a nested dict structure:

{
    "3": {
        "3.14": [releases...],
        "3.13": [releases...],
        ...
    },
    "2": {
        "2.7": [releases...],
    }
}
Parameters:

limit (int) – Maximum number of releases to fetch.

Return type:

dict[str, dict[str, list[Release]]]

Returns:

Nested dictionary mapping major version -> minor version -> releases.

async mark_as_latest(release_id, version)[source]

Mark a release as the latest for its Python version.

This will unmark any other releases as latest for the same version.

Parameters:
  • release_id (UUID) – The release ID to mark as latest.

  • version (PythonVersion) – The Python version.

Return type:

Release

Returns:

The updated release instance.

class ReleaseFileService[source]

Bases: SQLAlchemyAsyncRepositoryService[ReleaseFile, Any]

Service for ReleaseFile business logic.

repository_type

alias of ReleaseFileRepository

match_fields: ClassVar[Optional[Union[list[str], str]]] = ['slug']

List of dialects that prefer to use field.id = ANY(:1) instead of field.id IN (...).

async get_by_release_id(release_id)[source]

Get all files for a specific release.

Parameters:

release_id (UUID) – The release ID to search for.

Return type:

list[ReleaseFile]

Returns:

List of release files.

async get_by_os_id(os_id, limit=100)[source]

Get all files for a specific OS.

Parameters:
  • os_id (UUID) – The OS ID to search for.

  • limit (int) – Maximum number of files to return.

Return type:

list[ReleaseFile]

Returns:

List of release files.

async get_by_slug(slug)[source]

Get a release file by slug.

Parameters:

slug (str) – The slug to search for.

Return type:

ReleaseFile | None

Returns:

The release file if found, None otherwise.

async get_source_files(release_id)[source]

Get all source files for a release.

Parameters:

release_id (UUID) – The release ID to search for.

Return type:

list[ReleaseFile]

Returns:

List of source release files.

async get_download_button_file(release_id, os_id)[source]

Get the download button file for a release and OS.

Parameters:
  • release_id (UUID) – The release ID.

  • os_id (UUID) – The OS ID.

Return type:

ReleaseFile | None

Returns:

The release file marked as download button, None if not found.

controllers

Downloads domain API and page controllers.

class OSController[source]

Bases: Controller

Controller for OS CRUD operations.

path: str

A path fragment for the controller.

All route handlers under the controller will have the fragment appended to them. If not set it defaults to /.

tags: Sequence[str] | None

A sequence of string tags that will be appended to the schema of all route handlers under the controller.

after_request: AfterRequestHookHandler | None

A sync or async function executed before a Request is passed to any route handler.

If this function returns a value, the request will not reach the route handler, and instead this value will be used.

after_response: AfterResponseHookHandler | None

A sync or async function called after the response has been awaited.

It receives the Request instance and should not return any values.

before_request: BeforeRequestHookHandler | None

A sync or async function called immediately before calling the route handler.

It receives the Request instance and any non-None return value is used for the response, bypassing the route handler.

cache_control: CacheControlHeader | None

A CacheControlHeader header to add to route handlers of this controller.

Can be overridden by route handlers.

dependencies: Dependencies | None

A string keyed dictionary of dependency Provider instances.

dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for (de)serializing and validation of request data.

etag: ETag | None

An etag header of type ETag to add to route handlers of this controller.

Can be overridden by route handlers.

exception_handlers: ExceptionHandlersMap | None

A map of handler functions to status codes and/or exception types.

guards: Sequence[Guard] | None

A sequence of Guard callables.

include_in_schema: bool | EmptyType

A boolean flag dictating whether the route handler should be documented in the OpenAPI schema

middleware: Sequence[Middleware] | None

A sequence of Middleware.

opt: Mapping[str, Any] | None

A string key mapping of arbitrary values that can be accessed in Guards or wherever you have access to Request or ASGI Scope.

owner: Router

The Router or Litestar app that owns the controller.

This value is set internally by Litestar and it should not be set when subclassing the controller.

parameters: ParametersMap | None

A mapping of Parameter definitions available to all application paths.

request_class: type[Request] | None

A custom subclass of Request to be used as the default request for all route handlers under the controller.

request_max_body_size: int | None | EmptyType

Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.

response_class: type[Response] | None

A custom subclass of Response to be used as the default response for all route handlers under the controller.

response_cookies: ResponseCookies | None

A list of Cookie instances.

response_headers: ResponseHeaders | None

A string keyed dictionary mapping ResponseHeader instances.

return_dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for serializing outbound response data.

security: Sequence[SecurityRequirement] | None

A sequence of dictionaries that to the schema of all route handlers under the controller.

signature_namespace: dict[str, Any]

A mapping of names to types for use in forward reference resolution during signature modelling.

signature_types: Sequence[Any]

A sequence of types for use in forward reference resolution during signature modelling.

These types will be added to the signature namespace using their __name__ attribute.

type_decoders: TypeDecodersSequence | None

A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.

type_encoders: TypeEncodersMap | None

A mapping of types to callables that transform them into types supported for serialization.

websocket_class: type[WebSocket] | None

A custom subclass of WebSocket to be used as the default websocket for all route handlers under the controller.

class ReleaseController[source]

Bases: Controller

Controller for Release CRUD operations.

path: str

A path fragment for the controller.

All route handlers under the controller will have the fragment appended to them. If not set it defaults to /.

tags: Sequence[str] | None

A sequence of string tags that will be appended to the schema of all route handlers under the controller.

after_request: AfterRequestHookHandler | None

A sync or async function executed before a Request is passed to any route handler.

If this function returns a value, the request will not reach the route handler, and instead this value will be used.

after_response: AfterResponseHookHandler | None

A sync or async function called after the response has been awaited.

It receives the Request instance and should not return any values.

before_request: BeforeRequestHookHandler | None

A sync or async function called immediately before calling the route handler.

It receives the Request instance and any non-None return value is used for the response, bypassing the route handler.

cache_control: CacheControlHeader | None

A CacheControlHeader header to add to route handlers of this controller.

Can be overridden by route handlers.

dependencies: Dependencies | None

A string keyed dictionary of dependency Provider instances.

dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for (de)serializing and validation of request data.

etag: ETag | None

An etag header of type ETag to add to route handlers of this controller.

Can be overridden by route handlers.

exception_handlers: ExceptionHandlersMap | None

A map of handler functions to status codes and/or exception types.

guards: Sequence[Guard] | None

A sequence of Guard callables.

include_in_schema: bool | EmptyType

A boolean flag dictating whether the route handler should be documented in the OpenAPI schema

middleware: Sequence[Middleware] | None

A sequence of Middleware.

opt: Mapping[str, Any] | None

A string key mapping of arbitrary values that can be accessed in Guards or wherever you have access to Request or ASGI Scope.

owner: Router

The Router or Litestar app that owns the controller.

This value is set internally by Litestar and it should not be set when subclassing the controller.

parameters: ParametersMap | None

A mapping of Parameter definitions available to all application paths.

request_class: type[Request] | None

A custom subclass of Request to be used as the default request for all route handlers under the controller.

request_max_body_size: int | None | EmptyType

Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.

response_class: type[Response] | None

A custom subclass of Response to be used as the default response for all route handlers under the controller.

response_cookies: ResponseCookies | None

A list of Cookie instances.

response_headers: ResponseHeaders | None

A string keyed dictionary mapping ResponseHeader instances.

return_dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for serializing outbound response data.

security: Sequence[SecurityRequirement] | None

A sequence of dictionaries that to the schema of all route handlers under the controller.

signature_namespace: dict[str, Any]

A mapping of names to types for use in forward reference resolution during signature modelling.

signature_types: Sequence[Any]

A sequence of types for use in forward reference resolution during signature modelling.

These types will be added to the signature namespace using their __name__ attribute.

type_decoders: TypeDecodersSequence | None

A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.

type_encoders: TypeEncodersMap | None

A mapping of types to callables that transform them into types supported for serialization.

websocket_class: type[WebSocket] | None

A custom subclass of WebSocket to be used as the default websocket for all route handlers under the controller.

class ReleaseFileController[source]

Bases: Controller

Controller for ReleaseFile CRUD operations.

path: str

A path fragment for the controller.

All route handlers under the controller will have the fragment appended to them. If not set it defaults to /.

tags: Sequence[str] | None

A sequence of string tags that will be appended to the schema of all route handlers under the controller.

after_request: AfterRequestHookHandler | None

A sync or async function executed before a Request is passed to any route handler.

If this function returns a value, the request will not reach the route handler, and instead this value will be used.

after_response: AfterResponseHookHandler | None

A sync or async function called after the response has been awaited.

It receives the Request instance and should not return any values.

before_request: BeforeRequestHookHandler | None

A sync or async function called immediately before calling the route handler.

It receives the Request instance and any non-None return value is used for the response, bypassing the route handler.

cache_control: CacheControlHeader | None

A CacheControlHeader header to add to route handlers of this controller.

Can be overridden by route handlers.

dependencies: Dependencies | None

A string keyed dictionary of dependency Provider instances.

dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for (de)serializing and validation of request data.

etag: ETag | None

An etag header of type ETag to add to route handlers of this controller.

Can be overridden by route handlers.

exception_handlers: ExceptionHandlersMap | None

A map of handler functions to status codes and/or exception types.

guards: Sequence[Guard] | None

A sequence of Guard callables.

include_in_schema: bool | EmptyType

A boolean flag dictating whether the route handler should be documented in the OpenAPI schema

middleware: Sequence[Middleware] | None

A sequence of Middleware.

opt: Mapping[str, Any] | None

A string key mapping of arbitrary values that can be accessed in Guards or wherever you have access to Request or ASGI Scope.

owner: Router

The Router or Litestar app that owns the controller.

This value is set internally by Litestar and it should not be set when subclassing the controller.

parameters: ParametersMap | None

A mapping of Parameter definitions available to all application paths.

request_class: type[Request] | None

A custom subclass of Request to be used as the default request for all route handlers under the controller.

request_max_body_size: int | None | EmptyType

Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.

response_class: type[Response] | None

A custom subclass of Response to be used as the default response for all route handlers under the controller.

response_cookies: ResponseCookies | None

A list of Cookie instances.

response_headers: ResponseHeaders | None

A string keyed dictionary mapping ResponseHeader instances.

return_dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for serializing outbound response data.

security: Sequence[SecurityRequirement] | None

A sequence of dictionaries that to the schema of all route handlers under the controller.

signature_namespace: dict[str, Any]

A mapping of names to types for use in forward reference resolution during signature modelling.

signature_types: Sequence[Any]

A sequence of types for use in forward reference resolution during signature modelling.

These types will be added to the signature namespace using their __name__ attribute.

type_decoders: TypeDecodersSequence | None

A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.

type_encoders: TypeEncodersMap | None

A mapping of types to callables that transform them into types supported for serialization.

websocket_class: type[WebSocket] | None

A custom subclass of WebSocket to be used as the default websocket for all route handlers under the controller.

class DownloadsPageController[source]

Bases: Controller

Controller for download HTML pages.

path: str

A path fragment for the controller.

All route handlers under the controller will have the fragment appended to them. If not set it defaults to /.

include_in_schema: bool | EmptyType

A boolean flag dictating whether the route handler should be documented in the OpenAPI schema

after_request: AfterRequestHookHandler | None

A sync or async function executed before a Request is passed to any route handler.

If this function returns a value, the request will not reach the route handler, and instead this value will be used.

after_response: AfterResponseHookHandler | None

A sync or async function called after the response has been awaited.

It receives the Request instance and should not return any values.

before_request: BeforeRequestHookHandler | None

A sync or async function called immediately before calling the route handler.

It receives the Request instance and any non-None return value is used for the response, bypassing the route handler.

cache_control: CacheControlHeader | None

A CacheControlHeader header to add to route handlers of this controller.

Can be overridden by route handlers.

dependencies: Dependencies | None

A string keyed dictionary of dependency Provider instances.

dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for (de)serializing and validation of request data.

etag: ETag | None

An etag header of type ETag to add to route handlers of this controller.

Can be overridden by route handlers.

exception_handlers: ExceptionHandlersMap | None

A map of handler functions to status codes and/or exception types.

guards: Sequence[Guard] | None

A sequence of Guard callables.

middleware: Sequence[Middleware] | None

A sequence of Middleware.

opt: Mapping[str, Any] | None

A string key mapping of arbitrary values that can be accessed in Guards or wherever you have access to Request or ASGI Scope.

owner: Router

The Router or Litestar app that owns the controller.

This value is set internally by Litestar and it should not be set when subclassing the controller.

parameters: ParametersMap | None

A mapping of Parameter definitions available to all application paths.

request_class: type[Request] | None

A custom subclass of Request to be used as the default request for all route handlers under the controller.

request_max_body_size: int | None | EmptyType

Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.

response_class: type[Response] | None

A custom subclass of Response to be used as the default response for all route handlers under the controller.

response_cookies: ResponseCookies | None

A list of Cookie instances.

response_headers: ResponseHeaders | None

A string keyed dictionary mapping ResponseHeader instances.

return_dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for serializing outbound response data.

security: Sequence[SecurityRequirement] | None

A sequence of dictionaries that to the schema of all route handlers under the controller.

signature_namespace: dict[str, Any]

A mapping of names to types for use in forward reference resolution during signature modelling.

signature_types: Sequence[Any]

A sequence of types for use in forward reference resolution during signature modelling.

These types will be added to the signature namespace using their __name__ attribute.

tags: Sequence[str] | None

A sequence of string tags that will be appended to the schema of all route handlers under the controller.

type_decoders: TypeDecodersSequence | None

A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.

type_encoders: TypeEncodersMap | None

A mapping of types to callables that transform them into types supported for serialization.

websocket_class: type[WebSocket] | None

A custom subclass of WebSocket to be used as the default websocket for all route handlers under the controller.

repositories

Downloads domain repositories for database access.

class OSRepository[source]

Bases: SQLAlchemyAsyncRepository[OS]

Repository for OS database operations.

model_type

alias of OS

async get_by_slug(slug)[source]

Get an OS by slug.

Parameters:

slug (str) – The slug to search for.

Return type:

OS | None

Returns:

The OS if found, None otherwise.

class ReleaseRepository[source]

Bases: SQLAlchemyAsyncRepository[Release]

Repository for Release database operations.

model_type

alias of Release

async get_by_slug(slug)[source]

Get a release by slug.

Parameters:

slug (str) – The slug to search for.

Return type:

Release | None

Returns:

The release if found, None otherwise.

async get_latest(version=PythonVersion.PYTHON3)[source]

Get the latest stable release for a Python version.

Parameters:

version (PythonVersion) – The Python version to search for.

Return type:

Release | None

Returns:

The latest release if found, None otherwise.

async get_published(limit=100, offset=0)[source]

Get all published releases.

Parameters:
  • limit (int) – Maximum number of releases to return.

  • offset (int) – Number of releases to skip.

Return type:

list[Release]

Returns:

List of published releases ordered by release date descending.

async get_for_download_page(limit=100)[source]

Get releases marked to show on the download page.

Parameters:

limit (int) – Maximum number of releases to return.

Return type:

list[Release]

Returns:

List of releases for download page ordered by release date descending.

async get_by_version(version, limit=100)[source]

Get all releases for a specific Python version.

Parameters:
  • version (PythonVersion) – The Python version to filter by.

  • limit (int) – Maximum number of releases to return.

Return type:

list[Release]

Returns:

List of releases for the specified version.

class ReleaseFileRepository[source]

Bases: SQLAlchemyAsyncRepository[ReleaseFile]

Repository for ReleaseFile database operations.

model_type

alias of ReleaseFile

async get_by_release_id(release_id)[source]

Get all files for a specific release.

Parameters:

release_id (UUID) – The release ID to search for.

Return type:

list[ReleaseFile]

Returns:

List of release files.

async get_by_os_id(os_id, limit=100)[source]

Get all files for a specific OS.

Parameters:
  • os_id (UUID) – The OS ID to search for.

  • limit (int) – Maximum number of files to return.

Return type:

list[ReleaseFile]

Returns:

List of release files.

async get_by_slug(slug)[source]

Get a release file by slug.

Parameters:

slug (str) – The slug to search for.

Return type:

ReleaseFile | None

Returns:

The release file if found, None otherwise.

async get_source_files(release_id)[source]

Get all source files for a release.

Parameters:

release_id (UUID) – The release ID to search for.

Return type:

list[ReleaseFile]

Returns:

List of source release files.