From fd0278aabff7c963f707754dd8551e565cd106c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Pich=C3=A9?= Date: Thu, 17 Oct 2024 12:30:45 -0400 Subject: [PATCH 1/3] documentation --- README.md | 4 ++-- coveo_stew/stew.py | 26 ++++++++++++++++---------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index d3d2648..2700863 100644 --- a/README.md +++ b/README.md @@ -229,8 +229,8 @@ quick = {} - **pydev**: See the [multiple-libraries](README_MULTIPLE_LIBRARIES.md) guide. - **build-dependencies**: You can specify additional dependencies to be installed during `stew build`. - The format is the same as poetry dependencies: `name = "version"` or `name = { version = "version", ... }` -- **extras**: A list of extras to install during `stew build`. -- **all-extras**: If true, all extras will be installed during `stew build`. Overrides the `extras` list. +- **extras**: A list of extras to install during `stew build` (and `stew ci`: added in *v3.0.33*). +- **all-extras**: If true, all extras will be installed during `stew build` (and `stew ci`: added in *v3.0.33*). Overrides the `extras` list. - **quick**: *(v3.0.30)* Controls which checks are skipped when calling `stew ci --quick`. - The format is a dictionary with either the `check` or `skip` key, followed by a list of runners. - The behavior is identical to the `--check` and `--skip` options. diff --git a/coveo_stew/stew.py b/coveo_stew/stew.py index 8320676..c8af323 100644 --- a/coveo_stew/stew.py +++ b/coveo_stew/stew.py @@ -187,15 +187,18 @@ def _create_default_poetry_install( ) -> PythonEnvironment: """To be used only when no environments exist. Creates a default one by calling "poetry install".""" if install is EnvironmentCreationBehavior.Full: - self.poetry_run("install") + command = self._generate_poetry_install_command() elif install is EnvironmentCreationBehavior.NoDev: - self.poetry_run("install", "--no-dev") + command = self._generate_poetry_install_command() + command.append("--no-dev") else: assert install is EnvironmentCreationBehavior.Empty try: - self.poetry_run("env", "use", "python3") + command = ["env", "use", "python3"] except CalledProcessError: - self.poetry_run("env", "use", "python") + command = ["env", "use", "python"] + + self.poetry_run(*command) del self._virtual_environments_cache # force cache refresh activated_environment = self.activated_environment() @@ -333,9 +336,15 @@ def install( # return unless we are cleaning a non-cleaned environment return + command = self._generate_poetry_install_command(target_environment if sync else None, quiet) + self.poetry_run(*command, environment=target_environment) + target_environment.installed = True + target_environment.cleaned |= sync + + def _generate_poetry_install_command(self, sync_target_environment: Optional[PythonEnvironment] = None, quiet: bool = False) -> List[str]: command: List[str] = ["install"] - if sync: - command.append(get_verb("--sync", target_environment)) + if sync_target_environment: + command.append(get_verb("--sync", sync_target_environment)) if quiet and not self.verbose: command.append("--quiet") if self.options.all_extras: @@ -343,10 +352,7 @@ def install( elif self.options.extras: for extra in self.options.extras: command.extend(["--extras", extra]) - - self.poetry_run(*command, environment=target_environment) - target_environment.installed = True - target_environment.cleaned |= sync + return command def remove_egg_info(self) -> bool: """Removes the egg-info (editable project hook) from the folder. Returns True if we removed it.""" From 8946824824f7d2188d5a783575989ec3e6ea4bde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Pich=C3=A9?= Date: Thu, 17 Oct 2024 12:37:39 -0400 Subject: [PATCH 2/3] run stew ci :D --- coveo_stew/stew.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/coveo_stew/stew.py b/coveo_stew/stew.py index c8af323..af6059c 100644 --- a/coveo_stew/stew.py +++ b/coveo_stew/stew.py @@ -341,7 +341,9 @@ def install( target_environment.installed = True target_environment.cleaned |= sync - def _generate_poetry_install_command(self, sync_target_environment: Optional[PythonEnvironment] = None, quiet: bool = False) -> List[str]: + def _generate_poetry_install_command( + self, sync_target_environment: Optional[PythonEnvironment] = None, quiet: bool = False + ) -> List[str]: command: List[str] = ["install"] if sync_target_environment: command.append(get_verb("--sync", sync_target_environment)) From 5d682bcf6a734ef0e950b76b9e797124cba908f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Pich=C3=A9?= Date: Thu, 17 Oct 2024 12:46:29 -0400 Subject: [PATCH 3/3] adjust docs it was done during stew ci for a while, just not for new envs --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2700863..f56c236 100644 --- a/README.md +++ b/README.md @@ -229,8 +229,8 @@ quick = {} - **pydev**: See the [multiple-libraries](README_MULTIPLE_LIBRARIES.md) guide. - **build-dependencies**: You can specify additional dependencies to be installed during `stew build`. - The format is the same as poetry dependencies: `name = "version"` or `name = { version = "version", ... }` -- **extras**: A list of extras to install during `stew build` (and `stew ci`: added in *v3.0.33*). -- **all-extras**: If true, all extras will be installed during `stew build` (and `stew ci`: added in *v3.0.33*). Overrides the `extras` list. +- **extras**: A list of extras to install during `stew build` and `stew ci`. +- **all-extras**: If true, all extras will be installed during `stew build` and `stew ci`. Overrides the `extras` list. - **quick**: *(v3.0.30)* Controls which checks are skipped when calling `stew ci --quick`. - The format is a dictionary with either the `check` or `skip` key, followed by a list of runners. - The behavior is identical to the `--check` and `--skip` options.