Skip to content

Commit

Permalink
Use wheel as default for installroot and build_package (cjolowicz#265)
Browse files Browse the repository at this point in the history
* feat(sessions): Use WHEEL as default argument for build_package

* feat(sessions): Use WHEEL as default argument for installroot
  • Loading branch information
cjolowicz authored Feb 5, 2021
1 parent 5aa7c25 commit 2afdb70
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/nox_poetry/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 != ".":
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/nox_poetry/sessions.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ 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: ...
def build_package(self, *, distribution_format: str = ...) -> str: ...

class Session:
poetry: _PoetrySession
Expand Down

0 comments on commit 2afdb70

Please sign in to comment.