in noxfile.py [0:0]
def lint_plugins_in_dir(session, directory: str) -> None:
install_cmd = ["pip", "install", "-e"]
install_hydra(session, install_cmd)
plugins = select_plugins(session=session, directory=directory)
# plugin linting requires the plugins and their dependencies to be installed
for plugin in plugins:
cmd = install_cmd + [os.path.join(directory, plugin.path)]
session.run(*cmd, silent=SILENT)
install_dev_deps(session)
session.run("flake8", "--config", ".flake8", directory)
# Mypy for plugins
for plugin in plugins:
path = os.path.join(directory, plugin.path)
session.chdir(path)
session.run(*_black_cmd(), silent=SILENT)
session.run(*_isort_cmd(), silent=SILENT)
session.chdir(BASE)
files = []
for file in ["tests", "example"]:
abs = os.path.join(path, file)
if os.path.exists(abs):
files.append(abs)
session.run(
"mypy",
"--strict",
f"{path}/hydra_plugins",
"--config-file",
f"{BASE}/.mypy.ini",
silent=SILENT,
)
session.run(
"mypy",
"--strict",
"--namespace-packages",
"--config-file",
f"{BASE}/.mypy.ini",
*files,
silent=SILENT,
)