Files
conference-room-booking-system/noxfile.py
2025-09-19 23:30:13 -04:00

74 lines
1.5 KiB
Python

"""Root noxfile for orchestrating backend and frontend tasks.
Run with `nox -s <session>` from the project root.
"""
import nox
backend_sessions = [
"pre-commit",
"safety",
"mypy",
"tests",
"coverage",
"typeguard",
"xdoctest",
"docs-build",
"docs",
]
frontend_sessions = [
"jest",
]
def _delegate(session: nox.Session, subdir: str, session_name: str) -> None: # type: ignore
"""Delegate session execution to a subdirectory noxfile.
Args:
session: The Nox session object.
subdir: Subdirectory containing the noxfile.
session_name: Name of the session to run.
"""
session.run(
"nox",
"-f",
f"{subdir}/noxfile.py",
"-s",
session_name,
*session.posargs,
external=True,
)
for name in backend_sessions:
func_name = name.replace("-", "_")
exec(
f'''
@nox.session(name={name!r})
def {func_name}_delegator(session: nox.Session) -> None:
"""Delegates to backend/{name} session.
Args:
session: The Nox session object.
"""
_delegate(session, 'backend', {name!r})
'''
)
for name in frontend_sessions:
func_name = name.replace("-", "_")
exec(
f'''
@nox.session(name={name!r})
def {func_name}_delegator(session: nox.Session) -> None:
"""Delegates to frontend/{name} session.
Args:
session: The Nox session object.
"""
_delegate(session, 'frontend', {name!r})
'''
)