-
Notifications
You must be signed in to change notification settings - Fork 0
/
noxfile.py
49 lines (37 loc) · 1.03 KB
/
noxfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from __future__ import annotations
import os
import nox
nox.options.sessions = ["lint", "tests"]
@nox.session
def lint(session: nox.Session) -> None:
"""
Run pre-commit linting.
"""
session.install("pre-commit")
session.run(
"pre-commit", "run", "--show-diff-on-failure", "--all-files", *session.posargs
)
@nox.session
def tests(session: nox.Session) -> None:
"""
Run the package tests (minimal at the moment).
"""
session.install("-e", ".[test]")
session.run("pytest", *session.posargs)
@nox.session
def serve(session: nox.Session) -> None:
"""
Serve a session (Ctrl-C to quit).
"""
env = os.environ.copy()
env["FLASK_DEBUG"] = "1"
session.install(".[cli]")
session.run("flask", "run", *session.posargs, env=env)
@nox.session
def production(session: nox.Session) -> None:
"""
Serve with a production level server (Ctrl-C to quit).
"""
session.install(".")
session.install("gunicorn")
session.run("gunicorn", "hypernewsviewer.app:app")