forked from PolusAI/bfio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
noxfile.py
54 lines (44 loc) · 1.32 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
50
51
52
53
54
# -*- coding: utf-8 -*-
"""Nox automation file."""
from nox import Session, session
from pathlib import Path
import shutil
python_versions = ["3.10", "3.9", "3.8", "3.7"]
@session(python=["3.9"])
def format_check(session: Session) -> None:
"""Check for black format compliance."""
session.install("black")
session.run("black", "bfio", "--check")
@session(python=["3.9"])
def lint_check(session: Session) -> None:
"""Lint checks"""
session.install("flake8")
session.run(
"flake8",
"bfio",
"--count",
"--ignore=F722",
"--select=E9,F63,F7,F82",
"--show-source",
"--statistics",
)
session.run(
"flake8",
"bfio",
"--count",
"--exit-zero",
"--max-line-length=127",
"--statistics",
)
@session(python=["3.9"])
def docs(session: Session) -> None:
"""Build and serve the documentation with live reloading on file changes."""
args = session.posargs or ["html"]
session.install("-e", ".")
session.install("-r", "requirements/requirements-docs.txt")
session.install("sphinx")
source_dir = Path("docs", "source")
build_dir = Path("docs", "build")
if build_dir.exists():
shutil.rmtree(build_dir)
session.run("sphinx-build", "-b", "html", str(source_dir), str(build_dir))