polylith-cli 1.49.1__tar.gz → 1.50.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/PKG-INFO +1 -1
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/cli/test.py +2 -2
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/commands/test.py +21 -3
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/test/__init__.py +2 -2
- polylith_cli-1.50.0/polylith_cli/polylith/test/core.py +51 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/pyproject.toml +1 -1
- polylith_cli-1.49.1/polylith_cli/polylith/test/core.py +0 -23
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/README.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/README.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/README.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-analyze-imports/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-automate-import-updates/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-convert-linter/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-convert-package-manager/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-convert-type-checker/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-dedupe/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-definition-of-done/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-detect-circular-imports/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-discover/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-distribute-wiring/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-extract-standalone-modules/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-extract-to-base/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-generate-shim/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-isolate-base-and-big-component/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-isolate-shared-and-project-logic/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-orchestrator/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-prepare-project/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-refactor-tests/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-resolve-circular-imports/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-split-big-component/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-split-component-internals/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-update-tests/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-verify-stability/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-base-creation/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-brick-removal/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-check/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-component-creation/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-concepts/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-dependency-management/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-dependency-visualization/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-diff/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-libs/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-project-management/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-sync/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-testing/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-workspace-inspection/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-workspace-setup/SKILL.md +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/alias/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/alias/core.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/bricks/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/bricks/base.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/bricks/brick.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/bricks/component.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/building/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/building/core.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/building/paths.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/check/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/check/collect.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/check/report.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/cli/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/cli/__main__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/cli/build.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/cli/core.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/cli/create.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/cli/env.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/cli/options.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/commands/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/commands/check.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/commands/create.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/commands/deps.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/commands/diff.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/commands/info.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/commands/libs.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/commands/sync.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/configuration/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/configuration/core.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/deps/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/deps/core.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/deps/report.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/development/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/development/development.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/diff/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/diff/collect.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/diff/report.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/dirs/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/dirs/dirs.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/distributions/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/distributions/caching.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/distributions/collect.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/distributions/core.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/environment/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/environment/core.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/files/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/files/files.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/imports/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/imports/grouping.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/imports/parser.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/imports/usages.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/info/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/info/collect.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/info/report.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/interactive/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/interactive/project.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/interface/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/interface/collect.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/interface/interfaces.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/interface/parser.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/interface/report.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/interface/usage.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/libs/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/libs/grouping.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/libs/lock_files.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/libs/report.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/libs/stdlib.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/output/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/output/core.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/parsing/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/parsing/core.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/parsing/rewrite.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/project/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/project/create.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/project/get.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/project/parser.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/project/templates.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/readme/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/readme/readme.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/repo/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/repo/get.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/repo/repo.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/reporting/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/reporting/theme.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/sync/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/sync/collect.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/sync/report.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/sync/update.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/test/report.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/test/tests.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/toml/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/toml/core.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/workspace/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/workspace/create.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/workspace/paths.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/yaml/__init__.py +0 -0
- {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/yaml/core.py +0 -0
|
@@ -6,7 +6,7 @@ from typing_extensions import Annotated
|
|
|
6
6
|
app = Typer()
|
|
7
7
|
|
|
8
8
|
@app.command('diff')
|
|
9
|
-
def diff_command(since: Annotated[str, Option(help='Changed since a specific tag.')]='', short: Annotated[bool, options.short]=False, bricks: Annotated[bool, Option(help='Bricks affected by changes in tests')]=False, projects: Annotated[bool, Option(help='Projects affected by changes in tests')]=False):
|
|
9
|
+
def diff_command(since: Annotated[str, Option(help='Changed since a specific tag.')]='', short: Annotated[bool, options.short]=False, bricks: Annotated[bool, Option(help='Bricks affected by changes in tests')]=False, projects: Annotated[bool, Option(help='Projects affected by changes in tests')]=False, strategy: Annotated[str, Option(help="By 'imports' (the bricks used in tests) or by 'path' (the corresponding bricks).")]='imports'):
|
|
10
10
|
"""Shows the Polylith projects and bricks that are affected by changes in tests."""
|
|
11
11
|
root = repo.get_workspace_root(Path.cwd())
|
|
12
12
|
ns = configuration.get_namespace_from_config(root)
|
|
@@ -14,5 +14,5 @@ def diff_command(since: Annotated[str, Option(help='Changed since a specific tag
|
|
|
14
14
|
if not tag:
|
|
15
15
|
print('No matching tags or commits found in repository.')
|
|
16
16
|
return
|
|
17
|
-
options = {'short': short, 'bricks': bricks, 'projects': projects}
|
|
17
|
+
options = {'short': short, 'bricks': bricks, 'projects': projects, 'strategy': strategy}
|
|
18
18
|
commands.test.run(root, ns, tag, options)
|
|
@@ -7,8 +7,8 @@ def get_imported_bricks_in_tests(root: Path, ns: str, tag_name: Union[str, None]
|
|
|
7
7
|
brick_imports = test.get_brick_imports_in_tests(root, ns, theme, files)
|
|
8
8
|
return set().union(*brick_imports.values())
|
|
9
9
|
|
|
10
|
-
def extract_brick_names(bricks_data: List[dict],
|
|
11
|
-
return {v for b in bricks_data for v in b.values() if v in
|
|
10
|
+
def extract_brick_names(bricks_data: List[dict], possible_bricks: Set[str]) -> Set[str]:
|
|
11
|
+
return {v for b in bricks_data for v in b.values() if v in possible_bricks}
|
|
12
12
|
|
|
13
13
|
def get_affected_bricks(root: Path, ns: str, tag_name: Union[str, None], theme: str) -> Tuple[Set[str], Set[str]]:
|
|
14
14
|
found = get_imported_bricks_in_tests(root, ns, tag_name, theme)
|
|
@@ -16,14 +16,32 @@ def get_affected_bricks(root: Path, ns: str, tag_name: Union[str, None], theme:
|
|
|
16
16
|
components = extract_brick_names(dirs.get_components_data(root, ns), found)
|
|
17
17
|
return (bases, components)
|
|
18
18
|
|
|
19
|
+
def get_related_bricks(root: Path, ns: str, tag_name: Union[str, None], theme: str) -> Tuple[Set[str], Set[str]]:
|
|
20
|
+
files = test.get_changed_files(root, tag_name)
|
|
21
|
+
related = test.get_related_bricks(root, ns, theme, files)
|
|
22
|
+
bases = extract_brick_names(dirs.get_bases_data(root, ns), related['bases'])
|
|
23
|
+
components = extract_brick_names(dirs.get_components_data(root, ns), related['components'])
|
|
24
|
+
return (bases, components)
|
|
25
|
+
|
|
19
26
|
def get_affected_projects(root: Path, ns: str, bases: Set[str], components: Set[str]) -> List[dict]:
|
|
20
27
|
projects_data = [p for p in info.get_projects_data(root, ns) if info.is_project(p)]
|
|
21
28
|
names = diff.collect.get_projects_affected_by_changes(projects_data, [], list(bases), list(components))
|
|
22
29
|
return [p for p in projects_data if p['path'].name in names]
|
|
23
30
|
|
|
31
|
+
def parse_strategy(strategy: str) -> List[str]:
|
|
32
|
+
strategies = str.split(strategy, ',')
|
|
33
|
+
return [str.lower(s) for s in strategies]
|
|
34
|
+
|
|
24
35
|
def run(root: Path, ns: str, tag: str, options: dict) -> None:
|
|
25
36
|
theme = configuration.get_theme_from_config(root)
|
|
26
|
-
|
|
37
|
+
strategy = parse_strategy(options['strategy'])
|
|
38
|
+
by_imports = 'imports' in strategy
|
|
39
|
+
by_path = 'path' in strategy
|
|
40
|
+
fallback: Tuple[Set[str], Set[str]] = (set(), set())
|
|
41
|
+
affected = get_affected_bricks(root, ns, tag, theme) if by_imports else fallback
|
|
42
|
+
related = get_related_bricks(root, ns, tag, theme) if by_path else fallback
|
|
43
|
+
bases = set().union(affected[0], related[0])
|
|
44
|
+
components = set().union(affected[1], related[1])
|
|
27
45
|
projects_data = get_affected_projects(root, ns, bases, components)
|
|
28
46
|
if options.get('bricks'):
|
|
29
47
|
test.report.print_detected_changes_affecting_bricks(bases, components, options)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
from polylith_cli.polylith.test import report
|
|
2
|
-
from polylith_cli.polylith.test.core import get_brick_imports_in_tests, get_changed_files
|
|
2
|
+
from polylith_cli.polylith.test.core import get_brick_imports_in_tests, get_changed_files, get_related_bricks
|
|
3
3
|
from polylith_cli.polylith.test.tests import create_test
|
|
4
|
-
__all__ = ['report', 'create_test', 'get_brick_imports_in_tests', 'get_changed_files']
|
|
4
|
+
__all__ = ['report', 'create_test', 'get_brick_imports_in_tests', 'get_changed_files', 'get_related_bricks']
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from typing import List, Set, Union
|
|
3
|
+
from polylith_cli.polylith import diff, imports
|
|
4
|
+
|
|
5
|
+
def is_test(root: Path, ns: str, path: Path, theme: str) -> bool:
|
|
6
|
+
expected = 'test'
|
|
7
|
+
file_path = path.as_posix()
|
|
8
|
+
if theme == 'loose':
|
|
9
|
+
test_path = Path(root / f'{expected}/').as_posix()
|
|
10
|
+
return str.startswith(file_path, test_path)
|
|
11
|
+
return f'/{expected}/{ns}' in file_path
|
|
12
|
+
|
|
13
|
+
def extract_parts_from_test_path(root: Path, path: Path) -> List[str]:
|
|
14
|
+
relative_path = str.replace(path.as_posix(), root.as_posix(), '')
|
|
15
|
+
parts = str.split(relative_path, '/')
|
|
16
|
+
return [p for p in parts if p]
|
|
17
|
+
|
|
18
|
+
def extract_brick_type_from_test(root: Path, path: Path, theme: str) -> str:
|
|
19
|
+
parts = extract_parts_from_test_path(root, path)
|
|
20
|
+
return parts[1] if theme == 'loose' else parts[0]
|
|
21
|
+
|
|
22
|
+
def extract_brick_name_from_test(root: Path, path: Path, theme: str) -> str:
|
|
23
|
+
parts = extract_parts_from_test_path(root, path)
|
|
24
|
+
return parts[3] if theme == 'loose' else parts[1]
|
|
25
|
+
|
|
26
|
+
def find_tests(root: Path, ns: str, theme: str, files: List[Path]) -> Set[Path]:
|
|
27
|
+
return {f for f in files if is_test(root, ns, f, theme)}
|
|
28
|
+
|
|
29
|
+
def get_changed_files(root: Path, tag_name: Union[str, None]) -> List[Path]:
|
|
30
|
+
tag = diff.collect.get_latest_tag(root, tag_name) or tag_name
|
|
31
|
+
if not tag:
|
|
32
|
+
return []
|
|
33
|
+
return [root / f for f in diff.collect.get_files(tag)]
|
|
34
|
+
|
|
35
|
+
def get_brick_imports_in_tests(root: Path, ns: str, theme: str, files: List[Path]) -> dict:
|
|
36
|
+
matched = find_tests(root, ns, theme, files)
|
|
37
|
+
listed_imports = [imports.list_imports(m) for m in matched]
|
|
38
|
+
all_imports = dict(enumerate(listed_imports))
|
|
39
|
+
return imports.extract_brick_imports(all_imports, ns)
|
|
40
|
+
|
|
41
|
+
def get_related_brick(root: Path, path: Path, theme: str) -> dict:
|
|
42
|
+
brick_name = extract_brick_name_from_test(root, path, theme)
|
|
43
|
+
brick_type = extract_brick_type_from_test(root, path, theme)
|
|
44
|
+
return {'name': brick_name, 'type': brick_type}
|
|
45
|
+
|
|
46
|
+
def get_related_bricks(root: Path, ns: str, theme: str, files: List[Path]) -> dict:
|
|
47
|
+
matched = find_tests(root, ns, theme, files)
|
|
48
|
+
bricks = [get_related_brick(root, m, theme) for m in matched]
|
|
49
|
+
bases = {b['name'] for b in bricks if b['type'] == 'bases'}
|
|
50
|
+
components = {b['name'] for b in bricks if b['type'] == 'components'}
|
|
51
|
+
return {'bases': bases, 'components': components}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
from pathlib import Path
|
|
2
|
-
from typing import List, Union
|
|
3
|
-
from polylith_cli.polylith import diff, imports
|
|
4
|
-
|
|
5
|
-
def is_test(root: Path, ns: str, path: Path, theme: str) -> bool:
|
|
6
|
-
expected = 'test'
|
|
7
|
-
file_path = path.as_posix()
|
|
8
|
-
if theme == 'loose':
|
|
9
|
-
test_path = Path(root / f'{expected}/').as_posix()
|
|
10
|
-
return str.startswith(file_path, test_path)
|
|
11
|
-
return f'/{expected}/{ns}' in file_path
|
|
12
|
-
|
|
13
|
-
def get_changed_files(root: Path, tag_name: Union[str, None]) -> List[Path]:
|
|
14
|
-
tag = diff.collect.get_latest_tag(root, tag_name) or tag_name
|
|
15
|
-
if not tag:
|
|
16
|
-
return []
|
|
17
|
-
return [root / f for f in diff.collect.get_files(tag)]
|
|
18
|
-
|
|
19
|
-
def get_brick_imports_in_tests(root: Path, ns: str, theme: str, files: List[Path]) -> dict:
|
|
20
|
-
matched = {f for f in files if is_test(root, ns, f, theme)}
|
|
21
|
-
listed_imports = [imports.list_imports(m) for m in matched]
|
|
22
|
-
all_imports = dict(enumerate(listed_imports))
|
|
23
|
-
return imports.extract_brick_imports(all_imports, ns)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/development/development.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|