module schema.py
Global Variables
- PEPHUB_SCHEMA_VERSION_URL
- PEPHUB_SCHEMA_VERSIONS_URL
- PEPHUB_SCHEMA_NEW_SCHEMA_URL
- PEPHUB_SCHEMA_NEW_VERSION_URL
- PEPHUB_SCHEMA_RECORD_URL
- LATEST_VERSION
class PEPHubSchema
Class for managing schemas in PEPhub and provides methods for getting, creating, updating and removing schemas records and schema versions.
function __init__
__init__(jwt_data: str = None)
- :param jwt_data: jwt token for authorization
function add_version
add_version(
namespace: str,
schema_name: str,
schema_value: dict,
version: str = '1.0.0',
contributors: str = None,
release_notes: str = None,
tags: Optional[str, List[str], dict] = None
) → None
Add new version to the schema registry
- :param namespace: Namespace of the schema
- :param schema_name: Name of the schema record
- :param schema_value: Schema value itself in dict format
- :param version: First version of the schema
- :param contributors: Schema contributors of current version
- :param release_notes: Release notes for current version
- :param tags: Tags of the current version. Can be str, list[str], or dict
:raise: ResponseError if status not 202. :return: None
function create_schema
create_schema(
namespace: str,
schema_name: str,
schema_value: dict,
version: str = '1.0.0',
description: str = None,
maintainers: str = None,
contributors: str = None,
release_notes: str = None,
tags: Optional[str, List[str], dict] = None,
lifecycle_stage: str = None,
private: bool = False
) → None
Create a new schema record + version in the database
- :param namespace: Namespace of the schema
- :param schema_name: Name of the schema record
- :param schema_value: Schema value itself in dict format
- :param version: First version of the schema
- :param description: Schema description
- :param maintainers: Schema maintainers
- :param contributors: Schema contributors of current version
- :param release_notes: Release notes for current version
- :param tags: Tags of the current version. Can be str, list[str], or dict
- :param lifecycle_stage: Stage of the schema record
- :param private: Weather project should be public or private. Default: False (public)
:raise: ResponseError if status not 202. :return: None
function delete_schema
delete_schema(namespace: str, schema_name: str) → None
Delete schema from the database
- :param namespace: Namespace of the schema
- :param schema_name: Name of the schema version
function delete_version
delete_version(namespace: str, schema_name: str, version: str) → None
Delete schema Version
- :param namespace: Namespace of the schema
- :param schema_name: Name of the schema
- :param version: Schema version
:raise: ResponseError if status not 202. :return: None
function get
get(namespace: str, schema_name: str, version: str = 'latest') → dict
Get schema value for specific schema version.
- :param: namespace: namespace of schema
- :param: schema_name: name of schema
- :param: version: version of schema
:return: Schema object as dictionary
function get_versions
get_versions(namespace: str, schema_name: str) → SchemaVersionResult
Get list of versions
- :param namespace: Namespace of the schema record
- :param schema_name: Name of the schema record
:return: { pagination: PaginationResult results: List[SchemaVersionAnnotation] }
function update_record
update_record(
namespace: str,
schema_name: str,
update_fields: Union[dict, UpdateSchemaRecordFields]
) → None
Update schema registry data
- :param namespace: Namespace of the schema
- :param schema_name: Name of the schema version
- :param update_fields: dict or pydantic model UpdateSchemaRecordFields: { maintainers: str, lifecycle_stage: str, private: bool, name: str, description: str, }
:raise: ResponseError if status not 202. :return: None
function update_version
update_version(
namespace: str,
schema_name: str,
version: str,
update_fields: Union[dict, UpdateSchemaVersionFields]
) → None
Update released version of the schema.
-
:param namespace: Namespace of the schema
-
:param schema_name: Name of the schema version
- :param version: Schema version
- :param update_fields: dict or pydantic model UpdateSchemaVersionFields: { contributors: str, schema_value: str, release_notes: str, }
:raise: ResponseError if status not 202. :return: None
This file was automatically generated via lazydocs.