diff --git a/README.md b/README.md index c12ce50..a0d32b7 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,13 @@ the `poetry check-project` command will: 6. remove the temporary folder. +The default setting for the underlying `MyPy` configuration is: + +``` shell +--explicit-package-bases --namespace-packages --no-error-summary --no-color-output +``` + + ## How is it different from the "poetry build" command? Poetry does not allow package includes outside of the __project__ root. diff --git a/poetry_multiproject_plugin/commands/checkproject/check.py b/poetry_multiproject_plugin/commands/checkproject/check.py index d60f32a..56ce2c4 100644 --- a/poetry_multiproject_plugin/commands/checkproject/check.py +++ b/poetry_multiproject_plugin/commands/checkproject/check.py @@ -4,7 +4,7 @@ from cleo.helpers import option from cleo.io.outputs.output import Verbosity -from poetry.console.commands.build import BuildCommand +from poetry.console.commands.command import Command from poetry.factory import Factory from poetry_multiproject_plugin.components.check import check_for_errors @@ -31,7 +31,7 @@ def run_check(destination: Path, pyproj: str, config_file: str) -> List[str]: return [row.replace(dest, "") for row in flattened] -class ProjectCheckCommand(BuildCommand): +class ProjectCheckCommand(Command): name = command_name options = [ @@ -65,14 +65,13 @@ def handle(self): self.prepare_for_build(project_path.absolute()) self.io.set_verbosity(Verbosity.QUIET) - super(ProjectCheckCommand, self).handle() - - mypy_config = self.option("config-file") cleanup.remove_file(project_path, "poetry.lock") + cleanup.remove_file(project_path, "poetry.toml") install_deps(project_path) + mypy_config = self.option("config-file") res = run_check(project_path, pyproj, mypy_config) self.io.set_verbosity(Verbosity.NORMAL) diff --git a/poetry_multiproject_plugin/components/deps/installer.py b/poetry_multiproject_plugin/components/deps/installer.py index ec97836..a44db7b 100644 --- a/poetry_multiproject_plugin/components/deps/installer.py +++ b/poetry_multiproject_plugin/components/deps/installer.py @@ -3,6 +3,11 @@ from pathlib import Path +def ensure_reusable_venv(): + subprocess.run(["poetry", "config", "--local", "virtualenvs.in-project", "false"]) + subprocess.run(["poetry", "config", "--local", "virtualenvs.path", "--unset"]) + + def run_install_command(): subprocess.run(["poetry", "install", "--only", "main", "--quiet"]) @@ -15,6 +20,7 @@ def install_deps(destination: Path): current_dir = Path.cwd() navigate_to(destination) + ensure_reusable_venv() run_install_command() navigate_to(current_dir) diff --git a/poetry_multiproject_plugin/components/project/cleanup.py b/poetry_multiproject_plugin/components/project/cleanup.py index 17655e6..7ed966f 100644 --- a/poetry_multiproject_plugin/components/project/cleanup.py +++ b/poetry_multiproject_plugin/components/project/cleanup.py @@ -8,4 +8,7 @@ def remove_project(project_path: Path): def remove_file(project_path: Path, file_name: str): - os.remove(project_path / file_name) + try: + os.remove(project_path / file_name) + except FileNotFoundError: + pass diff --git a/pyproject.toml b/pyproject.toml index 8a33d08..a96e769 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "poetry-multiproject-plugin" -version = "1.1.1" +version = "1.1.2" description = "A Poetry plugin that makes it possible to use relative package includes." authors = ["David Vujic"] homepage = "https://github.com/davidvujic/poetry-multiproject-plugin"