From b82ca3c48b04ce5d6ef8c28aff42c8da457d3745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Pich=C3=A9?= Date: Tue, 17 Dec 2024 15:38:48 -0500 Subject: [PATCH 1/2] feat: allow stew build when package-mode is false --- coveo_stew/metadata/poetry_api.py | 2 ++ coveo_stew/offline_publish.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/coveo_stew/metadata/poetry_api.py b/coveo_stew/metadata/poetry_api.py index cf935f3..9c0181a 100644 --- a/coveo_stew/metadata/poetry_api.py +++ b/coveo_stew/metadata/poetry_api.py @@ -55,6 +55,7 @@ def __init__( dependencies: Mapping[str, Any] = None, dev_dependencies: Mapping[str, Any] = None, group: Mapping[str, Any] = None, + package_mode: bool = True, **extra: Any, ) -> None: self.name: Final[str] = name @@ -62,6 +63,7 @@ def __init__( self.authors: Final[Iterable[str]] = authors self.version: Final[str] = version self.description: Final[str] = description + self.package_mode: Final[bool] = package_mode deps = dependencies_factory(dependencies) dev_deps = dependencies_factory(dev_dependencies) diff --git a/coveo_stew/offline_publish.py b/coveo_stew/offline_publish.py index bf023cb..e99eba1 100644 --- a/coveo_stew/offline_publish.py +++ b/coveo_stew/offline_publish.py @@ -80,8 +80,10 @@ def perform_offline_install(self, *, quiet: bool = False) -> None: if not self.project.lock_path.exists(): raise LockNotFound("Project isn't locked; can't proceed.") - # build the wheels for the current project - self.project.build(self.wheelhouse) + # build the wheels for the current project unless `package-mode: false` is specified. + # ref: https://python-poetry.org/docs/basic-usage/#operating-modes + if self.project.package.package_mode: + self.project.build(self.wheelhouse) self._store_setup_dependencies_in_wheelhouse() self._store_dependencies_in_wheelhouse() From ee3492604d79b03329f3f8949e3a614a446746b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Pich=C3=A9?= Date: Tue, 17 Dec 2024 15:54:38 -0500 Subject: [PATCH 2/2] fix: only validate if package mode is enabled --- coveo_stew/offline_publish.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/coveo_stew/offline_publish.py b/coveo_stew/offline_publish.py index e99eba1..5a912d8 100644 --- a/coveo_stew/offline_publish.py +++ b/coveo_stew/offline_publish.py @@ -88,7 +88,9 @@ def perform_offline_install(self, *, quiet: bool = False) -> None: self._store_dependencies_in_wheelhouse() # validate the wheelhouse; this will exit in error if something's amiss or result in a noop if all is right. - self._validate_package(f"{self.project.package.name}=={self.project.package.version}") + # if package mode is disabled, we expect the package to be missing. + if self.project.package.package_mode: + self._validate_package(f"{self.project.package.name}=={self.project.package.version}") def _store_setup_dependencies_in_wheelhouse( self, project: Optional[PythonProject] = None