diff --git a/.gitignore b/.gitignore index 81ca2f9..f01480a 100644 --- a/.gitignore +++ b/.gitignore @@ -169,6 +169,7 @@ cython_debug/ scripts/* !scripts/start_dev.sh !scripts/test.sh +!scripts/start_w_gunicorn.sh # local file cache uploads/* diff --git a/poetry.lock b/poetry.lock index b4288d8..34157b7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1083,6 +1083,27 @@ files = [ docs = ["Sphinx", "furo"] test = ["objgraph", "psutil"] +[[package]] +name = "gunicorn" +version = "22.0.0" +description = "WSGI HTTP Server for UNIX" +optional = false +python-versions = ">=3.7" +files = [ + {file = "gunicorn-22.0.0-py3-none-any.whl", hash = "sha256:350679f91b24062c86e386e198a15438d53a7a8207235a78ba1b53df4c4378d9"}, + {file = "gunicorn-22.0.0.tar.gz", hash = "sha256:4a0b436239ff76fb33f11c07a16482c521a7e09c1ce3cc293c2330afe01bec63"}, +] + +[package.dependencies] +packaging = "*" + +[package.extras] +eventlet = ["eventlet (>=0.24.1,!=0.36.0)"] +gevent = ["gevent (>=1.4.0)"] +setproctitle = ["setproctitle"] +testing = ["coverage", "eventlet", "gevent", "pytest", "pytest-cov"] +tornado = ["tornado (>=0.2)"] + [[package]] name = "h11" version = "0.14.0" @@ -3360,4 +3381,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "96a9b64d9b6c2516f0ad86676d39cef021fc5186d3c2221ff82a1d83bd396626" +content-hash = "f3af735924224b900d028ccb7322ad5e15027063883c7b1b362dea22ddf885da" diff --git a/pyproject.toml b/pyproject.toml index f081d1f..22a010a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,6 +17,8 @@ python-multipart = "^0.0.9" beartype = "^0.18.5" python-dotenv = "^1.0.1" pydantic-settings = "^2.3.4" +uvicorn = {extras = ["standard"], version = "^0.30.1"} +gunicorn = "^22.0.0" [tool.poetry.group.dev.dependencies] diff --git a/requirements.txt b/requirements.txt index d55f677..568e3f1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -87,6 +87,9 @@ greenlet==3.0.3 ; python_version < "3.13" and (platform_machine == "aarch64" or --hash=sha256:fcd2469d6a2cf298f198f0487e0a5b1a47a42ca0fa4dfd1b6862c999f018ebbf \ --hash=sha256:fd096eb7ffef17c456cfa587523c5f92321ae02427ff955bebe9e3c63bc9f0da \ --hash=sha256:fe754d231288e1e64323cfad462fcee8f0288654c10bdf4f603a39ed923bef33 +gunicorn==22.0.0 ; python_version >= "3.11" and python_version < "4.0" \ + --hash=sha256:350679f91b24062c86e386e198a15438d53a7a8207235a78ba1b53df4c4378d9 \ + --hash=sha256:4a0b436239ff76fb33f11c07a16482c521a7e09c1ce3cc293c2330afe01bec63 h11==0.14.0 ; python_version >= "3.11" and python_version < "4.0" \ --hash=sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d \ --hash=sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761 @@ -258,6 +261,9 @@ orjson==3.10.6 ; python_version >= "3.11" and python_version < "4.0" \ --hash=sha256:f759503a97a6ace19e55461395ab0d618b5a117e8d0fbb20e70cfd68a47327f2 \ --hash=sha256:fb0ee33124db6eaa517d00890fc1a55c3bfe1cf78ba4a8899d71a06f2d6ff5c7 \ --hash=sha256:fd502f96bf5ea9a61cbc0b2b5900d0dd68aa0da197179042bdd2be67e51a1e4b +packaging==24.1 ; python_version >= "3.11" and python_version < "4.0" \ + --hash=sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002 \ + --hash=sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124 pydantic-core==2.20.1 ; python_version >= "3.11" and python_version < "4.0" \ --hash=sha256:035ede2e16da7281041f0e626459bcae33ed998cca6a0a007a5ebb73414ac72d \ --hash=sha256:04024d270cf63f586ad41fff13fde4311c4fc13ea74676962c876d9577bcc78f \ diff --git a/scripts/start_w_gunicorn.sh b/scripts/start_w_gunicorn.sh new file mode 100755 index 0000000..79fb085 --- /dev/null +++ b/scripts/start_w_gunicorn.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +gunicorn src.smolvault.main:app --workers 2 --worker-class uvicorn.workers.UvicornWorker diff --git a/src/smolvault/__init__.py b/src/smolvault/__init__.py index 7002cfb..e69de29 100644 --- a/src/smolvault/__init__.py +++ b/src/smolvault/__init__.py @@ -1,3 +0,0 @@ -from beartype.claw import beartype_this_package # <-- this is boring, but... - -beartype_this_package() # <-- the fast way