Skip to content

Commit

Permalink
Merge pull request #70 from coveo/feat/stew-build-package-mode
Browse files Browse the repository at this point in the history
feat: allow stew build when package-mode is false
  • Loading branch information
jonapich authored Dec 17, 2024
2 parents c9220ff + ee34926 commit 4c474f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions coveo_stew/metadata/poetry_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@ 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
self.safe_name: Final[str] = name.replace("-", "_")
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)
Expand Down
10 changes: 7 additions & 3 deletions coveo_stew/offline_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,17 @@ 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()

# 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
Expand Down

0 comments on commit 4c474f0

Please sign in to comment.