https://github.com/banesullivan/server-thread

⚙️ Launch a WSGI or ASGI Application in a background thread with werkzeug or uvicorn

https://github.com/banesullivan/server-thread

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.3%) to scientific vocabulary

Keywords

asgi-server localtileserver threading wsgi-server
Last synced: 5 months ago · JSON representation

Repository

⚙️ Launch a WSGI or ASGI Application in a background thread with werkzeug or uvicorn

Basic Info
  • Host: GitHub
  • Owner: banesullivan
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 20.5 KB
Statistics
  • Stars: 8
  • Watchers: 3
  • Forks: 1
  • Open Issues: 1
  • Releases: 1
Topics
asgi-server localtileserver threading wsgi-server
Created almost 4 years ago · Last pushed about 1 year ago
Metadata Files
Readme License

README.md

⚙️ Server Thread

Tests codecov PyPI conda

Launch a WSGI or ASGI Application in a background thread with werkzeug or uvicorn.

This application was created for localtileserver and provides the basis for how it can launch an image tile server as a background thread for visualizing data in Jupyter notebooks.

While this may not be a widely applicable library, it is useful for a few Python packages I have created that require a background service.

🚀 Usage

Use the ServerThread with any WSGI or ASGI Application.

Start by creating a application (this can be a flask app or a simple app like below):

```py

Create some WSGI Application

from werkzeug import Request, Response

@Request.application def app(request): return Response("howdy", 200) ```

Then launch the app with the ServerThread class:

```py import requests from server_thread import ServerThread

Launch app in a background thread

server = ServerThread(app)

Perform requests against the server without blocking

requests.get(f"http://{server.host}:{server.port}/").raiseforstatus() ```

⬇️ Installation

Get started with server-thread to create applications that require a WSGIApplication in the background.

🐍 Installing with conda

Conda makes managing server-thread's dependencies across platforms quite easy and this is the recommended method to install:

bash conda install -c conda-forge server-thread

🎡 Installing with pip

If you prefer pip, then you can install from PyPI: https://pypi.org/project/server-thread/

pip install server-thread

💭 Feedback

Please share your thoughts and questions on the Discussions board. If you would like to report any bugs or make feature requests, please open an issue.

If filing a bug report, please share a scooby Report:

py import server_thread print(server_thread.Report())

🚀 Examples

Minimal examples for using server-thread with common micro-frameworks.

💨 FastAPI

```py import requests from fastapi import FastAPI from server_thread import ServerThread

app = FastAPI()

@app.get("/") def root(): return {"message": "Howdy!"}

server = ServerThread(app) requests.get(f"http://{server.host}:{server.port}/").json() ```

⚗️ Flask

```py import requests from flask import Flask from server_thread import ServerThread

app = Flask("testapp")

@app.route("/") def howdy(): return {"message": "Howdy!"}

server = ServerThread(app) requests.get(f"http://{server.host}:{server.port}/").json() ```

Owner

  • Name: Bane Sullivan
  • Login: banesullivan
  • Kind: user
  • Location: United States

visualization geek & software engineer. co-created @pyvista.

GitHub Events

Total
  • Watch event: 2
  • Issue comment event: 3
  • Push event: 2
  • Pull request event: 2
  • Fork event: 1
  • Create event: 1
Last Year
  • Watch event: 2
  • Issue comment event: 3
  • Push event: 2
  • Pull request event: 2
  • Fork event: 1
  • Create event: 1

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 8
  • Total Committers: 1
  • Avg Commits per committer: 8.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Bane Sullivan b****i@g****m 8

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 2
  • Total pull requests: 3
  • Average time to close issues: about 7 hours
  • Average time to close pull requests: 39 minutes
  • Total issue authors: 2
  • Total pull request authors: 2
  • Average comments per issue: 5.0
  • Average comments per pull request: 2.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: about 1 hour
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 2.5
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • banesullivan (1)
  • wanghaisheng (1)
Pull Request Authors
  • vincentsarago (2)
  • banesullivan (1)
Top Labels
Issue Labels
enhancement (1)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 36,409 last-month
  • Total docker downloads: 225
  • Total dependent packages: 3
    (may contain duplicates)
  • Total dependent repositories: 7
    (may contain duplicates)
  • Total versions: 7
  • Total maintainers: 1
pypi.org: server-thread

Launch a WSGI or ASGI Application in a background thread with werkzeug or uvicorn.

  • Documentation: https://server-thread.readthedocs.io/
  • License: MIT License Copyright (c) 2021-2022 Bane Sullivan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 0.3.0
    published about 1 year ago
  • Versions: 5
  • Dependent Packages: 2
  • Dependent Repositories: 6
  • Downloads: 36,409 Last month
  • Docker Downloads: 225
Rankings
Downloads: 2.7%
Docker downloads count: 4.2%
Dependent packages count: 4.7%
Dependent repos count: 6.0%
Average: 12.1%
Stargazers count: 25.0%
Forks count: 29.8%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: server-thread

Launch a WSGIApplication in a background thread with werkzeug

  • Versions: 2
  • Dependent Packages: 1
  • Dependent Repositories: 1
Rankings
Dependent repos count: 24.3%
Dependent packages count: 29.0%
Average: 45.7%
Stargazers count: 63.6%
Forks count: 66.0%
Last synced: 6 months ago

Dependencies

requirements.txt pypi
  • fastapi *
  • flask >=2.0.0
  • pytest *
  • pytest-cov *
  • requests *
  • scooby *
  • uvicorn *
requirements_style.txt pypi
  • black *
  • codespell *
  • flake8 *
  • flake8-black *
  • flake8-bugbear *
  • flake8-isort *
  • isort *
  • pydocstyle *
setup.py pypi
  • scooby *
  • uvicorn *
  • werkzeug *
.github/workflows/lint.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/release.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/test.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • actions/upload-artifact v2 composite
  • codecov/codecov-action v2 composite
pyproject.toml pypi