Commit Graph
71 Commits
Author SHA1 Message Date
John Chilton 90c0f61747 Remove unused code in tool version manager. 2023-02-03 13:47:38 -05:00
John Chilton 525eec2cb6 tool_util: Rework copy_sample_file with typing and less app dependence. 2022-09-21 11:22:26 -04:00
Nicola Soranzo d11bbf219d Update mypy to 0.942 . Fix new mypy errors.
Remove unused `optional()` decorator function that had an annotation issue.
2022-03-31 18:47:52 +01:00
John Chilton 4dae7c6f21 Disable implicit re-imports across the projects.
Exclude galaxy.util for now, but the exclusion is tracked in setup.cfg. Elimiantes a bunch of flake exception markers.
2022-03-15 19:58:42 -04:00
Dannon Baker 623a5e165a Apply black formatting.
Apply isort.
2022-02-03 07:42:20 -05:00
Bjoern Gruening 47ba60025f add more fixes to ./lib/tool_shed 2021-01-02 18:48:30 +00:00
Nicola Soranzo 9d74bba7fb Drop support for retired Python 3.5
Upgrade syntax using `pyupgrade --py36-plus` .

Manually drop several `six` imports.

Also:
- Remove broken pr_cache in scripts/bootstrap_history.py
- Fix broken prefix removal in lib/galaxy/tool_util/deps/mulled/mulled_build.py
2020-10-07 11:52:13 +01:00
Nicola Soranzo f5ef7f26f7 Merge branch 'release_20.05' into dev 2020-09-04 11:44:17 +01:00
mvdbeek cda113cd13 Fix ToolValidator get_list_of_copied_sample_files
After updating the MTS to python 3 we saw this:
```
AttributeError: 'NoneType' object has no attribute 'data'
  File "galaxy/web/framework/middleware/sentry.py", line 43, in __call__
    iterable = self.application(environ, start_response)
  File "/srv/toolshed/main/venv/lib/python3.8/site-packages/paste/translogger.py", line 69, in __call__
    return self.application(environ, replacement_start_response)
  File "/srv/toolshed/main/venv/lib/python3.8/site-packages/paste/recursive.py", line 85, in __call__
    return self.application(environ, start_response)
  File "routes/middleware.py", line 141, in __call__
    response = self.app(environ, start_response)
  File "/srv/toolshed/main/venv/lib/python3.8/site-packages/paste/httpexceptions.py", line 640, in __call__
    return self.application(environ, start_response)
  File "galaxy/web/framework/base.py", line 145, in __call__
    return self.handle_request(environ, start_response)
  File "galaxy/web/framework/base.py", line 224, in handle_request
    body = method(trans, **kwargs)
  File "tool_shed/webapp/controllers/repository.py", line 880, in display_tool
    repository, tool, valid, message = tv.load_tool_from_changeset_revision(repository_id,
  File "tool_shed/tools/tool_validator.py", line 216, in load_tool_from_changeset_revision
    self.handle_sample_files_and_load_tool_from_tmp_config(repo,
  File "tool_shed/tools/tool_validator.py", line 164, in handle_sample_files_and_load_tool_from_tmp_config
    sample_files, deleted_sample_files = self.get_list_of_copied_sample_files(repo, changeset_revision, dir=work_dir)
  File "tool_shed/tools/tool_validator.py", line 136, in get_list_of_copied_sample_files
    fh.write(fctx.data())
```
in https://sentry.galaxyproject.org/sentry/toolshed/issues/903796/.
This should fix that.

`ctx_file` was a bytestring, so in `get_file_context_from_ctx` we'd
never find the sample file we're looking for, because
`if filename == ctx_file_name:` would fail since `filename` is a
bytestring and ctx_file_name a unicode string.
2020-09-03 13:07:06 +02:00
Dannon Baker e2461e5c5b Remainder of py3-only feature updates. 2020-06-26 08:26:00 -04:00
Dannon Baker 9ebf5f36d1 Update string formatting in rest of lib 2020-06-26 08:24:02 -04:00
mvdbeek 86f8328490 More Python 3 fixes for TS 2020-04-12 01:34:37 +01:00
mvdbeek fe86cb9181 Don't need to pass app into Repository.tip 2020-04-01 16:48:29 +02:00
Marius van den BeekandNicola Soranzo 814b000e38 Fix hg_repo access
Co-Authored-By: Nicola Soranzo <nicola.soranzo@gmail.com>
2020-04-01 13:21:25 +02:00
mvdbeek 3fd4b71390 Avoid repeated calls to get_repo_for_repository
by creating the `hg_repo` property on the `Repository` object.  This is
only used in the toolshed, meaning we can move get_repo_for_repository
to lib/tool_shed/util/hg_util.py.

`get_repo_for_repository` takes up considerable time when hitting the
`/api/repositories/updates` route in the tool shed.  This is hit at
least whice per call
(https://gist.github.com/mvdbeek/6a58b5f4fe9489dd9a15109da74a0c86#file-gistfile1-txt-L7),
so making this a cached property should result in a nice speedup.
2020-04-01 11:16:51 +02:00
Nicola Soranzo 2fcbe0afa3 changectx() method was dropped in mercurial 4.6
in favour of `__getitem__()`.
2019-12-05 18:31:26 +00:00
John Chilton 48dbfc8b28 Break up tool validator into Galaxy/TS variants. 2019-11-10 22:39:30 -05:00
John Chilton 6b651ae257 Migrate data_table_manager to Galaxy. 2019-11-10 22:39:30 -05:00
John Chilton 939e7774a8 Create galaxy-tool-util package.
This is (so far a subset of) the tool utilities from galaxy-lib. galaxy-lib mocked out a fake galaxy.tools to allow these to all exist below the galaxy.tools - but this was a terrible hack - in order for the new packages to be true subsets of Galaxy they need to be refactored into a new package that doesn't depend on models, SA, galaxy.jobs, etc...

[x] galaxy.tools.deps -> galaxy.tool_util.deps
[x] galaxy.tools.loader -> galaxy.tool_util.loader
[x] galaxy.tools.cwl -> galaxy.tool_util.cwl
[x] galaxy.tools.loader -> galaxy.tool_util.loader
[x] galaxy.tools.fetcher -> galaxy.tool_util.fetcher
[x] galaxy.tools.locations -> galaxy.tool_util.locations
[x] galaxy.tools.parser -> galaxy.tool_util.parser
2019-05-16 16:45:25 -04:00
Nate Coraor 037202c301 Log exceptions instead of raising. 2019-02-08 10:48:24 -05:00
Nate Coraor 4627546831 Fix silent failure when installing tools. 2019-02-06 17:25:29 -05:00
Nicola Soranzo 141c2a1ef3 Fix indentation
Broken in commit cf2645f9a6 .
2019-01-10 16:16:58 +00:00
mvdbeek cf2645f9a6 Fix toolshed error in display_tool if tool is invalid
Fixes the following exception:

```
AttributeError: 'NoneType' object has no attribute 'id'
  File "galaxy/web/framework/middleware/sentry.py", line 43, in __call__
    iterable = self.application(environ, start_response)
  File "/srv/toolshed/main/venv/local/lib/python2.7/site-packages/paste/translogger.py", line 69, in __call__
    return self.application(environ, replacement_start_response)
  File "/srv/toolshed/main/venv/local/lib/python2.7/site-packages/paste/recursive.py", line 85, in __call__
    return self.application(environ, start_response)
  File "routes/middleware.py", line 141, in __call__
    response = self.app(environ, start_response)
  File "/srv/toolshed/main/venv/local/lib/python2.7/site-packages/paste/httpexceptions.py", line 640, in __call__
    return self.application(environ, start_response)
  File "galaxy/web/framework/base.py", line 143, in __call__
    return self.handle_request(environ, start_response)
  File "galaxy/web/framework/base.py", line 222, in handle_request
    body = method(trans, **kwargs)
  File "galaxy/webapps/tool_shed/controllers/repository.py", line 888, in display_tool
    tool_state = tool_util.new_state(trans, tool, invalid=False)
  File "tool_shed/util/tool_util.py", line 211, in new_state
    log.debug('Failed to build tool state for tool "%s" using standard method, will try to fall back on custom method: %s', tool.id, e)
```

(from https://sentry.galaxyproject.org/sentry/toolshed/issues/279820/).

Might also fix some other issues when redering workflow svg for
workflows with invalid tools.
2018-10-29 10:34:37 +01:00
Nicola Soranzo db4c5a97ed Fix reversed_upper_bounded_changelog() calls
`hg_util.reversed_upper_bounded_changelog()` expects a changeset revision
string as second parameter, not a `changectx` object.
2018-06-08 16:08:19 +01:00
Nicola Soranzo 17d7c0fb1f Consolidate use of get_repo_for_repository() 2018-06-05 12:08:29 +01:00
mvdbeek cd9db0bffa Provide ToolDataTableManager for backwards compatibility
Broken in 7df9dce63d
2018-04-19 15:22:06 +02:00
Martin Cech ba3b3d5c18 do not allow codefiles for TS tool loading 2018-02-12 14:06:50 -05:00
mvdbeek e65a2490c1 Linting fixes 2017-12-03 12:02:10 +01:00
mvdbeek fd4737d0ec Don't reload tools, new indexes and data tables are recognized without a reload 2017-12-03 09:49:56 +01:00
mvdbeek db88175b9f Use ValidationContext data tables instead of separately passing in relevant data tables 2017-12-03 09:47:07 +01:00
mvdbeek 482c9cce76 Remove more unused variables 2017-12-02 21:58:33 +01:00
mvdbeek d3261096c8 Fix linting issues and fix data manager installation 2017-12-02 14:10:38 +01:00
mvdbeek ab21f303af Always use MiniApp when using ToolValidator 2017-12-02 11:06:56 +01:00
mvdbeek c0887d72f8 Fix missing index file check 2017-12-01 18:45:42 +01:00
mvdbeek b03f16ed49 Load tools directly from source and avoid loading via toolbox 2017-12-01 14:58:04 +01:00
mvdbeek 7df9dce63d Rename the ToolDataTableManager that deals with repository data to ShedToolDataTableManager to avoid confusion 2017-12-01 14:58:04 +01:00
mvdbeek fe6033fb22 Avoid global changes to app.config.tool_data_path 2017-12-01 14:58:04 +01:00
mvdbeek 561f71ec50 Avoid manipulating global toll data tables 2017-12-01 14:58:04 +01:00
Nicola Soranzo 2cd95c48f6 Fix import order everywhere
- Add flake8-import-order to flake8 Pipfile and remove py27-lint-imports
  and py27-lint-imports-include-list tox envs
- Fix most E201 and E202 errors reported by flake8-import-order v0.15,
  but pin flake8-import-order to v0.14.3 until
  https://github.com/PyCQA/flake8-import-order/issues/123
  is fixed

This let us drop 2 jobs on Travis per each job.
2017-11-14 19:42:39 +00:00
mvdbeek 538d63a8c6 Remove unused galaxy-side set_tool_version code
This is all unnecessary or handled by the tool lineage.
2017-11-12 15:38:04 +01:00
Nicola Soranzo 9b4de72ca6 Fix all E722 errors and ignore E741
Introduced in flake8 3.5.0
Fix import order.
2017-10-24 11:29:09 +01:00
mvdbeek d06fb09f4b Make DynamicOptions use updated tool_data_tables
Otherwise a restart would be necessary after adding items to a data
table.
2017-09-15 13:19:06 +02:00
Nicola Soranzo a353b2e88f Fix E127 errors introduced by previous commit
using:
```
autopep8 -i -r --exclude $(sed -e 's|^|./|' -e 's|/$||' .ci/flake8_blacklist.txt | paste -sd,) --select E127 .
```
2017-08-17 11:35:39 +01:00
Nicola Soranzo 21b44bf348 Fix all E201 and E202 style errors
using the following command:
```
autopep8 -i -r --exclude $(sed -e 's|^|./|' -e 's|/$||' .ci/flake8_blacklist.txt | paste -sd,) --select E201,E202 .
```
2017-08-17 11:35:39 +01:00
mvdbeek c2897c211b Replace ShedToolLineage with enhanced StockLineage
This means we don't rely on the Tool Shed metadata anymore and instead
deduce the tool lineage via the tool_id, which contains the version.
Version comparison then happens via LooseVersions.
This works for toolshed and non-toolshed tools, restoring proper
grouping in the tool panel and version switches, even for tool shed
tools whose lineage is broken.
2017-06-20 20:57:23 +02:00
Nicola Soranzo 9c37c6df89 Fixes for flake8-import-order 0.11
Also fix Python3 compatibility.
2016-11-11 15:09:34 +00:00
Marius van den Beek 09173cc607 Rebase and linting fixes 2016-09-08 17:33:25 +02:00
Marius van den Beek 894ac29520 Reload tool_version_cache when adding new tool
version relationships to the database.
2016-09-08 17:16:44 +02:00
Nicola Soranzo de3c50a5ef Python3 support and import order fixes for lib/tool_shed/ 2016-08-04 13:41:36 +01:00
Dave Bouvier ac2fb6d745 Merge remote-tracking branch 'upstream/dev' into refactor_suc 2016-05-17 09:24:41 -04:00