Browse Source

Add invoke as well

Getty Ritter 3 years ago
parent
commit
dd729a82e6
3 changed files with 34 additions and 1 deletions
  1. 14 1
      poetry.lock
  2. 1 0
      pyproject.toml
  3. 19 0
      tasks.py

+ 14 - 1
poetry.lock

@@ -84,6 +84,14 @@ dev = ["pytest", "coverage", "tox", "sphinx", "pallets-sphinx-themes", "sphinxco
 docs = ["sphinx", "pallets-sphinx-themes", "sphinxcontrib-log-cabinet", "sphinx-issues"]
 dotenv = ["python-dotenv"]
 
+[[package]]
+category = "dev"
+description = "Pythonic task execution"
+name = "invoke"
+optional = false
+python-versions = "*"
+version = "1.4.1"
+
 [[package]]
 category = "main"
 description = "Various helpers to pass data to untrusted environments and back."
@@ -252,7 +260,7 @@ dev = ["pytest", "pytest-timeout", "coverage", "tox", "sphinx", "pallets-sphinx-
 watchdog = ["watchdog"]
 
 [metadata]
-content-hash = "d8594e4418e402f5b0a61481cb6065ad6a104ac8e9a965c68f18a9c8709cf47c"
+content-hash = "3386384cb9bc023f5fb3d2833c8c54b1da1bc3d3ae52af0a936e1d96a575e558"
 python-versions = "^3.8"
 
 [metadata.files]
@@ -280,6 +288,11 @@ flask = [
     {file = "Flask-1.1.2-py2.py3-none-any.whl", hash = "sha256:8a4fdd8936eba2512e9c85df320a37e694c93945b33ef33c89946a340a238557"},
     {file = "Flask-1.1.2.tar.gz", hash = "sha256:4efa1ae2d7c9865af48986de8aeb8504bf32c7f3d6fdc9353d34b21f4b127060"},
 ]
+invoke = [
+    {file = "invoke-1.4.1-py2-none-any.whl", hash = "sha256:93e12876d88130c8e0d7fd6618dd5387d6b36da55ad541481dfa5e001656f134"},
+    {file = "invoke-1.4.1-py3-none-any.whl", hash = "sha256:87b3ef9d72a1667e104f89b159eaf8a514dbf2f3576885b2bbdefe74c3fb2132"},
+    {file = "invoke-1.4.1.tar.gz", hash = "sha256:de3f23bfe669e3db1085789fd859eb8ca8e0c5d9c20811e2407fa042e8a5e15d"},
+]
 itsdangerous = [
     {file = "itsdangerous-1.1.0-py2.py3-none-any.whl", hash = "sha256:b12271b2047cb23eeb98c8b5622e2e5c5e9abd9784a153e9d8ef9cb4dd09d749"},
     {file = "itsdangerous-1.1.0.tar.gz", hash = "sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19"},

+ 1 - 0
pyproject.toml

@@ -14,6 +14,7 @@ tinyrecord = "^0.1.5"
 [tool.poetry.dev-dependencies]
 mypy = "^0.770"
 black = "^19.10b0"
+invoke = "^1.4.1"
 
 [build-system]
 requires = ["poetry>=0.12"]

+ 19 - 0
tasks.py

@@ -0,0 +1,19 @@
+from invoke import task
+
+@task
+def run(c, port='5000', host='127.0.0.1'):
+    """Run a debug server locally"""
+    c.run(
+        f"poetry run python -m flask run -p {port} -h {host}",
+        env={
+            "FLASK_APP": "corkboard.py",
+            "APP_PATH": f"http://{host}:{port}",
+        },
+    )
+
+@task
+def uwsgi(c, sock="corkboard.sock"):
+    """Run a uwsgi server"""
+    c.run(
+        f"poetry run uwsgi --socket {sock} --module corkboard:app --processes 4 --threads 2"
+    )