Skip to content

Commit 32dca1b

Browse files
authored
Merge pull request #21201 from mvdbeek/tuspyserver
Replace tuswsgi with tuspyserver
2 parents f23a469 + 8c085df commit 32dca1b

File tree

5 files changed

+25
-31
lines changed

5 files changed

+25
-31
lines changed

lib/galaxy/dependencies/pinned-requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ edam-ontology==1.25.2
6868
email-validator==2.3.0
6969
et-xmlfile==2.0.0
7070
exceptiongroup==1.3.0 ; python_full_version < '3.11'
71-
fastapi-slim==0.118.3
71+
fastapi==0.118.3
7272
filelock==3.19.1 ; python_full_version < '3.10'
7373
filelock==3.20.0 ; python_full_version >= '3.10'
7474
fissix==24.4.24
@@ -224,7 +224,7 @@ tomli==2.3.0 ; python_full_version < '3.11'
224224
tornado==6.5.2
225225
tqdm==4.67.1
226226
tuspy==1.1.0
227-
tuswsgi==0.5.5
227+
tuspyserver==4.2.0
228228
typing-extensions==4.15.0
229229
typing-inspection==0.4.2
230230
tzdata==2025.2

lib/galaxy/webapps/galaxy/buildapp.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
import threading
99
import traceback
1010
from typing import Optional
11-
from urllib.parse import urljoin
1211

1312
from paste import httpexceptions
14-
from tuswsgi import TusMiddleware
1513

1614
import galaxy.app
1715
import galaxy.datatypes.registry
@@ -1084,30 +1082,6 @@ def wrap_in_middleware(app, global_conf, application_stack, **local_conf):
10841082
from galaxy.web.framework.middleware.translogger import TransLogger
10851083

10861084
app = wrap_if_allowed(app, stack, TransLogger)
1087-
# TUS upload middleware
1088-
app = wrap_if_allowed(
1089-
app,
1090-
stack,
1091-
TusMiddleware,
1092-
kwargs={
1093-
"upload_path": urljoin(f"{application_stack.config.galaxy_url_prefix}/", "api/upload/resumable_upload"),
1094-
"tmp_dir": application_stack.config.tus_upload_store or application_stack.config.new_file_path,
1095-
"max_size": application_stack.config.maximum_upload_file_size,
1096-
},
1097-
)
1098-
# TUS upload middleware for job files....
1099-
app = wrap_if_allowed(
1100-
app,
1101-
stack,
1102-
TusMiddleware,
1103-
kwargs={
1104-
"upload_path": urljoin(f"{application_stack.config.galaxy_url_prefix}/", "api/job_files/resumable_upload"),
1105-
"tmp_dir": application_stack.config.tus_upload_store_job_files
1106-
or application_stack.config.tus_upload_store
1107-
or application_stack.config.new_file_path,
1108-
"max_size": application_stack.config.maximum_upload_file_size,
1109-
},
1110-
)
11111085
# X-Forwarded-Host handling
11121086
app = wrap_if_allowed(app, stack, XForwardedHostMiddleware)
11131087
# Request ID middleware

lib/galaxy/webapps/galaxy/fast_app.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from typing import (
22
Any,
33
)
4+
from urllib.parse import urljoin
45

56
from a2wsgi import WSGIMiddleware
67
from fastapi import (
@@ -9,6 +10,7 @@
910
)
1011
from fastapi.openapi.constants import REF_TEMPLATE
1112
from starlette.middleware.cors import CORSMiddleware
13+
from tuspyserver import create_tus_router
1214

1315
from galaxy.schema.generics import CustomJsonSchema
1416
from galaxy.version import VERSION
@@ -165,6 +167,23 @@ def get_openapi_schema() -> dict[str, Any]:
165167
)
166168

167169

170+
def include_tus(app: FastAPI, gx_app):
171+
config = gx_app.config
172+
root_path = "" if config.galaxy_url_prefix == "/" else config.galaxy_url_prefix
173+
upload_tus_router = create_tus_router(
174+
prefix=urljoin(root_path, "api/upload/resumable_upload"),
175+
files_dir=config.tus_upload_store or config.new_file_path,
176+
max_size=config.maximum_upload_file_size,
177+
)
178+
job_files_tus_router = create_tus_router(
179+
prefix=urljoin(root_path, "api/job_files/resumable_upload"),
180+
files_dir=config.tus_upload_store_job_files or config.tus_upload_store or config.new_file_path,
181+
max_size=config.maximum_upload_file_size,
182+
)
183+
app.include_router(upload_tus_router)
184+
app.include_router(job_files_tus_router)
185+
186+
168187
def initialize_fast_app(gx_wsgi_webapp, gx_app):
169188
root_path = "" if gx_app.config.galaxy_url_prefix == "/" else gx_app.config.galaxy_url_prefix
170189
app = get_fastapi_instance(root_path=root_path)
@@ -178,6 +197,7 @@ def initialize_fast_app(gx_wsgi_webapp, gx_app):
178197
include_legacy_openapi(app, gx_app)
179198
wsgi_handler = WSGIMiddleware(gx_wsgi_webapp)
180199
gx_app.haltables.append(("WSGI Middleware threadpool", wsgi_handler.executor.shutdown))
200+
include_tus(app, gx_app)
181201
app.mount("/", wsgi_handler) # type: ignore[arg-type]
182202
if gx_app.config.galaxy_url_prefix != "/":
183203
parent_app = FastAPI()

packages/web_apps/setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ install_requires =
6060
SQLAlchemy>=2.0.37,<2.1,!=2.0.41
6161
starlette
6262
starlette-context
63-
tuswsgi
63+
tuspyserver
6464
typing-extensions
6565
uvicorn
6666
uvloop>=0.21.0

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ dependencies = [
3737
"docutils!=0.17,!=0.17.1",
3838
"dparse",
3939
"edam-ontology",
40-
"fastapi-slim>=0.111.0,!=0.119.*,!=0.120.0,!=0.120.1,!=0.120.2", # https://github.com/fastapi/fastapi/pull/13918
40+
"fastapi>=0.111.0,!=0.119.*,!=0.120.0,!=0.120.1,!=0.120.2", # https://github.com/fastapi/fastapi/pull/13918
4141
"fissix",
4242
"fs",
4343
"future>=1.0.0", # Python 3.12 support
@@ -101,8 +101,8 @@ dependencies = [
101101
"starlette-context",
102102
"svgwrite",
103103
"tifffile",
104-
"tuswsgi",
105104
"typing-extensions",
105+
"tuspyserver",
106106
"uvicorn!=0.28.0", # https://github.com/galaxyproject/galaxy/issues/17669
107107
"uvloop>=0.21.0", # Python 3.13 support
108108
"WebOb>=1.8.9", # Python 3.13 support

0 commit comments

Comments
 (0)