From 54276330c5c0c83d8b9b6c632ebda8365c910940 Mon Sep 17 00:00:00 2001 From: Vaughn Kottler Date: Thu, 3 Aug 2023 00:08:33 -0500 Subject: [PATCH 1/3] Testing new Python workflow --- .gitignore | 1 + config | 2 +- pyproject.toml | 2 ++ runtimepy/dev_requirements.txt | 2 ++ tasks/conf.py | 64 +++++++++++++++++++--------------- 5 files changed, 41 insertions(+), 30 deletions(-) diff --git a/.gitignore b/.gitignore index 601b9684..0ad52107 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ htmlcov *-stubs coverage*.xml tags +mklocal diff --git a/config b/config index bf989e4a..a2128eb6 160000 --- a/config +++ b/config @@ -1 +1 @@ -Subproject commit bf989e4a72955c6d5f4a71f0cddface943f7f86b +Subproject commit a2128eb6d094353cfa0da1ef975b21906e897343 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) From d36538fcdca055c9156f54a57a7c83794b9d5856 Mon Sep 17 00:00:00 2001 From: Vaughn Kottler Date: Thu, 3 Aug 2023 00:45:58 -0500 Subject: [PATCH 2/3] Updates to fix CI failure --- .isort.cfg | 2 +- config | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 a2128eb6..cebb5539 160000 --- a/config +++ b/config @@ -1 +1 @@ -Subproject commit a2128eb6d094353cfa0da1ef975b21906e897343 +Subproject commit cebb5539075f4f7427002be992b09051bd64645a From 089362036b445f651e3afb1f22e708cf03f0e324 Mon Sep 17 00:00:00 2001 From: Vaughn Kottler Date: Thu, 3 Aug 2023 01:33:27 -0500 Subject: [PATCH 3/3] Try to build the docs in CI --- .github/workflows/python-package.yml | 5 +++++ .gitignore | 1 + config | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) 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 0ad52107..e1ff9206 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ htmlcov coverage*.xml tags mklocal +docs diff --git a/config b/config index cebb5539..1b68aa9a 160000 --- a/config +++ b/config @@ -1 +1 @@ -Subproject commit cebb5539075f4f7427002be992b09051bd64645a +Subproject commit 1b68aa9a5f78014a45a4c610fb38e6d80d9f5601