codeplain 0.2.3__tar.gz → 0.2.4__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 (189) hide show
  1. {codeplain-0.2.3 → codeplain-0.2.4}/.gitignore +3 -1
  2. {codeplain-0.2.3 → codeplain-0.2.4}/PKG-INFO +1 -1
  3. {codeplain-0.2.3 → codeplain-0.2.4}/codeplain_REST_api.py +0 -6
  4. {codeplain-0.2.3 → codeplain-0.2.4}/git_utils.py +1 -6
  5. {codeplain-0.2.3 → codeplain-0.2.4}/install.sh +1 -1
  6. {codeplain-0.2.3 → codeplain-0.2.4}/plain2code.py +5 -12
  7. {codeplain-0.2.3 → codeplain-0.2.4}/plain2code_exceptions.py +16 -6
  8. {codeplain-0.2.3 → codeplain-0.2.4}/plain_file.py +14 -36
  9. {codeplain-0.2.3 → codeplain-0.2.4}/plain_modules.py +1 -4
  10. {codeplain-0.2.3 → codeplain-0.2.4}/plain_spec.py +2 -4
  11. {codeplain-0.2.3 → codeplain-0.2.4}/pyproject.toml +1 -1
  12. {codeplain-0.2.3 → codeplain-0.2.4}/tests/test_plainfile.py +1 -1
  13. {codeplain-0.2.3 → codeplain-0.2.4}/tests/test_requires.py +2 -1
  14. {codeplain-0.2.3 → codeplain-0.2.4}/.flake8 +0 -0
  15. {codeplain-0.2.3 → codeplain-0.2.4}/.github/workflows/lint-and-test.yml +0 -0
  16. {codeplain-0.2.3 → codeplain-0.2.4}/.github/workflows/nofity-slack-on-main-merge.yml +0 -0
  17. {codeplain-0.2.3 → codeplain-0.2.4}/.github/workflows/publish-install-script.yml +0 -0
  18. {codeplain-0.2.3 → codeplain-0.2.4}/.github/workflows/publish-to-pypi.yml +0 -0
  19. {codeplain-0.2.3 → codeplain-0.2.4}/.vscode/launch.json +0 -0
  20. {codeplain-0.2.3 → codeplain-0.2.4}/.vscode/settings.json +0 -0
  21. {codeplain-0.2.3 → codeplain-0.2.4}/LICENSE +0 -0
  22. {codeplain-0.2.3 → codeplain-0.2.4}/README.md +0 -0
  23. {codeplain-0.2.3 → codeplain-0.2.4}/concept_utils.py +0 -0
  24. {codeplain-0.2.3 → codeplain-0.2.4}/config/__init__.py +0 -0
  25. {codeplain-0.2.3 → codeplain-0.2.4}/config/system_config.yaml +0 -0
  26. {codeplain-0.2.3 → codeplain-0.2.4}/diff_utils.py +0 -0
  27. {codeplain-0.2.3 → codeplain-0.2.4}/docs/generate_cli.py +0 -0
  28. {codeplain-0.2.3 → codeplain-0.2.4}/docs/plain2code_cli.md +0 -0
  29. {codeplain-0.2.3 → codeplain-0.2.4}/docs/plain_language_specification.md +0 -0
  30. {codeplain-0.2.3 → codeplain-0.2.4}/docs/starting_a_plain_project_from_scratch.md +0 -0
  31. {codeplain-0.2.3 → codeplain-0.2.4}/event_bus.py +0 -0
  32. {codeplain-0.2.3 → codeplain-0.2.4}/examples/example_hello_world_golang/config.yaml +0 -0
  33. {codeplain-0.2.3 → codeplain-0.2.4}/examples/example_hello_world_golang/harness_tests/hello_world_test.go +0 -0
  34. {codeplain-0.2.3 → codeplain-0.2.4}/examples/example_hello_world_golang/hello_world_golang.plain +0 -0
  35. {codeplain-0.2.3 → codeplain-0.2.4}/examples/example_hello_world_golang/run.sh +0 -0
  36. {codeplain-0.2.3 → codeplain-0.2.4}/examples/example_hello_world_python/config.yaml +0 -0
  37. {codeplain-0.2.3 → codeplain-0.2.4}/examples/example_hello_world_python/harness_tests/hello_world_display/test_hello_world.py +0 -0
  38. {codeplain-0.2.3 → codeplain-0.2.4}/examples/example_hello_world_python/hello_world_python.plain +0 -0
  39. {codeplain-0.2.3 → codeplain-0.2.4}/examples/example_hello_world_python/run.sh +0 -0
  40. {codeplain-0.2.3 → codeplain-0.2.4}/examples/example_hello_world_react/harness_tests/hello_world_display/cypress/e2e/hello_world.cy.ts +0 -0
  41. {codeplain-0.2.3 → codeplain-0.2.4}/examples/example_hello_world_react/harness_tests/hello_world_display/cypress/support/e2e.ts +0 -0
  42. {codeplain-0.2.3 → codeplain-0.2.4}/examples/example_hello_world_react/harness_tests/hello_world_display/cypress.config.ts +0 -0
  43. {codeplain-0.2.3 → codeplain-0.2.4}/examples/example_hello_world_react/harness_tests/hello_world_display/package.json +0 -0
  44. {codeplain-0.2.3 → codeplain-0.2.4}/examples/example_hello_world_react/harness_tests/hello_world_display/tsconfig.json +0 -0
  45. {codeplain-0.2.3 → codeplain-0.2.4}/examples/example_hello_world_react/hello_world_react.plain +0 -0
  46. {codeplain-0.2.3 → codeplain-0.2.4}/examples/example_hello_world_react/run.sh +0 -0
  47. {codeplain-0.2.3 → codeplain-0.2.4}/examples/run.sh +0 -0
  48. {codeplain-0.2.3 → codeplain-0.2.4}/file_utils.py +0 -0
  49. {codeplain-0.2.3 → codeplain-0.2.4}/hash_key.py +0 -0
  50. {codeplain-0.2.3 → codeplain-0.2.4}/memory_management.py +0 -0
  51. {codeplain-0.2.3 → codeplain-0.2.4}/module_renderer.py +0 -0
  52. {codeplain-0.2.3 → codeplain-0.2.4}/plain2code_arguments.py +0 -0
  53. {codeplain-0.2.3 → codeplain-0.2.4}/plain2code_console.py +0 -0
  54. {codeplain-0.2.3 → codeplain-0.2.4}/plain2code_events.py +0 -0
  55. {codeplain-0.2.3 → codeplain-0.2.4}/plain2code_logger.py +0 -0
  56. {codeplain-0.2.3 → codeplain-0.2.4}/plain2code_nodes.py +0 -0
  57. {codeplain-0.2.3 → codeplain-0.2.4}/plain2code_read_config.py +0 -0
  58. {codeplain-0.2.3 → codeplain-0.2.4}/plain2code_state.py +0 -0
  59. {codeplain-0.2.3 → codeplain-0.2.4}/plain2code_utils.py +0 -0
  60. {codeplain-0.2.3 → codeplain-0.2.4}/pytest.ini +0 -0
  61. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/__init__.py +0 -0
  62. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/actions/analyze_specification_ambiguity.py +0 -0
  63. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/actions/base_action.py +0 -0
  64. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/actions/commit_conformance_tests_changes.py +0 -0
  65. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/actions/commit_implementation_code_changes.py +0 -0
  66. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/actions/create_dist.py +0 -0
  67. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/actions/exit_with_error.py +0 -0
  68. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/actions/finish_functional_requirement.py +0 -0
  69. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/actions/fix_conformance_test.py +0 -0
  70. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/actions/fix_unit_tests.py +0 -0
  71. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/actions/prepare_repositories.py +0 -0
  72. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/actions/prepare_testing_environment.py +0 -0
  73. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/actions/refactor_code.py +0 -0
  74. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/actions/render_conformance_tests.py +0 -0
  75. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/actions/render_functional_requirement.py +0 -0
  76. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/actions/run_conformance_tests.py +0 -0
  77. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/actions/run_unit_tests.py +0 -0
  78. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/actions/summarize_conformance_tests.py +0 -0
  79. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/code_renderer.py +0 -0
  80. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/conformance_test_helpers.py +0 -0
  81. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/conformance_tests.py +0 -0
  82. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/implementation_code_helpers.py +0 -0
  83. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/render_context.py +0 -0
  84. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/render_types.py +0 -0
  85. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/render_utils.py +0 -0
  86. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/state_machine_config.py +0 -0
  87. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/states.py +0 -0
  88. {codeplain-0.2.3 → codeplain-0.2.4}/render_machine/triggers.py +0 -0
  89. {codeplain-0.2.3 → codeplain-0.2.4}/requirements.txt +0 -0
  90. {codeplain-0.2.3 → codeplain-0.2.4}/resources/codeplain_overview.png +0 -0
  91. {codeplain-0.2.3 → codeplain-0.2.4}/resources/plain_example.png +0 -0
  92. {codeplain-0.2.3 → codeplain-0.2.4}/spinner.py +0 -0
  93. {codeplain-0.2.3 → codeplain-0.2.4}/standard_template_library/__init__.py +0 -0
  94. {codeplain-0.2.3 → codeplain-0.2.4}/standard_template_library/golang-console-app-template.plain +0 -0
  95. {codeplain-0.2.3 → codeplain-0.2.4}/standard_template_library/python-console-app-template.plain +0 -0
  96. {codeplain-0.2.3 → codeplain-0.2.4}/standard_template_library/typescript-react-app-boilerplate.plain +0 -0
  97. {codeplain-0.2.3 → codeplain-0.2.4}/standard_template_library/typescript-react-app-template.plain +0 -0
  98. {codeplain-0.2.3 → codeplain-0.2.4}/system_config.py +0 -0
  99. {codeplain-0.2.3 → codeplain-0.2.4}/test_scripts/run_conformance_tests_cypress.sh +0 -0
  100. {codeplain-0.2.3 → codeplain-0.2.4}/test_scripts/run_conformance_tests_golang.sh +0 -0
  101. {codeplain-0.2.3 → codeplain-0.2.4}/test_scripts/run_conformance_tests_python.sh +0 -0
  102. {codeplain-0.2.3 → codeplain-0.2.4}/test_scripts/run_unittests_golang.sh +0 -0
  103. {codeplain-0.2.3 → codeplain-0.2.4}/test_scripts/run_unittests_python.sh +0 -0
  104. {codeplain-0.2.3 → codeplain-0.2.4}/test_scripts/run_unittests_react.sh +0 -0
  105. {codeplain-0.2.3 → codeplain-0.2.4}/tests/__init__.py +0 -0
  106. {codeplain-0.2.3 → codeplain-0.2.4}/tests/conftest.py +0 -0
  107. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/imports/circular_imports_1.plain +0 -0
  108. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/imports/circular_imports_2.plain +0 -0
  109. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/imports/circular_imports_main.plain +0 -0
  110. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/imports/diamond_import_1.plain +0 -0
  111. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/imports/diamond_import_2.plain +0 -0
  112. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/imports/diamond_import_common.plain +0 -0
  113. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/imports/diamond_imports_main.plain +0 -0
  114. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/imports/non_existent_import.plain +0 -0
  115. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfile/duplicate_specification_heading.plain +0 -0
  116. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfile/invalid_specification_order.plain +0 -0
  117. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfile/missing_non_functional_requirements.plain +0 -0
  118. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfile/plain_source_with_absolute_link.plain +0 -0
  119. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfile/plain_source_with_url_link.plain +0 -0
  120. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfile/task_manager_with_reference_links.plain +0 -0
  121. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfile/without_non_functional_requirement.plain +0 -0
  122. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/concept_validation_acceptance_tests.plain +0 -0
  123. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/concept_validation_acceptance_tests_nondefined.plain +0 -0
  124. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/concept_validation_defined_nondefined.plain +0 -0
  125. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/concept_validation_defined_nondefined_2.plain +0 -0
  126. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/concept_validation_definition.plain +0 -0
  127. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/concept_validation_noconcepts.plain +0 -0
  128. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/concept_validation_nonconcept.plain +0 -0
  129. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/concept_validation_nondefined.plain +0 -0
  130. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/concept_validation_redefinition.plain +0 -0
  131. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/concept_validation_several_concepts.plain +0 -0
  132. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/concept_validation_valid.plain +0 -0
  133. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/exported_concepts.plain +0 -0
  134. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/exported_concepts_base.plain +0 -0
  135. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/exported_concepts_example.plain +0 -0
  136. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/exported_concepts_missing.plain +0 -0
  137. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/exported_concepts_missing_example.plain +0 -0
  138. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/exported_concepts_nested.plain +0 -0
  139. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/exported_concepts_nested_example.plain +0 -0
  140. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/exported_concepts_transitive_example.plain +0 -0
  141. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/exported_concepts_transitive_l1.plain +0 -0
  142. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/exported_concepts_transitive_l2.plain +0 -0
  143. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/plain_file_parser_with_comments.plain +0 -0
  144. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/plain_file_with_comments_indented.plain +0 -0
  145. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/regular_plain_source.plain +0 -0
  146. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/required_concepts.plain +0 -0
  147. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/required_concepts_defs.plain +0 -0
  148. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/required_concepts_example.plain +0 -0
  149. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/required_concepts_l1.plain +0 -0
  150. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/required_concepts_l2.plain +0 -0
  151. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/required_concepts_missing.plain +0 -0
  152. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/required_concepts_module.plain +0 -0
  153. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/required_concepts_partial.plain +0 -0
  154. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/required_concepts_partial_duplicate.plain +0 -0
  155. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/topological_sort.plain +0 -0
  156. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/plainfileparser/topological_sort_not_referenced.plain +0 -0
  157. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/requires/circular_requires_main.plain +0 -0
  158. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/requires/circular_requires_sub.plain +0 -0
  159. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/requires/diamond_requires_1.plain +0 -0
  160. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/requires/diamond_requires_2.plain +0 -0
  161. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/requires/diamond_requires_common.plain +0 -0
  162. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/requires/diamond_requires_main.plain +0 -0
  163. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/requires/independent_requires_1.plain +0 -0
  164. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/requires/independent_requires_2.plain +0 -0
  165. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/requires/independent_requires_main.plain +0 -0
  166. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/requires/non_existent_require.plain +0 -0
  167. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/requires/normal_requires_1.plain +0 -0
  168. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/requires/normal_requires_2.plain +0 -0
  169. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/requires/normal_requires_common.plain +0 -0
  170. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/requires/normal_requires_main.plain +0 -0
  171. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/simple.plain +0 -0
  172. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/templates/block_level_include.plain +0 -0
  173. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/templates/code_variables.plain +0 -0
  174. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/templates/header.plain +0 -0
  175. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/templates/implement.plain +0 -0
  176. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/templates/implement_2.plain +0 -0
  177. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/templates/template_include.plain +0 -0
  178. {codeplain-0.2.3 → codeplain-0.2.4}/tests/data/templates/test_hardest_problem.plain +0 -0
  179. {codeplain-0.2.3 → codeplain-0.2.4}/tests/test_git_utils.py +0 -0
  180. {codeplain-0.2.3 → codeplain-0.2.4}/tests/test_imports.py +0 -0
  181. {codeplain-0.2.3 → codeplain-0.2.4}/tests/test_plainfileparser.py +0 -0
  182. {codeplain-0.2.3 → codeplain-0.2.4}/tests/test_plainspec.py +0 -0
  183. {codeplain-0.2.3 → codeplain-0.2.4}/tui/__init__.py +0 -0
  184. {codeplain-0.2.3 → codeplain-0.2.4}/tui/components.py +0 -0
  185. {codeplain-0.2.3 → codeplain-0.2.4}/tui/models.py +0 -0
  186. {codeplain-0.2.3 → codeplain-0.2.4}/tui/plain2code_tui.py +0 -0
  187. {codeplain-0.2.3 → codeplain-0.2.4}/tui/state_handlers.py +0 -0
  188. {codeplain-0.2.3 → codeplain-0.2.4}/tui/styles.css +0 -0
  189. {codeplain-0.2.3 → codeplain-0.2.4}/tui/widget_helpers.py +0 -0
@@ -27,4 +27,6 @@ build
27
27
  dist
28
28
  *.egg-info
29
29
 
30
- .env
30
+ .env
31
+
32
+ .coverage
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codeplain
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Transform plain language specifications into working code
5
5
  License-File: LICENSE
6
6
  Classifier: Environment :: Console
@@ -65,12 +65,6 @@ class CodeplainAPI:
65
65
  if response_json["error_code"] == "PlainSyntaxError":
66
66
  raise plain2code_exceptions.PlainSyntaxError(response_json["message"])
67
67
 
68
- if response_json["error_code"] == "OnlyRelativeLinksAllowed":
69
- raise plain2code_exceptions.OnlyRelativeLinksAllowed(response_json["message"])
70
-
71
- if response_json["error_code"] == "LinkMustHaveTextSpecified":
72
- raise plain2code_exceptions.LinkMustHaveTextSpecified(response_json["message"])
73
-
74
68
  if response_json["error_code"] == "NoRenderFound":
75
69
  raise plain2code_exceptions.NoRenderFound(response_json["message"])
76
70
 
@@ -4,6 +4,7 @@ from typing import Optional, Union
4
4
  from git import Repo
5
5
 
6
6
  import file_utils
7
+ from plain2code_exceptions import InvalidGitRepositoryError
7
8
 
8
9
  FUNCTIONAL_REQUIREMENT_IMPLEMENTED_COMMIT_MESSAGE = (
9
10
  "[Codeplain] Implemented code and unit tests for functional requirement {}"
@@ -25,12 +26,6 @@ MODULE_NAME_MESSAGE = "Module name: {}"
25
26
  RENDER_ID_MESSAGE = "Render ID: {}"
26
27
 
27
28
 
28
- class InvalidGitRepositoryError(Exception):
29
- """Raised when the git repository is in an invalid state."""
30
-
31
- pass
32
-
33
-
34
29
  def _get_full_commit_message(message, module_name, frid, render_id) -> str:
35
30
  full_message = message
36
31
 
@@ -61,7 +61,7 @@ echo -e "${GREEN}✓${NC} the latest version of *codeplain CLI is now installed.
61
61
  echo ""
62
62
  echo -e "go to ${YELLOW}https://platform.codeplain.ai${NC} and sign up to get your API key."
63
63
  echo ""
64
- read -p "paste your API key here: " API_KEY
64
+ read -r -p "paste your API key here: " API_KEY < /dev/tty
65
65
  echo ""
66
66
 
67
67
  if [ -z "$API_KEY" ]; then
@@ -17,7 +17,7 @@ from event_bus import EventBus
17
17
  from module_renderer import ModuleRenderer
18
18
  from plain2code_arguments import parse_arguments
19
19
  from plain2code_console import console
20
- from plain2code_exceptions import MissingAPIKey, PlainSyntaxError
20
+ from plain2code_exceptions import InvalidFridArgument, MissingAPIKey, PlainSyntaxError
21
21
  from plain2code_logger import (
22
22
  CrashLogHandler,
23
23
  IndentedFormatter,
@@ -46,10 +46,6 @@ UNRECOVERABLE_ERROR_EXIT_CODES = [69]
46
46
  TIMEOUT_ERROR_EXIT_CODE = 124
47
47
 
48
48
 
49
- class InvalidFridArgument(Exception):
50
- pass
51
-
52
-
53
49
  def get_render_range(render_range, plain_source):
54
50
  render_range = render_range.split(",")
55
51
  range_end = render_range[1] if len(render_range) == 2 else render_range[0]
@@ -227,23 +223,20 @@ def main():
227
223
 
228
224
  render(args, run_state, codeplain_api, event_bus)
229
225
  except InvalidFridArgument as e:
230
- console.error(f"Error rendering plain code: {str(e)}.\n")
226
+ console.error(f"Invalid FRID argument: {str(e)}.\n")
231
227
  # No need to print render ID since this error is going to be thrown at the very start so user will be able to
232
228
  # see the render ID that's printed at the very start of the rendering process.
233
229
  dump_crash_logs(args)
234
230
  except FileNotFoundError as e:
235
- console.error(f"Error rendering plain code: {str(e)}\n")
231
+ console.error(f"File not found: {str(e)}\n")
236
232
  console.debug(f"Render ID: {run_state.render_id}")
237
233
  dump_crash_logs(args)
238
- except plain_file.InvalidPlainFileExtension as e:
239
- console.error(f"Error rendering plain code: {str(e)}\n")
240
- dump_crash_logs(args)
241
234
  except TemplateNotFoundError as e:
242
- console.error(f"Error: Template not found: {str(e)}\n")
235
+ console.error(f"Template not found: {str(e)}\n")
243
236
  console.error(system_config.get_error_message("template_not_found"))
244
237
  dump_crash_logs(args)
245
238
  except PlainSyntaxError as e:
246
- console.error(f"Error rendering plain code: {str(e)}\n")
239
+ console.error(f"Plain syntax error: {str(e)}\n")
247
240
  dump_crash_logs(args)
248
241
  except KeyboardInterrupt:
249
242
  console.error("Keyboard interrupt")
@@ -25,25 +25,35 @@ class PlainSyntaxError(Exception):
25
25
  pass
26
26
 
27
27
 
28
- class OnlyRelativeLinksAllowed(Exception):
28
+ class NoRenderFound(Exception):
29
29
  pass
30
30
 
31
31
 
32
- class LinkMustHaveTextSpecified(Exception):
32
+ class MultipleRendersFound(Exception):
33
33
  pass
34
34
 
35
35
 
36
- class NoRenderFound(Exception):
36
+ class UnexpectedState(Exception):
37
37
  pass
38
38
 
39
39
 
40
- class MultipleRendersFound(Exception):
40
+ class MissingAPIKey(Exception):
41
41
  pass
42
42
 
43
43
 
44
- class UnexpectedState(Exception):
44
+ class InvalidFridArgument(Exception):
45
45
  pass
46
46
 
47
47
 
48
- class MissingAPIKey(Exception):
48
+ class InvalidGitRepositoryError(Exception):
49
+ """Raised when the git repository is in an invalid state."""
50
+
51
+ pass
52
+
53
+
54
+ class InvalidLiquidVariableName(Exception):
55
+ pass
56
+
57
+
58
+ class ModuleDoesNotExistError(Exception):
49
59
  pass
@@ -44,22 +44,6 @@ class PlainFileParseResult:
44
44
  required_concepts: list[str]
45
45
 
46
46
 
47
- class OnlyRelativeLinksAllowed(Exception):
48
- pass
49
-
50
-
51
- class LinkMustHaveTextSpecified(Exception):
52
- pass
53
-
54
-
55
- class InvalidPlainFileExtension(Exception):
56
- pass
57
-
58
-
59
- class PlainModuleNotFound(Exception):
60
- pass
61
-
62
-
63
47
  class PlainRenderer(MarkdownRenderer):
64
48
  def render_link(self, token: Link) -> Iterable[Fragment]:
65
49
  yield from self.embed_span(
@@ -95,12 +79,12 @@ def check_section_for_linked_resources(section):
95
79
  for link in traverse(section, klass=Link):
96
80
  parsed_url = urlparse(link.node.target)
97
81
  if parsed_url.scheme != "" or os.path.isabs(link.node.target):
98
- raise OnlyRelativeLinksAllowed(
82
+ raise PlainSyntaxError(
99
83
  f"Only relative links are allowed (text: {link.node.children[0].content}, target: {link.node.target})."
100
84
  )
101
85
 
102
86
  if len(link.node.children) != 1:
103
- raise LinkMustHaveTextSpecified(f"Link must have text specified (link: {link.node.target}).")
87
+ raise PlainSyntaxError(f"Link must have text specified (link: {link.node.target}).")
104
88
 
105
89
  linked_resources.append({"text": link.node.children[0].content, "target": link.node.target})
106
90
 
@@ -529,7 +513,7 @@ def parse_plain_source( # noqa: C901
529
513
  def read_module_plain_source(module_name: str, template_dirs: list[str]) -> str:
530
514
  plain_source_text = file_utils.open_from(template_dirs, module_name + PLAIN_SOURCE_FILE_EXTENSION)
531
515
  if plain_source_text is None:
532
- raise PlainModuleNotFound(f"Module does not exist ({module_name}).")
516
+ raise PlainSyntaxError(f"Module does not exist ({module_name}).")
533
517
  return plain_source_text
534
518
 
535
519
 
@@ -566,12 +550,9 @@ def process_required_modules(
566
550
  if len(all_required_modules) > 0 and module_name == all_required_modules[-1]:
567
551
  continue
568
552
 
569
- try:
570
- plain_file_parse_result = parse_plain_file(
571
- module_name, code_variables, template_dirs, imported_modules=[], modules_trace=[]
572
- )
573
- except PlainModuleNotFound:
574
- raise PlainSyntaxError(f"Required module not found ({module_name}).")
553
+ plain_file_parse_result = parse_plain_file(
554
+ module_name, code_variables, template_dirs, imported_modules=[], modules_trace=[]
555
+ )
575
556
 
576
557
  if len(plain_file_parse_result.required_modules) == 0:
577
558
  if len(all_required_modules) > 0:
@@ -644,7 +625,7 @@ def plain_file_parser( # noqa: C901
644
625
  # and we need to pass them to the marshalled_plain_source_tree after it's rendered
645
626
  plain_source_file_path = Path(plain_source_file_name)
646
627
  if plain_source_file_path.suffix != PLAIN_SOURCE_FILE_EXTENSION:
647
- raise InvalidPlainFileExtension(
628
+ raise PlainSyntaxError(
648
629
  f"Invalid plain file extension: {plain_source_file_path.suffix}. Expected: {PLAIN_SOURCE_FILE_EXTENSION}."
649
630
  )
650
631
 
@@ -652,16 +633,13 @@ def plain_file_parser( # noqa: C901
652
633
 
653
634
  code_variables = {}
654
635
 
655
- try:
656
- plain_file_parse_result = parse_plain_file(
657
- module_name,
658
- code_variables,
659
- template_dirs,
660
- imported_modules=[],
661
- modules_trace=[],
662
- )
663
- except PlainModuleNotFound as e:
664
- raise PlainSyntaxError(e.message)
636
+ plain_file_parse_result = parse_plain_file(
637
+ module_name,
638
+ code_variables,
639
+ template_dirs,
640
+ imported_modules=[],
641
+ modules_trace=[],
642
+ )
665
643
 
666
644
  if len(plain_file_parse_result.required_concepts) > 0:
667
645
  missing_required_concepts_msg = "Missing required concepts: "
@@ -7,6 +7,7 @@ from git.exc import NoSuchPathError
7
7
 
8
8
  import git_utils
9
9
  import plain_spec
10
+ from plain2code_exceptions import ModuleDoesNotExistError
10
11
  from render_machine.implementation_code_helpers import ImplementationCodeHelpers
11
12
 
12
13
  CODEPLAIN_MEMORY_SUBFOLDER = ".memory"
@@ -16,10 +17,6 @@ MODULE_FUNCTIONALITIES = "functionalities"
16
17
  REQUIRED_MODULES_FUNCTIONALITIES = "required_modules_functionalities"
17
18
 
18
19
 
19
- class ModuleDoesNotExistError(Exception):
20
- pass
21
-
22
-
23
20
  class PlainModule:
24
21
  def __init__(self, name: str, build_folder: str):
25
22
  self.name = name
@@ -5,6 +5,8 @@ from typing import Optional
5
5
 
6
6
  from liquid2.filter import with_context
7
7
 
8
+ from plain2code_exceptions import InvalidLiquidVariableName
9
+
8
10
  DEFINITIONS = "definitions"
9
11
  NON_FUNCTIONAL_REQUIREMENTS = "technical specs"
10
12
  TEST_REQUIREMENTS = "test specs"
@@ -23,10 +25,6 @@ ALLOWED_SPECIFICATION_HEADINGS = [
23
25
  ALLOWED_IMPORT_SPECIFICATION_HEADINGS = [DEFINITIONS, NON_FUNCTIONAL_REQUIREMENTS, TEST_REQUIREMENTS]
24
26
 
25
27
 
26
- class InvalidLiquidVariableName(Exception):
27
- pass
28
-
29
-
30
28
  def collect_specification_linked_resources(specification, specification_heading, linked_resources_list):
31
29
  linked_resources = []
32
30
  if "linked_resources" in specification:
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "codeplain"
7
- version = "0.2.3"
7
+ version = "0.2.4"
8
8
  description = "Transform plain language specifications into working code"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -267,5 +267,5 @@ def test_psart_with_duplicate_acceptance_test_heading():
267
267
 
268
268
 
269
269
  def test_invalid_plain_file_extension():
270
- with pytest.raises(plain_file.InvalidPlainFileExtension):
270
+ with pytest.raises(PlainSyntaxError):
271
271
  plain_file.plain_file_parser("test.txt", [])
@@ -1,10 +1,11 @@
1
1
  import pytest
2
2
 
3
3
  import plain_file
4
+ from plain2code_exceptions import PlainSyntaxError
4
5
 
5
6
 
6
7
  def test_non_existent_require(get_test_data_path):
7
- with pytest.raises(Exception, match="Required module not found"):
8
+ with pytest.raises(PlainSyntaxError, match="Module does not exist"):
8
9
  plain_file.plain_file_parser("non_existent_require.plain", [get_test_data_path("data/requires")])
9
10
 
10
11
 
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