Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tool Shed 2.0 #15639

Merged
merged 73 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
d4dec27
Cleanup method signature for uninstall_repository in twilltestcase.
jmchilton Oct 18, 2022
42b0d30
metadata_generator: initial typing for metadata_generator, no functio…
jmchilton Sep 16, 2022
338dfe9
metadata_generator: populate initial dict with helper (to split later)
jmchilton Sep 13, 2022
f000b83
metadata_generator: Spit into Base and Galaxy and ToolShed implementa…
jmchilton Sep 15, 2022
3ba9888
metadata_generator: simplify NOT_TOOL_CONFIG handling
jmchilton Sep 15, 2022
f338fc7
metadata_generator: split constructors into Galaxy and tool shed vers…
jmchilton Sep 15, 2022
cb8a7f4
metadata_generator: split initial_metadata_dict into Galaxy and TS im…
jmchilton Sep 15, 2022
ea74b1f
metadata_generator: split set_repository into Galaxy and TS implement…
jmchilton Sep 15, 2022
d22eb01
metadata_generator: Split handle_repo_elem implementations into gx an…
jmchilton Sep 15, 2022
7c357d7
metadata_generator: protocols to better type repository abstractions...
jmchilton Sep 15, 2022
32b2d38
metadata_generator: move tool shed impl into tool shed package
jmchilton Sep 15, 2022
d0622fc
Remove metadata_generator from mypy exclusions...
jmchilton Sep 15, 2022
bac9fb8
metadata_generator: more typing fixes/annotations
jmchilton Sep 16, 2022
f0af1bf
metadata_generator: only tool shed side uses sa_session.
jmchilton Oct 10, 2022
10ce487
Refactor a tool_shed-only utility into tool shed code.
jmchilton Oct 21, 2022
f1c2dde
Protocol to try to break up app for cleaner tool shed install typing.
jmchilton Sep 22, 2022
7f2bd72
Better data managers interface?
jmchilton Aug 31, 2023
dc047e8
More typing around tool validator...
jmchilton Sep 20, 2022
904a600
Additional debugging when handling API errors during repository upload.
jmchilton Nov 3, 2022
ca1e7e5
Standalone app for installing tools...
jmchilton Sep 19, 2022
179f592
Preparation for creating galaxy tool shed client package...
jmchilton Aug 17, 2023
8c01410
Make galaxy login logic in tool shed more uniform.
jmchilton Oct 18, 2022
691ba8d
Improved error message for repository_util.
jmchilton Dec 21, 2022
7cc01d3
Setup abstraction in twilltestcase to allow for separate installation…
jmchilton Oct 18, 2022
d729553
Abstraction for getting install object that can be swapped out.
jmchilton Oct 18, 2022
ebf8e2b
Standalone implementation of tool shed client...
jmchilton Oct 19, 2022
59cff45
Decompose tool shed + schema package.
jmchilton Feb 23, 2023
3c3e31e
metadata_generator: use TYPE_CHECKING to avoid dependency issues
jmchilton Oct 23, 2022
43e1574
metadata_generator: mark cleanup_repository_metadata as private
jmchilton Oct 29, 2022
fca10e4
metadata_generator: Small typing fixes for tool shed metadata_generator
jmchilton Dec 19, 2022
e611a95
Move generate_clone_url_for_repository_in_tool_shed into tool shed.
jmchilton Dec 20, 2022
8910714
Allow external shed testing.
jmchilton Jan 10, 2023
2fa1657
Use repository manager to capture more of the upload process.
jmchilton Dec 11, 2022
95b9c6c
Remove unused repository manager code (hard to de-conflict with uploa…
jmchilton Dec 13, 2022
2c5f63a
Integration-y unit tests for the core tool shed code.
jmchilton Oct 29, 2022
7ba099a
Fix API uploads to do more work that happens in web uploads.
jmchilton Dec 19, 2022
8852f07
Progress toward exercising less of the tool shed upload API.
jmchilton Nov 2, 2022
b66a0bc
More integration-y unit tests for tool shed...
jmchilton Nov 7, 2022
e7353b7
Remove upload controller - everything should come through the API now.
jmchilton Nov 6, 2022
55564b6
Remove upload_point upload logic in tool shed.
jmchilton Nov 6, 2022
122abb0
metadata_generator: no metadata for workflows and datatypes
jmchilton Dec 13, 2022
5a4e950
metadata_generator: Typing has improved to the point that we can anno…
jmchilton Dec 19, 2022
cdfdaaf
Bug fix: data manager changes misaligned...
jmchilton Dec 19, 2022
78b978e
Refactor install manager a bit to isolate interaction.
jmchilton Dec 15, 2022
9e7fafb
Remove contact owner functionality from the tool shed - use github pl…
jmchilton Dec 22, 2022
85100ed
Tool Shed API Modernization ahead of FastAPI
jmchilton Aug 17, 2023
8f89935
metadata_generator: mark private method as internal
jmchilton Dec 20, 2022
bb468a2
Less encoding in toolshed app to adapt to functions...
jmchilton Dec 27, 2022
9db5e9c
metadata_generator: refactor helper method out...
jmchilton Dec 20, 2022
68899ff
More format fixes.
jmchilton May 19, 2023
688d237
repository_metadata_manager.py - linting fix
jmchilton Mar 17, 2023
5b3c34d
Remove admin mako helper that is unused.
jmchilton Dec 20, 2022
cdf8193
Improve tool shed API client schema.
jmchilton Dec 20, 2022
f4031b7
Test setup for an allow push API (implement in v1?)
jmchilton Dec 28, 2022
4a5e355
Reusable tool ID generation helper for TS API tests.
jmchilton Dec 21, 2022
a46425c
Refactor tool shed interactions for reuse outside of test framework.
jmchilton Dec 23, 2022
698d58e
WIP: Implement dry_run in upload API.
jmchilton Nov 7, 2022
bad135b
Formatting...
jmchilton Feb 26, 2023
d1d6290
ToolShed API 2.0
jmchilton Jan 18, 2023
0772a51
black formatting fix
jmchilton Feb 2, 2023
b04c326
Refactor tool shed tests for injection of browser.
jmchilton Dec 22, 2022
24b3abe
Script for bootstrapping the tool shed.
jmchilton Dec 24, 2022
dd58bfc
Implement the GA4GH TRS API in the new tool shed.
jmchilton Dec 20, 2022
b5fb7c0
Category test stuff...
jmchilton Jan 24, 2023
c98fa8c
Category reworking..
jmchilton Jan 24, 2023
0d42ad7
bismark populator improvement...
jmchilton Jan 24, 2023
0666747
Modernized framework to replace tool shed functional tests.
jmchilton Feb 2, 2023
04e7563
Option config_hg_for_dev...
jmchilton Jan 3, 2023
e2e0d44
DEBUG lint openapi CI
jmchilton Jan 11, 2023
7dc0b13
WIP: modern tool shed frontend
jmchilton Sep 26, 2023
990f3dc
More typing?
jmchilton Aug 31, 2023
bb45581
Remove incorrect auto-generated readme for frontend.
jmchilton Sep 26, 2023
ec6d8fd
Fixes...
jmchilton Sep 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .ci/flake8_ignorelist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ database
doc/build
eggs
lib/galaxy/web/proxy/js/node_modules
lib/tool_shed/test/test_data/repos
static/maps
static/scripts
test/functional/tools/cwl_tools/v1.?/
Expand Down
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
# W503 is line breaks before binary operators, which has been reversed in PEP 8.
# D** are docstring linting - which we mostly ignore except D302. (Hopefully we will solve more over time).
ignore = B008,E203,E402,E501,W503,D100,D101,D102,D103,D104,D105,D106,D107,D200,D201,D202,D204,D205,D206,D207,D208,D209,D210,D211,D300,D301,D400,D401,D402,D403,D412,D413
exclude = lib/tool_shed/test/test_data/repos
3 changes: 3 additions & 0 deletions .github/workflows/lint_openapi_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ jobs:
- name: Build typescript schema
run: make update-client-api-schema
working-directory: 'galaxy root'
- name: Diff...
run: git diff
working-directory: 'galaxy root'
- name: Check for changes
run: |
if [[ `git status --porcelain` ]]; then
Expand Down
34 changes: 32 additions & 2 deletions .github/workflows/toolshed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,23 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7']
include:
- test-install-client: 'galaxy_api'
python-version: '3.7'
shed-api: 'v1'
shed-browser: 'twill'
- test-install-client: 'standalone'
python-version: '3.8'
shed-api: 'v1'
shed-browser: 'twill'
- test-install-client: 'galaxy_api'
python-version: '3.9'
shed-api: 'v2'
shed-browser: 'playwright'
- test-install-client: 'standalone'
python-version: '3.10'
shed-api: 'v2'
shed-browser: 'playwright'
services:
postgres:
image: postgres:13
Expand Down Expand Up @@ -52,11 +68,25 @@ jobs:
with:
path: 'galaxy root/.venv'
key: gxy-venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('galaxy root/requirements.txt') }}-toolshed
key: gxy-venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('galaxy_root/requirements.txt') }}-toolshed
- name: Install dependencies
run: ./scripts/common_startup.sh --skip-client-build
working-directory: 'galaxy root'
- name: Build Frontend
run: '. .venv/bin/activate && cd lib/tool_shed/webapp/frontend && yarn && make client'
working-directory: 'galaxy root'
- name: Install playwright
run: '. .venv/bin/activate && playwright install'
working-directory: 'galaxy root'
- name: Run tests
run: './run_tests.sh -toolshed'
env:
TOOL_SHED_TEST_INSTALL_CLIENT: ${{ matrix.test-install-client }}
TOOL_SHED_API_VERSION: ${{ matrix.shed-api }}
TOOL_SHED_TEST_BROWSER: ${{ matrix.shed-browser }}
working-directory: 'galaxy root'
- uses: actions/upload-artifact@v3
if: failure()
with:
name: Toolshed test results (${{ matrix.python-version }})
name: Toolshed test results (${{ matrix.python-version }}, ${{ matrix.test-install-client }})
path: 'galaxy root/run_toolshed_tests.html'
2 changes: 1 addition & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ profile=black
reverse_relative=true
skip_gitignore=true
# Make isort run faster by skipping database
skip_glob=database/*
skip_glob=database/*,lib/tool_shed/test/test_data/repos/*
src_paths=lib
3 changes: 3 additions & 0 deletions .redocly.lint-ignore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ _schema.yaml:
#/paths/~1api~1histories~1{history_id}~1contents~1{history_content_id}~1metadata_file
- '#/paths/~1api~1histories~1{history_id}~1contents~1{id}~1validate'
- '#/paths/~1api~1histories~1{history_id}~1contents~1{type}s~1{id}'
_shed_schema.yaml:
no-empty-servers:
- '#/openapi'
41 changes: 41 additions & 0 deletions .vscode/shed.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"shedcomp": {
"prefix": "shed_component",
"body": [
"<script setup lang=\"ts\">",
"\t$0",
"</script>",
"<template>",
"</template>"
],
"description": "outline of a tool shed component"
},
"shedpage": {
"prefix": "shed_page",
"body": [
"<script setup lang=\"ts\">",
"import PageContainer from \"@/components/PageContainer.vue\"",
"</script>",
"<template>",
" <page-container>",
" $0",
" </page-container>",
"</template>"
],
"description": "outline of a tool shed page"
},
"shedfetcher": {
"prefix": "shed_fetcher",
"body": [
"import { fetcher } from \"@/schema\"",
"const fetcher = fetcher.path(\"$1\").method(\"get\").create()"
],
"description": "Import shed fetcher and instantiate with a path"
},
"shedrouter": {
"prefix": "shed_router",
"body": [
"import router from \"@/router\""
]
}
}
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,22 @@ endif

build-api-schema:
$(IN_VENV) python scripts/dump_openapi_schema.py _schema.yaml
$(IN_VENV) python scripts/dump_openapi_schema.py --app shed _shed_schema.yaml

remove-api-schema:
rm _schema.yaml
rm _shed_schema.yaml

update-client-api-schema: client-node-deps build-api-schema
$(IN_VENV) cd client && node openapi_to_schema.mjs ../_schema.yaml > src/schema/schema.ts && npx prettier --write src/schema/schema.ts
$(IN_VENV) cd client && node openapi_to_schema.mjs ../_shed_schema.yaml > ../lib/tool_shed/webapp/frontend/src/schema/schema.ts && npx prettier --write ../lib/tool_shed/webapp/frontend/src/schema/schema.ts
$(MAKE) remove-api-schema

lint-api-schema: build-api-schema
$(IN_VENV) npx --yes @redocly/cli lint _schema.yaml
$(IN_VENV) npx --yes @redocly/cli lint _shed_schema.yaml
$(IN_VENV) codespell -I .ci/ignore-spelling.txt _schema.yaml
$(IN_VENV) codespell -I .ci/ignore-spelling.txt _shed_schema.yaml
$(MAKE) remove-api-schema

update-navigation-schema: client-node-deps
Expand Down
27 changes: 16 additions & 11 deletions lib/galaxy/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@
install_model_scoped_session,
)
from galaxy.model.tags import GalaxyTagHandler
from galaxy.model.tool_shed_install import mapping as install_mapping
from galaxy.model.tool_shed_install import (
HasToolBox,
mapping as install_mapping,
)
from galaxy.objectstore import (
BaseObjectStore,
build_object_store_from_config,
Expand All @@ -105,8 +108,10 @@
VaultFactory,
)
from galaxy.tool_shed.cache import ToolShedRepositoryCache
from galaxy.tool_shed.galaxy_install.client import InstallationTarget
from galaxy.tool_shed.galaxy_install.installed_repository_manager import InstalledRepositoryManager
from galaxy.tool_shed.galaxy_install.update_repository_manager import UpdateRepositoryManager
from galaxy.tool_util.data import ToolDataTableManager as BaseToolDataTableManager
from galaxy.tool_util.deps import containers
from galaxy.tool_util.deps.dependencies import AppInfo
from galaxy.tool_util.deps.views import DependencyResolversView
Expand Down Expand Up @@ -214,14 +219,13 @@ def configure_sentry_client(self):
)


class MinimalGalaxyApplication(BasicSharedApp, HaltableContainer, SentryClientMixin):
class MinimalGalaxyApplication(BasicSharedApp, HaltableContainer, SentryClientMixin, HasToolBox):
"""Encapsulates the state of a minimal Galaxy application"""

model: GalaxyModelMapping
config: config.GalaxyAppConfiguration
tool_cache: ToolCache
job_config: jobs.JobConfiguration
toolbox: tools.ToolBox
toolbox_search: ToolBoxSearch
container_finder: containers.ContainerFinder
install_model: ModelMapping
Expand Down Expand Up @@ -297,15 +301,12 @@ def _configure_tool_config_files(self):
self.config.tool_configs.append(self.config.migrated_tools_config)

def _configure_toolbox(self):
if not isinstance(self, BasicSharedApp):
raise Exception("Must inherit from BasicSharedApp")

self.citations_manager = CitationsManager(self)
self.biotools_metadata_source = get_galaxy_biotools_metadata_source(self.config)

self.dynamic_tools_manager = DynamicToolManager(self)
self._toolbox_lock = threading.RLock()
self.toolbox = tools.ToolBox(self.config.tool_configs, self.config.tool_path, self)
self._toolbox = tools.ToolBox(self.config.tool_configs, self.config.tool_path, self)
galaxy_root_dir = os.path.abspath(self.config.root)
file_path = os.path.abspath(self.config.file_path)
app_info = AppInfo(
Expand Down Expand Up @@ -345,6 +346,10 @@ def _configure_toolbox(self):
ToolBoxSearch(self.toolbox, index_dir=self.config.tool_search_index_dir, index_help=index_help),
)

@property
def toolbox(self) -> tools.ToolBox:
return self._toolbox

def reindex_tool_search(self) -> None:
# Call this when tools are added or removed.
self.toolbox_search.build_index(tool_cache=self.tool_cache, toolbox=self.toolbox)
Expand All @@ -366,7 +371,7 @@ def _set_enabled_container_types(self):

def _configure_tool_data_tables(self, from_shed_config):
# Initialize tool data tables using the config defined by self.config.tool_data_table_config_path.
self.tool_data_tables = ToolDataTableManager(
self.tool_data_tables: BaseToolDataTableManager = ToolDataTableManager(
tool_data_path=self.config.tool_data_path,
config_filename=self.config.tool_data_table_config_path,
other_config_dict=self.config,
Expand Down Expand Up @@ -488,7 +493,7 @@ def _wait_for_database(self, url):
time.sleep(pause)

@property
def tool_dependency_dir(self):
def tool_dependency_dir(self) -> Optional[str]:
return self.toolbox.dependency_manager.default_base_path

def _shutdown_object_store(self):
Expand All @@ -498,7 +503,7 @@ def _shutdown_model(self):
self.model.engine.dispose()


class GalaxyManagerApplication(MinimalManagerApp, MinimalGalaxyApplication):
class GalaxyManagerApplication(MinimalManagerApp, MinimalGalaxyApplication, InstallationTarget[tools.ToolBox]):
"""Extends the MinimalGalaxyApplication with most managers that are not tied to a web or job handling context."""

model: GalaxyModelMapping
Expand Down Expand Up @@ -685,7 +690,7 @@ def __init__(self, **kwargs) -> None:
self.watchers = self._register_singleton(ConfigWatchers)
self._configure_toolbox()
# Load Data Manager
self.data_managers = self._register_singleton(DataManagers)
self.data_managers = self._register_singleton(DataManagers) # type: ignore[type-abstract]
# Load the update repository manager.
self.update_repository_manager = self._register_singleton(
UpdateRepositoryManager, UpdateRepositoryManager(self)
Expand Down
7 changes: 6 additions & 1 deletion lib/galaxy/app_unittest_utils/galaxy_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class MockApp(di.Container, GalaxyDataTestApp):
config: "MockAppConfig"
amqp_type: str
job_search: Optional[JobSearch] = None
toolbox: ToolBox
_toolbox: ToolBox
tool_cache: ToolCache
install_model: ModelMapping
watchers: ConfigWatchers
Expand All @@ -110,6 +110,7 @@ def __init__(self, config=None, **kwargs) -> None:
super().__init__()
config = config or MockAppConfig(**kwargs)
GalaxyDataTestApp.__init__(self, config=config, **kwargs)
self.install_model = self.model
self[BasicSharedApp] = cast(BasicSharedApp, self)
self[MinimalManagerApp] = cast(MinimalManagerApp, self) # type: ignore[type-abstract]
self[StructuredApp] = cast(StructuredApp, self) # type: ignore[type-abstract]
Expand Down Expand Up @@ -153,6 +154,10 @@ def url_for(*args, **kwds):

self.url_for = url_for

@property
def toolbox(self) -> ToolBox:
return self._toolbox

def wait_for_toolbox_reload(self, toolbox):
# TODO: If the tpm test case passes, does the operation really
# need to wait.
Expand Down
Loading
Loading