From d80d9a49f7c8122988bf12eae1792fd630c21e7f Mon Sep 17 00:00:00 2001 From: davidvujic Date: Wed, 1 Feb 2023 18:40:35 +0100 Subject: [PATCH 1/3] fix(create project): missing description parameter to the create command + description option --- .../poetry/commands/create_project.py | 7 ++++++ components/polylith/project/create.py | 22 ++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/components/polylith/poetry/commands/create_project.py b/components/polylith/poetry/commands/create_project.py index 2c473b0e..b9c5ea9e 100644 --- a/components/polylith/poetry/commands/create_project.py +++ b/components/polylith/poetry/commands/create_project.py @@ -12,6 +12,13 @@ class CreateProjectCommand(Command): options = [ option("name", None, "Name of the project.", flag=False), + option( + "description", + None, + "Description of the project.", + flag=False, + value_required=False, + ), ] def handle(self) -> int: diff --git a/components/polylith/project/create.py b/components/polylith/project/create.py index 3a236f17..c26a12ad 100644 --- a/components/polylith/project/create.py +++ b/components/polylith/project/create.py @@ -1,4 +1,5 @@ from pathlib import Path +from typing import Union import tomlkit from polylith import repo @@ -9,7 +10,7 @@ [tool.poetry] name = "{name}" version = "0.1.0" -description = "" +description = "{description}" authors = {authors} license = "" @@ -33,20 +34,31 @@ def get_workspace_toml(path: Path) -> dict: return data -def create_project_toml(name, template, workspace_toml) -> tomlkit.TOMLDocument: +def create_project_toml( + name: str, template: str, workspace_toml: dict, description: str +) -> tomlkit.TOMLDocument: authors = workspace_toml["tool"]["poetry"]["authors"] python_version = workspace_toml["tool"]["poetry"]["dependencies"]["python"] - content = template.format(name=name, authors=authors, python_version=python_version) + content = template.format( + name=name, + description=description, + authors=authors, + python_version=python_version, + ) return tomlkit.loads(content) -def create_project(path: Path, namespace: str, name: str) -> None: +def create_project( + path: Path, namespace: str, name: str, description: Union[str, None] +) -> None: d = create_dir(path, f"{projects_dir}/{name}") workspace_toml = get_workspace_toml(path) - project_toml = create_project_toml(name, template, workspace_toml) + project_toml = create_project_toml( + name, template, workspace_toml, description or "" + ) fullpath = d / repo.default_toml From ef8047d260b15035b79c36251e61646145a64478 Mon Sep 17 00:00:00 2001 From: davidvujic Date: Wed, 1 Feb 2023 18:42:55 +0100 Subject: [PATCH 2/3] docs(description): add docs about the description option to also include projects --- projects/poetry_polylith_plugin/README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/projects/poetry_polylith_plugin/README.md b/projects/poetry_polylith_plugin/README.md index 1c436ce6..27d612f8 100644 --- a/projects/poetry_polylith_plugin/README.md +++ b/projects/poetry_polylith_plugin/README.md @@ -58,11 +58,6 @@ Add a base: poetry poly create base --name my_example_aws_lambda ``` -##### Options -`--description` -Add a brick description. Will be added as a docstring, and in the brick-specific README -(if it is enabled in the `resources` section of the workspace config). - Add a project: ``` shell @@ -70,6 +65,12 @@ Add a project: poetry poly create project --name my_example_aws_lambada_project ``` +##### Options +`--description` +Add a brick description. The description will be added as a docstring. +Also in the brick-specific README (when set to enabled in the `resources` section of the workspace config). + + #### Info Show info about the workspace: From 8f56faba194bb9b0d1b3e15e9967607e3b7ee27d Mon Sep 17 00:00:00 2001 From: davidvujic Date: Wed, 1 Feb 2023 18:43:17 +0100 Subject: [PATCH 3/3] bump version to 1.2.1 --- projects/poetry_polylith_plugin/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/poetry_polylith_plugin/pyproject.toml b/projects/poetry_polylith_plugin/pyproject.toml index 83351bfb..9296961d 100644 --- a/projects/poetry_polylith_plugin/pyproject.toml +++ b/projects/poetry_polylith_plugin/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "poetry-polylith-plugin" -version = "1.2.0" +version = "1.2.1" description = "A Poetry plugin that adds tooling support for the Polylith Architecture" authors = ["David Vujic"] homepage = "https://github.com/davidvujic/python-polylith"