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.
Files changed (144) hide show
  1. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/PKG-INFO +1 -1
  2. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/cli/test.py +2 -2
  3. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/commands/test.py +21 -3
  4. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/test/__init__.py +2 -2
  5. polylith_cli-1.50.0/polylith_cli/polylith/test/core.py +51 -0
  6. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/pyproject.toml +1 -1
  7. polylith_cli-1.49.1/polylith_cli/polylith/test/core.py +0 -23
  8. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/README.md +0 -0
  9. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/README.md +0 -0
  10. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/README.md +0 -0
  11. {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
  12. {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
  13. {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
  14. {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
  15. {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
  16. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-dedupe/SKILL.md +0 -0
  17. {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
  18. {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
  19. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-discover/SKILL.md +0 -0
  20. {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
  21. {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
  22. {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
  23. {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
  24. {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
  25. {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
  26. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/migrate-project/polylith-migrate-orchestrator/SKILL.md +0 -0
  27. {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
  28. {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
  29. {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
  30. {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
  31. {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
  32. {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
  33. {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
  34. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-base-creation/SKILL.md +0 -0
  35. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-brick-removal/SKILL.md +0 -0
  36. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-check/SKILL.md +0 -0
  37. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-component-creation/SKILL.md +0 -0
  38. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-concepts/SKILL.md +0 -0
  39. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-dependency-management/SKILL.md +0 -0
  40. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-dependency-visualization/SKILL.md +0 -0
  41. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-diff/SKILL.md +0 -0
  42. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-libs/SKILL.md +0 -0
  43. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-project-management/SKILL.md +0 -0
  44. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-sync/SKILL.md +0 -0
  45. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-testing/SKILL.md +0 -0
  46. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-workspace-inspection/SKILL.md +0 -0
  47. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/.agents/skills/polylith/polylith-workspace-setup/SKILL.md +0 -0
  48. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/alias/__init__.py +0 -0
  49. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/alias/core.py +0 -0
  50. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/bricks/__init__.py +0 -0
  51. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/bricks/base.py +0 -0
  52. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/bricks/brick.py +0 -0
  53. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/bricks/component.py +0 -0
  54. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/building/__init__.py +0 -0
  55. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/building/core.py +0 -0
  56. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/building/paths.py +0 -0
  57. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/check/__init__.py +0 -0
  58. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/check/collect.py +0 -0
  59. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/check/report.py +0 -0
  60. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/cli/__init__.py +0 -0
  61. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/cli/__main__.py +0 -0
  62. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/cli/build.py +0 -0
  63. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/cli/core.py +0 -0
  64. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/cli/create.py +0 -0
  65. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/cli/env.py +0 -0
  66. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/cli/options.py +0 -0
  67. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/commands/__init__.py +0 -0
  68. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/commands/check.py +0 -0
  69. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/commands/create.py +0 -0
  70. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/commands/deps.py +0 -0
  71. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/commands/diff.py +0 -0
  72. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/commands/info.py +0 -0
  73. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/commands/libs.py +0 -0
  74. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/commands/sync.py +0 -0
  75. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/configuration/__init__.py +0 -0
  76. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/configuration/core.py +0 -0
  77. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/deps/__init__.py +0 -0
  78. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/deps/core.py +0 -0
  79. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/deps/report.py +0 -0
  80. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/development/__init__.py +0 -0
  81. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/development/development.py +0 -0
  82. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/diff/__init__.py +0 -0
  83. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/diff/collect.py +0 -0
  84. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/diff/report.py +0 -0
  85. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/dirs/__init__.py +0 -0
  86. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/dirs/dirs.py +0 -0
  87. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/distributions/__init__.py +0 -0
  88. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/distributions/caching.py +0 -0
  89. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/distributions/collect.py +0 -0
  90. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/distributions/core.py +0 -0
  91. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/environment/__init__.py +0 -0
  92. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/environment/core.py +0 -0
  93. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/files/__init__.py +0 -0
  94. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/files/files.py +0 -0
  95. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/imports/__init__.py +0 -0
  96. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/imports/grouping.py +0 -0
  97. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/imports/parser.py +0 -0
  98. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/imports/usages.py +0 -0
  99. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/info/__init__.py +0 -0
  100. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/info/collect.py +0 -0
  101. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/info/report.py +0 -0
  102. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/interactive/__init__.py +0 -0
  103. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/interactive/project.py +0 -0
  104. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/interface/__init__.py +0 -0
  105. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/interface/collect.py +0 -0
  106. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/interface/interfaces.py +0 -0
  107. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/interface/parser.py +0 -0
  108. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/interface/report.py +0 -0
  109. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/interface/usage.py +0 -0
  110. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/libs/__init__.py +0 -0
  111. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/libs/grouping.py +0 -0
  112. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/libs/lock_files.py +0 -0
  113. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/libs/report.py +0 -0
  114. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/libs/stdlib.py +0 -0
  115. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/output/__init__.py +0 -0
  116. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/output/core.py +0 -0
  117. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/parsing/__init__.py +0 -0
  118. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/parsing/core.py +0 -0
  119. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/parsing/rewrite.py +0 -0
  120. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/project/__init__.py +0 -0
  121. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/project/create.py +0 -0
  122. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/project/get.py +0 -0
  123. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/project/parser.py +0 -0
  124. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/project/templates.py +0 -0
  125. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/readme/__init__.py +0 -0
  126. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/readme/readme.py +0 -0
  127. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/repo/__init__.py +0 -0
  128. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/repo/get.py +0 -0
  129. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/repo/repo.py +0 -0
  130. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/reporting/__init__.py +0 -0
  131. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/reporting/theme.py +0 -0
  132. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/sync/__init__.py +0 -0
  133. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/sync/collect.py +0 -0
  134. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/sync/report.py +0 -0
  135. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/sync/update.py +0 -0
  136. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/test/report.py +0 -0
  137. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/test/tests.py +0 -0
  138. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/toml/__init__.py +0 -0
  139. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/toml/core.py +0 -0
  140. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/workspace/__init__.py +0 -0
  141. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/workspace/create.py +0 -0
  142. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/workspace/paths.py +0 -0
  143. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/yaml/__init__.py +0 -0
  144. {polylith_cli-1.49.1 → polylith_cli-1.50.0}/polylith_cli/polylith/yaml/core.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polylith-cli
3
- Version: 1.49.1
3
+ Version: 1.50.0
4
4
  Summary: Python tooling support for the Polylith Architecture
5
5
  License: MIT
6
6
  Author: David Vujic
@@ -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], imported_bricks: Set[str]) -> Set[str]:
11
- return {v for b in bricks_data for v in b.values() if v in imported_bricks}
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
- bases, components = get_affected_bricks(root, ns, tag, theme)
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,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "polylith-cli"
3
- version = "1.49.1"
3
+ version = "1.50.0"
4
4
  description = "Python tooling support for the Polylith Architecture"
5
5
  authors = ['David Vujic']
6
6
  homepage = "https://davidvujic.github.io/python-polylith-docs/"
@@ -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