tool_shed.managers package

Submodules

tool_shed.managers.groups module

Manager and Serializer for TS groups.

class tool_shed.managers.groups.GroupManager(*args, **kwargs)[source]

Bases: object

Interface/service object for interacting with TS groups.

__init__(*args, **kwargs)[source]
get(trans, decoded_group_id=None, name=None)[source]

Get the group from the DB based on its ID or name.

Parameters:

decoded_group_id (int) – decoded group id

Returns:

the requested group

Return type:

tool_shed.model.Group

create(trans, name, description='')[source]

Create a new group.

update(trans, group, name=None, description=None)[source]

Update the given group

delete(trans, group, undelete=False)[source]

Mark given group deleted/undeleted based on the flag.

list(trans, deleted=False)[source]

Return a list of groups from the DB.

Returns:

query that will emit all groups

Return type:

sqlalchemy query

tool_shed.managers.groups.get_group_by_name(session, name, group_model)[source]

tool_shed.managers.repositories module

Manager and Serializer for TS repositories.

tool_shed.managers.repositories.search(trans: ProvidesUserContext, q: str, page: int = 1, page_size: int = 10)[source]

Perform the search over TS repositories. Note that search works over the Whoosh index which you have to pre-create with scripts/tool_shed/build_ts_whoosh_index.sh manually. Also TS config option toolshed_search_on has to be True and whoosh_index_dir has to be specified.

class tool_shed.managers.repositories.UpdatesRequest(*, name: str | None = None, owner: str | None = None, changeset_revision: str, hexlify: bool = True)[source]

Bases: BaseModel

name: str | None
owner: str | None
changeset_revision: str
hexlify: bool
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

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

model_fields: ClassVar[dict[str, FieldInfo]] = {'changeset_revision': FieldInfo(annotation=str, required=True), 'hexlify': FieldInfo(annotation=bool, required=False, default=True), 'name': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'owner': FieldInfo(annotation=Union[str, NoneType], required=False, default=None)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

tool_shed.managers.repositories.check_updates(app: ToolShedApp, request: UpdatesRequest) str | Dict[str, Any][source]
tool_shed.managers.repositories.guid_to_repository(app: ToolShedApp, tool_id: str) Repository[source]
tool_shed.managers.repositories.index_tool_ids(app: ToolShedApp, tool_ids: List[str]) Dict[str, Any][source]
tool_shed.managers.repositories.index_repositories(app: ToolShedApp, name: str | None, owner: str | None, deleted: bool)[source]
tool_shed.managers.repositories.can_manage_repo(trans: ProvidesUserContext, repository: Repository) bool[source]
tool_shed.managers.repositories.can_update_repo(trans: ProvidesUserContext, repository: Repository) bool[source]
tool_shed.managers.repositories.get_repository_metadata_for_management(trans: ProvidesUserContext, encoded_repository_id: str, changeset_revision: str) RepositoryMetadata[source]
tool_shed.managers.repositories.get_install_info(trans: ProvidesRepositoriesContext, name, owner, changeset_revision) Tuple[Dict | None, RepositoryMetadataInstallInfoDict | EmptyDict, Dict[str, List] | EmptyDict][source]
tool_shed.managers.repositories.get_value_mapper(app: ToolShedApp) Dict[str, Callable][source]
tool_shed.managers.repositories.get_ordered_installable_revisions(app: ToolShedApp, name: str | None, owner: str | None, tsr_id: str | None) List[str][source]
tool_shed.managers.repositories.get_repository_metadata_dict(app: ToolShedApp, id: str, recursive: bool, downloadable_only: bool) Dict[str, Any][source]
tool_shed.managers.repositories.readmes(app: ToolShedApp, repository: Repository, changeset_revision: str) dict[source]
tool_shed.managers.repositories.reset_metadata_on_repository(trans: ProvidesUserContext, repository_id) ResetMetadataOnRepositoryResponse[source]
tool_shed.managers.repositories.create_repository(trans: ProvidesUserContext, request: CreateRepositoryRequest) Repository[source]
tool_shed.managers.repositories.to_element_dict(app, repository: Repository, include_categories: bool = False) Dict[str, Any][source]
tool_shed.managers.repositories.repositories_by_category(app: ToolShedApp, category_id: str, page: int | None = None, sort_key: str = 'name', sort_order: str = 'asc', installable: bool = True)[source]
tool_shed.managers.repositories.to_model(app, repository: Repository) Repository[source]
tool_shed.managers.repositories.to_detailed_model(app, repository: Repository) DetailedRepository[source]
tool_shed.managers.repositories.upload_tar_and_set_metadata(trans: ProvidesRepositoriesContext, host: str, repository: Repository, uploaded_file, commit_message: str, dry_run: bool = False)[source]