From d9eb1d147280e760801a1b4ace3adb3fa07d32b9 Mon Sep 17 00:00:00 2001 From: Claudio Jolowicz Date: Fri, 5 Feb 2021 11:22:38 +0100 Subject: [PATCH 1/2] feat(sessions): Use WHEEL as default argument for build_package --- src/nox_poetry/sessions.py | 6 ++++-- src/nox_poetry/sessions.pyi | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/nox_poetry/sessions.py b/src/nox_poetry/sessions.py index 7214cc1e..510a59e4 100644 --- a/src/nox_poetry/sessions.py +++ b/src/nox_poetry/sessions.py @@ -98,7 +98,7 @@ def install(self, *args: str, **kwargs: Any) -> None: args_extras = [_split_extras(arg) for arg in args] if "." in [arg for arg, _ in args_extras]: - package = self.build_package(distribution_format=DistributionFormat.WHEEL) + package = self.build_package() def rewrite(arg: str, extras: Optional[str]) -> str: if arg != ".": @@ -184,7 +184,9 @@ def export_requirements(self) -> Path: return path - def build_package(self, *, distribution_format: str) -> str: + def build_package( + self, *, distribution_format: str = DistributionFormat.WHEEL + ) -> str: """Build a distribution archive for the package. This function uses `poetry build`_ to build a wheel or sdist archive for diff --git a/src/nox_poetry/sessions.pyi b/src/nox_poetry/sessions.pyi index e0f187a3..ccd48d92 100644 --- a/src/nox_poetry/sessions.pyi +++ b/src/nox_poetry/sessions.pyi @@ -24,7 +24,7 @@ class _PoetrySession: self, *, distribution_format: str, extras: Iterable[str] = ... ) -> None: ... def export_requirements(self) -> Path: ... - def build_package(self, *, distribution_format: str) -> str: ... + def build_package(self, *, distribution_format: str = ...) -> str: ... class Session: poetry: _PoetrySession From 9b18b3ca059369ef6f7729766f12176280a2cd40 Mon Sep 17 00:00:00 2001 From: Claudio Jolowicz Date: Fri, 5 Feb 2021 11:27:17 +0100 Subject: [PATCH 2/2] feat(sessions): Use WHEEL as default argument for installroot --- src/nox_poetry/sessions.py | 2 +- src/nox_poetry/sessions.pyi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nox_poetry/sessions.py b/src/nox_poetry/sessions.py index 510a59e4..7bcc6cfb 100644 --- a/src/nox_poetry/sessions.py +++ b/src/nox_poetry/sessions.py @@ -120,7 +120,7 @@ def rewrite(arg: str, extras: Optional[str]) -> str: def installroot( self, *, - distribution_format: str, + distribution_format: str = DistributionFormat.WHEEL, extras: Iterable[str] = (), ) -> None: """Install the root package into a Nox session using Poetry. diff --git a/src/nox_poetry/sessions.pyi b/src/nox_poetry/sessions.pyi index ccd48d92..c05fb848 100644 --- a/src/nox_poetry/sessions.pyi +++ b/src/nox_poetry/sessions.pyi @@ -21,7 +21,7 @@ Python = Optional[Union[str, Sequence[str], bool]] class _PoetrySession: def install(self, *args: str, **kwargs: Any) -> None: ... def installroot( - self, *, distribution_format: str, extras: Iterable[str] = ... + self, *, distribution_format: str = ..., extras: Iterable[str] = ... ) -> None: ... def export_requirements(self) -> Path: ... def build_package(self, *, distribution_format: str = ...) -> str: ...