diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 4e94fcf5..84fd7ea4 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -48,6 +48,11 @@ jobs: env: PY_LINT_MYPY_EXTRA_ARGS: --no-incremental + - run: mk docs + if: | + matrix.python-version == '3.11' + && matrix.system == 'ubuntu-latest' + - run: mk python-test env: PY_TEST_EXTRA_ARGS: --cov-report=xml diff --git a/.gitignore b/.gitignore index 601b9684..e1ff9206 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ htmlcov *-stubs coverage*.xml tags +mklocal +docs diff --git a/.isort.cfg b/.isort.cfg index a915ed21..19631225 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -1,2 +1,2 @@ [settings] -known_first_party=runtimepy +known_first_party=runtimepy,vmklib diff --git a/config b/config index bf989e4a..1b68aa9a 160000 --- a/config +++ b/config @@ -1 +1 @@ -Subproject commit bf989e4a72955c6d5f4a71f0cddface943f7f86b +Subproject commit 1b68aa9a5f78014a45a4c610fb38e6d80d9f5601 diff --git a/pyproject.toml b/pyproject.toml index 0685f2cb..30da8515 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,8 @@ test = [ "mypy", "isort", "yamllint", + "yambs", + "vmklib", "pytest-asyncio", "setuptools-wrapper", "types-setuptools" diff --git a/runtimepy/dev_requirements.txt b/runtimepy/dev_requirements.txt index 517fde61..ab1ef7ab 100644 --- a/runtimepy/dev_requirements.txt +++ b/runtimepy/dev_requirements.txt @@ -5,6 +5,8 @@ ruff mypy isort yamllint +yambs +vmklib pytest-asyncio setuptools-wrapper types-setuptools diff --git a/tasks/conf.py b/tasks/conf.py index 07cf2d47..c03d36de 100644 --- a/tasks/conf.py +++ b/tasks/conf.py @@ -1,41 +1,53 @@ +# ===================================== +# generator=datazen +# version=3.1.2 +# hash=9f62028523c3b5a953733ca89dcc3018 +# ===================================== """ A module for project-specific task registration. """ # built-in from pathlib import Path +from subprocess import run from typing import Dict # third-party -from vcorelib.task import Inbox, Outbox, Phony from vcorelib.task.manager import TaskManager -from vcorelib.task.subprocess.run import SubprocessLogMixin, is_windows -class ArbiterTask(SubprocessLogMixin): - """A task for running the runtime arbiter.""" +def audit_local_tasks() -> None: + """Ensure that shared task infrastructure is present.""" - default_requirements = {"vmklib.init", "venv", "python-editable"} + local = Path(__file__).parent.joinpath("mklocal") - async def run(self, inbox: Inbox, outbox: Outbox, *args, **kwargs) -> bool: - """Generate ninja configuration files.""" + # Also link a top-level file. + top_level = local.parent.parent.joinpath("mklocal") + if not top_level.is_symlink(): + assert not top_level.exists() + top_level.symlink_to(local) - cwd: Path = args[0] + if local.is_symlink(): + return - configs = cwd.joinpath("local", "arbiter") + # If it's not a symlink, it shouldn't be any other kind of file. + assert not local.exists() - config = configs.joinpath(kwargs.get("config", "test") + ".yaml") + # Ensure sub-module implementation is present. + config = local.parent.parent.joinpath("config") + assert config.is_dir() - return await self.exec( - str( - inbox["venv"]["venv{python_version}"]["bin"].joinpath( - "runtimepy" - ) - ), - "arbiter", - str(config), + # Initialize submodules if we don't see the directory we're looking for. + vmklib = config.joinpath("python", "mklocal") + if not vmklib.is_dir(): + run( + ["git", "-C", str(config.parent), "submodule", "update", "--init"], + check=True, ) + # Create the link. + local.symlink_to(vmklib) + def register( manager: TaskManager, @@ -45,16 +57,10 @@ def register( ) -> bool: """Register project tasks to the manager.""" - # Don't run yamllint on Windows because it will fail on newlines. - manager.register( - Phony("yaml"), - [] if is_windows() else ["yaml-lint-local", "yaml-lint-manifest.yaml"], - ) - - manager.register(ArbiterTask("r", cwd)) + audit_local_tasks() - del project - del cwd - del substitutions + from mklocal.python import ( # pylint: disable=import-outside-toplevel + register_python, + ) - return True + return register_python(manager, project, cwd, substitutions)