Commit Graph
49 Commits
Author SHA1 Message Date
Nicola Soranzo dda6feb391 Remove redundant license info from package READMEs
The license is already specified in `setup.cfg` , which is the
canonical place.
This will simplify the transition to the MIT license.
2022-09-09 17:20:24 +01:00
Michael R. Crusoe 59ac92c1c8 mark galaxy packages as containing typing information 2022-07-26 23:27:36 +01:00
Nicola Soranzo 231fda2d22 Modernise build of galaxy-webapps package
Also:
- Add missing files to `MANIFEST.in`
2022-06-10 01:41:51 +01:00
Nicola Soranzo 73bf57e9a0 Remove unused and unnecessary code
- `PROJECT_OWNER`, `PROJECT_USERAME`, `RAW_CONTENT_URL` and `_version_re` are unused.
- `:changelog:` hyperlink target is unnecessary.
- `test_suite` and `tests_require` are deprecated since setuptools v41.5.0
2022-06-09 22:55:07 +01:00
Nicola Soranzo e9b2262dd3 Move mypy configuration to `mypy.ini`
So packages can use `setup.cfg` to replace `setup.py` .
2022-06-08 10:35:18 +01:00
Nicola Soranzo aeef3318a2 Use setuptools custom package discovery instead of explicit listing 2022-06-06 23:48:37 +01:00
Nicola Soranzo 27b2ee0e9e Merge branch 'release_22.01' into dev 2022-06-06 19:18:55 +01:00
Nicola Soranzo 6a00e75410 Merge branch 'release_21.09' into release_22.01 2022-06-06 11:25:14 +01:00
Nuwan Goonasekera dd0702e89b Add root webapp to webapp package 2022-06-05 02:41:58 +05:30
Nicola Soranzo 97e7dceb73 Fix packages' requirements 2022-05-30 22:40:28 +01:00
Nicola Soranzo f2a42ba67e Run mypy on all packages' files
Also:
- mypy fixes.
- Use `with` statement to open/close files.
2022-05-30 22:38:55 +01:00
Nicola Soranzo 47d35a8cc5 Add missing pytest-asyncio test requirement to `webapps` package
Otherwise all unit tests in `test_request_scoped_sqlalchemy_sessions.py`
are skipped.
2022-05-12 16:38:14 +01:00
mvdbeek 102a7eab63 Add apispec dependency 2022-03-20 14:26:28 +01:00
mvdbeek 9690680ec7 Update version to 22.01. 2022-03-15 20:46:24 +01:00
Nicola Soranzo 0c80836c34 Upgrade syntax to Python 3.7
using `ack --type=python -f | grep -v '^tools/' | xargs pyupgrade --py37-plus`

Also more refactoring of Python files in `packages/` .
2022-03-14 14:57:43 +00:00
Nicola Soranzo c0db14e195 Test the webapps package
Also:
- Remove redundant `galaxy.schema` module from the `app` package (it's
  already in `data`)
- Fix requirements of the `app` and `webapps` packages
- Add missing `PyJWT` and `python-dateutil` to `tool.poetry.dependencies`
  (which were already included in the pinned requirements as deps of deps)
2022-03-03 16:48:36 +01:00
Nicola Soranzo f8bd5d4bea Merge branch 'release_22.01' into dev 2022-02-21 17:00:55 +00:00
Nicola Soranzo 22bcef6342 Test the webapps package
Also:
- Remove redundant `galaxy.schema` module from the `app` package (it's
  already in `data`)
- Fix requirements of the `app` and `webapps` packages
- Add missing `PyJWT` and `python-dateutil` to `tool.poetry.dependencies`
  (which were already included in the pinned requirements as deps of deps)
2022-02-17 19:50:40 +00:00
mvdbeek 61dab21990 Use a2wsgi to serve WSGI app
instead of the deprecated starlette WSGIMiddleware that was vendored by
fastAPI. I'm also hoping this fixes the weird exceptions a la:
```
uvicorn.error ERROR 2022-02-14 11:59:42,141 [pN:main,p:4823,tN:Thread-216] Exception in ASGI application
Traceback (most recent call last):
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/uvicorn/protocols/http/h11_impl.py", line 364, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/fastapi/applications.py", line 212, in __call__
    await super().__call__(scope, receive, send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/routing.py", line 408, in handle
    await self.app(scope, receive, send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/fastapi/applications.py", line 212, in __call__
    await super().__call__(scope, receive, send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette_context/middleware/raw_middleware.py", line 96, in __call__
    await self.app(scope, receive, send_wrapper)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/middleware/base.py", line 65, in __call__
    task_group.cancel_scope.cancel()
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 574, in __aexit__
    raise exceptions[0]
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 611, in _run_wrapped_task
    await coro
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/middleware/base.py", line 34, in coro
    await self.app(scope, request.receive, send_stream.send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/routing.py", line 408, in handle
    await self.app(scope, receive, send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/middleware/wsgi.py", line 64, in __call__
    await responder(receive, send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/middleware/wsgi.py", line 91, in __call__
    await anyio.to_thread.run_sync(self.wsgi, environ, self.start_response)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 572, in __aexit__
    raise ExceptionGroup(exceptions)
anyio._backends._asyncio.ExceptionGroup: 2 exceptions were raised in the task group:
----------------------------
Traceback (most recent call last):
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 611, in _run_wrapped_task
    await coro
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/middleware/wsgi.py", line 98, in sender
    await send(message)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/exceptions.py", line 68, in sender
    await send(message)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/streams/memory.py", line 193, in send
    self.send_nowait(item)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/streams/memory.py", line 177, in send_nowait
    raise BrokenResourceError
anyio.BrokenResourceError
----------------------------
Traceback (most recent call last):
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/middleware/wsgi.py", line 91, in __call__
    await anyio.to_thread.run_sync(self.wsgi, environ, self.start_response)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/to_thread.py", line 29, in run_sync
    limiter=limiter)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 818, in run_sync_in_worker_thread
    return await future
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 754, in run
    result = context.run(func, *args)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/middleware/wsgi.py", line 132, in wsgi
    self.stream_send.send, {"type": "http.response.body", "body": b""}
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/from_thread.py", line 35, in run
    return asynclib.run_async_from_thread(func, *args)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 847, in run_async_from_thread
    return f.result()
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/concurrent/futures/_base.py", line 435, in result
    return self.__get_result()
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/streams/memory.py", line 193, in send
    self.send_nowait(item)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/streams/memory.py", line 177, in send_nowait
    raise BrokenResourceError
anyio.BrokenResourceError
```
2022-02-17 09:36:26 +01:00
Nicola Soranzo 6057338cbd Format files in packages/ with black
with:

```
find packages/ -name '*.py' | xargs black
```

The `packages/` directory is currently excluded in the `[tool.black]`
section of `pyproject.toml` because black follows symlinks.
2022-02-03 14:07:52 +00:00
Dannon Baker 623a5e165a Apply black formatting.
Apply isort.
2022-02-03 07:42:20 -05:00
mvdbeek 0af72e56b2 Update version to 22.05.dev0 2022-02-01 11:10:56 +01:00
mvdbeek 917dbe718c Update version to 22.01.rc1 2022-02-01 11:07:22 +01:00
mvdbeek d3cfb72266 Use importlib_resources 2022-01-19 18:20:16 +00:00
Marius van den BeekandNicola Soranzo 7013f1364b Add whoish to webapps requirements
Co-authored-by: Nicola Soranzo <nicola.soranzo@gmail.com>
2022-01-10 20:08:24 +01:00
mvdbeek e0f24c1591 Add more required dependencies for installed Galaxy 2022-01-10 18:47:39 +01:00
Nicola Soranzo b9efe433e6 Fix pydantic requirements 2022-01-06 19:21:17 +00:00
Nicola Soranzo 8fbecfefff Disallow also fastapi 0.70.1 2022-01-06 19:21:15 +00:00
Nicola Soranzo 0bdc93a7cc Drop support for Python 3.6, add Python 3.10 2021-12-08 08:14:10 +00:00
Nicola Soranzo a65d8fade9 Add missing typing-extensions requirement
to `pyproject.toml` and packages' `requirements.txt` .

We have been importing it explicitly since commit
fc2ce45767 (December 2020).

Also:
- Remove now unnecessary minimum version for pygithub
2021-11-24 01:09:49 +00:00
Michael R. Crusoe 7819fdc7a6 tighten type ignores 2021-11-23 13:12:07 +01:00
Nicola Soranzo 82a45e1544 Sync package deps with pyproject.toml
Fix resulting mypy issues.
2021-11-11 14:46:51 +01:00
mvdbeek 6b29202be6 Update version to 21.09. 2021-11-02 12:08:02 +01:00
mvdbeek 5332eb246a Update version to 22.01.dev0 2021-09-20 19:53:11 +02:00
mvdbeek 9275b34819 Update version to 21.09.rc1 2021-09-20 19:53:09 +02:00
mvdbeek 07fb59937e Update version to 21.09.dev0 2021-05-05 21:48:01 +02:00
Nate Coraor d8aa5a3804 Add fastapi-utils to galaxy-webapps package requirements. 2021-04-02 16:01:34 -04:00
Nate Coraor c6cde5f5fa Relocate display application configs and include display application
configs in galaxy-webapps package.
2021-04-02 15:42:36 -04:00
John Chilton 11c1715fc3 Holistic approach to dependency injection.
Dependency injection is cool - it should however not be confined to the top-layer of the application. Inversion of control can help every layer and is a great way to de-couple various parts of the app.

This code brings in a framework (Lagom) to build a dependency injection framework and then adds a small function (``depends``) that adapts it to FastAPI's dependency injection mechanism ("Depends").

The advantages to this approach are numerous.

We don't need to write these little adapters for each component of the backend to adapt it FastAPI. For example look at the change to the roles API controller:

```diff
-def get_role_manager(app: UniverseApplication = Depends(get_app)) -> RoleManager:
-    return app.role_manager
-
-
 @cbv(router)
 class FastAPIRoles:
-    role_manager: RoleManager = Depends(get_role_manager)
+    role_manager: RoleManager = depends(RoleManager)
```

This is much less boilerplate. We don't need to implement & type that function get_role_manager and we don't need to bring in the import on UniverseApplication.

Additionally, we've got a clean abstraction that shields us from ``fastapi`` imports in all of our controllers. It should make it more possible to switch to new frameworks and such as the Python ecosystem matures.

Also, the same DI that is used to inject ``RoleManager`` into this contoller is used to inject app into RoleManager when it is constructed during application initialization. Any component being managed by UniverseApplication can now rely on its constructor arguments to be injected if it wants. It is easy to see the cool examples on FastAPI and think it is just a technology for controllers, but it totally is not.

I don't think there is really a way to use FastAPI's dependency injection outside the context of that framework, but even if one could Lagom is superior. All the auto-wiring is by type and requires zero framework and zero configuration (https://github.com/meadsteve/lagom#auto-wiring-with-zero-configuraton).

Having a web framework provide these framework-bound extension points for injecting stuff into controllers was the state of the art of Java like 15 years ago. Skipping that whole learning process and using the type system and auto-wiring that isn't dependent on framework annotation really jumps out to Java circa 8 years ago!

Why Lagom is an interesting question. When researching DI frameworks, I couldn't find a clear winner but Lagom focus on type annotations versus annotating by name makes it clearly more modern than a lot frameworks by much bigger names (https://github.com/meadsteve/lagom/blob/master/docs/comparison.md). The other type-centric framework that had even a nice interface that I found was punq (https://punq.readthedocs.io/en/latest/). The development just doesn't seem as active on punq. While I didn't land up using the integration Lagom seems to have async frameworks in mind (https://github.com/meadsteve/lagom/blob/master/lagom/integrations/fast_api.py), so that is another plus. Ultimately though I think I can swap between these two with like 10 lines of code switch, they do cool things with very simple interfaces and neither requires a bunch of investment in annotation on your components.
2021-02-23 10:28:46 -05:00
John Chilton 1fd4bce673 Refactor legacy grids - tool shed webapp shouldn't depend on reports webapp. 2020-12-31 15:18:57 -05:00
John Chilton 28661a4fec More type checking fixes. 2020-12-30 20:31:07 -05:00
John Chilton 04b1e0a785 Mypy type checking for galaxy-web-apps. 2020-12-29 00:29:51 -05:00
Nicola Soranzo e96c96eb79 Merge branch 'release_20.09' into dev 2020-10-19 17:48:30 +01:00
Nicola Soranzo a3b954126d Add *requirements.txt files to source packages 2020-10-19 10:32:05 +01: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
Dannon Baker c007e03d2a Merge remote-tracking branch 'upstream/release_20.05' into dev 2020-07-14 12:12:20 -04:00
John Chilton 1616d21b0a Tweak requirements for recent changes to package structure. 2020-07-14 09:17:41 -04:00
John Chilton 0ea20422e0 Modify packages to allow test requirements (for responses). 2020-07-06 18:49:04 -04:00
John Chilton 4e25887d14 Rename galaxy-web-apps -> galaxy-webapps 2020-07-06 18:49:04 -04:00