codeplain 0.2.12__tar.gz → 0.2.14__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.
- codeplain-0.2.14/LICENSE +201 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/PKG-INFO +4 -4
- {codeplain-0.2.12 → codeplain-0.2.14}/README.md +2 -2
- codeplain-0.2.14/_version.py +1 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/codeplain_REST_api.py +2 -0
- codeplain-0.2.14/docs/plain2code_cli.md +72 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/docs/starting_a_plain_project_from_scratch.md +24 -24
- codeplain-0.2.14/event_bus.py +30 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/examples/example_hello_world_python/hello_world_python.plain +2 -0
- codeplain-0.2.14/examples/example_hello_world_python/python-console-app-boilerplate.plain +13 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/file_utils.py +2 -4
- {codeplain-0.2.12 → codeplain-0.2.14}/memory_management.py +4 -4
- {codeplain-0.2.12 → codeplain-0.2.14}/plain2code.py +43 -31
- {codeplain-0.2.12 → codeplain-0.2.14}/plain2code_arguments.py +56 -2
- {codeplain-0.2.12 → codeplain-0.2.14}/plain2code_console.py +23 -4
- {codeplain-0.2.12 → codeplain-0.2.14}/plain2code_exceptions.py +6 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/plain2code_logger.py +2 -21
- {codeplain-0.2.12 → codeplain-0.2.14}/plain2code_read_config.py +0 -6
- {codeplain-0.2.12 → codeplain-0.2.14}/pyproject.toml +1 -1
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/actions/render_functional_requirement.py +1 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/actions/run_conformance_tests.py +7 -1
- {codeplain-0.2.12 → codeplain-0.2.14}/requirements.txt +1 -1
- codeplain-0.2.14/resources/plain_example.png +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/test_git_utils.py +22 -44
- codeplain-0.2.14/tests/test_resolve_config_file.py +89 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tui/components.py +3 -2
- {codeplain-0.2.12 → codeplain-0.2.14}/tui/plain2code_tui.py +10 -62
- {codeplain-0.2.12 → codeplain-0.2.14}/tui/state_handlers.py +13 -2
- codeplain-0.2.12/LICENSE +0 -21
- codeplain-0.2.12/_version.py +0 -1
- codeplain-0.2.12/docs/plain2code_cli.md +0 -63
- codeplain-0.2.12/docs/plain_language_specification.md +0 -213
- codeplain-0.2.12/event_bus.py +0 -45
- codeplain-0.2.12/resources/plain_example.png +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/.flake8 +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/.github/workflows/lint-and-test.yml +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/.github/workflows/nofity-slack-on-main-merge.yml +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/.github/workflows/publish-install-script.yml +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/.github/workflows/publish-to-pypi.yml +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/.gitignore +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/.vscode/launch.json +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/.vscode/settings.json +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/concept_utils.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/config/__init__.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/config/system_config.yaml +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/diff_utils.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/docs/generate_cli.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/examples/example_hello_world_golang/config.yaml +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/examples/example_hello_world_golang/harness_tests/hello_world_test.go +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/examples/example_hello_world_golang/hello_world_golang.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/examples/example_hello_world_golang/run.sh +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/examples/example_hello_world_python/config.yaml +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/examples/example_hello_world_python/harness_tests/hello_world_display/test_hello_world.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/examples/example_hello_world_python/run.sh +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/examples/example_hello_world_react/config.yaml +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/examples/example_hello_world_react/harness_tests/hello_world_display/cypress/e2e/hello_world.cy.ts +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/examples/example_hello_world_react/harness_tests/hello_world_display/cypress/support/e2e.ts +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/examples/example_hello_world_react/harness_tests/hello_world_display/cypress.config.ts +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/examples/example_hello_world_react/harness_tests/hello_world_display/package.json +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/examples/example_hello_world_react/harness_tests/hello_world_display/tsconfig.json +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/examples/example_hello_world_react/hello_world_react.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/examples/example_hello_world_react/run.sh +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/examples/run.sh +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/git_utils.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/hash_key.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/install/bash/examples.sh +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/install/bash/install.sh +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/install/bash/walkthrough.sh +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/install/powershell/examples.ps1 +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/install/powershell/install.ps1 +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/install/powershell/walkthrough.ps1 +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/module_renderer.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/plain2code_events.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/plain2code_nodes.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/plain2code_state.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/plain2code_utils.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/plain_file.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/plain_modules.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/plain_spec.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/pytest.ini +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/__init__.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/actions/analyze_specification_ambiguity.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/actions/base_action.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/actions/commit_conformance_tests_changes.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/actions/commit_implementation_code_changes.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/actions/create_dist.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/actions/exit_with_error.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/actions/finish_functional_requirement.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/actions/fix_conformance_test.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/actions/fix_unit_tests.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/actions/prepare_repositories.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/actions/prepare_testing_environment.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/actions/refactor_code.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/actions/render_conformance_tests.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/actions/run_unit_tests.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/actions/summarize_conformance_tests.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/code_renderer.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/conformance_test_helpers.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/conformance_tests.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/implementation_code_helpers.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/render_context.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/render_types.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/render_utils.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/state_machine_config.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/states.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/render_machine/triggers.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/resources/codeplain_overview.png +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/standard_template_library/__init__.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/standard_template_library/golang-console-app-template.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/standard_template_library/python-console-app-template.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/standard_template_library/typescript-react-app-boilerplate.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/standard_template_library/typescript-react-app-template.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/system_config.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/test_scripts/run_conformance_tests_cypress.sh +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/test_scripts/run_conformance_tests_golang.sh +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/test_scripts/run_conformance_tests_python.sh +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/test_scripts/run_unittests_golang.sh +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/test_scripts/run_unittests_python.sh +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/test_scripts/run_unittests_react.sh +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/__init__.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/conftest.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/imports/circular_imports_1.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/imports/circular_imports_2.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/imports/circular_imports_main.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/imports/diamond_import_1.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/imports/diamond_import_2.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/imports/diamond_import_common.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/imports/diamond_imports_main.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/imports/non_existent_import.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfile/duplicate_specification_heading.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfile/invalid_specification_order.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfile/missing_non_functional_requirements.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfile/plain_source_with_absolute_link.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfile/plain_source_with_url_link.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfile/task_manager_with_reference_links.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfile/without_non_functional_requirement.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/concept_validation_acceptance_tests.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/concept_validation_acceptance_tests_nondefined.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/concept_validation_defined_nondefined.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/concept_validation_defined_nondefined_2.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/concept_validation_definition.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/concept_validation_noconcepts.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/concept_validation_nonconcept.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/concept_validation_nondefined.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/concept_validation_redefinition.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/concept_validation_several_concepts.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/concept_validation_valid.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/exported_concepts.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/exported_concepts_base.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/exported_concepts_example.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/exported_concepts_missing.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/exported_concepts_missing_example.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/exported_concepts_nested.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/exported_concepts_nested_example.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/exported_concepts_transitive_example.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/exported_concepts_transitive_l1.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/exported_concepts_transitive_l2.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/plain_file_parser_with_comments.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/plain_file_with_comments_indented.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/regular_plain_source.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/required_concepts.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/required_concepts_defs.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/required_concepts_example.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/required_concepts_l1.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/required_concepts_l2.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/required_concepts_missing.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/required_concepts_module.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/required_concepts_partial.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/required_concepts_partial_duplicate.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/topological_sort.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/plainfileparser/topological_sort_not_referenced.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/requires/circular_requires_main.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/requires/circular_requires_sub.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/requires/diamond_requires_1.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/requires/diamond_requires_2.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/requires/diamond_requires_common.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/requires/diamond_requires_main.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/requires/independent_requires_1.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/requires/independent_requires_2.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/requires/independent_requires_main.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/requires/non_existent_require.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/requires/normal_requires_1.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/requires/normal_requires_2.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/requires/normal_requires_common.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/requires/normal_requires_main.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/simple.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/templates/block_level_include.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/templates/code_variables.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/templates/header.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/templates/implement.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/templates/implement_2.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/templates/template_include.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/data/templates/test_hardest_problem.plain +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/test_imports.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/test_plainfile.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/test_plainfileparser.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/test_plainspec.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tests/test_requires.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tui/__init__.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tui/models.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tui/spinner.py +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tui/styles.css +0 -0
- {codeplain-0.2.12 → codeplain-0.2.14}/tui/widget_helpers.py +0 -0
codeplain-0.2.14/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Codeplain, Inc.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codeplain
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.14
|
|
4
4
|
Summary: Transform plain language specifications into working code
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
Classifier: Environment :: Console
|
|
@@ -20,7 +20,7 @@ Requires-Dist: textual>=7.5.0
|
|
|
20
20
|
Requires-Dist: tiktoken==0.12.0
|
|
21
21
|
Requires-Dist: transitions==0.9.3
|
|
22
22
|
Provides-Extra: dev
|
|
23
|
-
Requires-Dist: black==
|
|
23
|
+
Requires-Dist: black==26.3.1; extra == 'dev'
|
|
24
24
|
Requires-Dist: flake8==7.0.0; extra == 'dev'
|
|
25
25
|
Requires-Dist: isort==5.13.2; extra == 'dev'
|
|
26
26
|
Requires-Dist: mypy==1.11.2; extra == 'dev'
|
|
@@ -46,7 +46,7 @@ Schematic overview of the Codeplain's code generation service
|
|
|
46
46
|
|
|
47
47
|
An example application in ***plain
|
|
48
48
|
|
|
49
|
-
<img src="
|
|
49
|
+
<img src="resources/plain_example.png" width="70%" height="70%">
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
## Getting started
|
|
@@ -115,7 +115,7 @@ After completing the installation steps above, you can immediately test the syst
|
|
|
115
115
|
|
|
116
116
|
### Documentation
|
|
117
117
|
|
|
118
|
-
- For more details on the ***plain format, see the [***plain language specification](docs/
|
|
118
|
+
- For more details on the ***plain format, see the [***plain language specification](https://www.plainlang.org/docs/intro/).
|
|
119
119
|
- For step-by-step instructions for creating your first ***plain project see the [Kickstart your ***plain project](docs/starting_a_plain_project_from_scratch.md).
|
|
120
120
|
- For complete CLI documentation and usage examples, see [plain2code CLI documentation](docs/plain2code_cli.md).
|
|
121
121
|
|
|
@@ -17,7 +17,7 @@ Schematic overview of the Codeplain's code generation service
|
|
|
17
17
|
|
|
18
18
|
An example application in ***plain
|
|
19
19
|
|
|
20
|
-
<img src="
|
|
20
|
+
<img src="resources/plain_example.png" width="70%" height="70%">
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
## Getting started
|
|
@@ -86,7 +86,7 @@ After completing the installation steps above, you can immediately test the syst
|
|
|
86
86
|
|
|
87
87
|
### Documentation
|
|
88
88
|
|
|
89
|
-
- For more details on the ***plain format, see the [***plain language specification](docs/
|
|
89
|
+
- For more details on the ***plain format, see the [***plain language specification](https://www.plainlang.org/docs/intro/).
|
|
90
90
|
- For step-by-step instructions for creating your first ***plain project see the [Kickstart your ***plain project](docs/starting_a_plain_project_from_scratch.md).
|
|
91
91
|
- For complete CLI documentation and usage examples, see [plain2code CLI documentation](docs/plain2code_cli.md).
|
|
92
92
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.14"
|
|
@@ -152,6 +152,7 @@ class CodeplainAPI:
|
|
|
152
152
|
memory_files_content: dict,
|
|
153
153
|
module_name: str,
|
|
154
154
|
required_modules: dict,
|
|
155
|
+
include_unittests: bool,
|
|
155
156
|
run_state: RunState,
|
|
156
157
|
) -> dict[str, str]:
|
|
157
158
|
"""
|
|
@@ -191,6 +192,7 @@ class CodeplainAPI:
|
|
|
191
192
|
"memory_files_content": memory_files_content,
|
|
192
193
|
"module_name": module_name,
|
|
193
194
|
"required_modules": required_modules,
|
|
195
|
+
"include_unittests": include_unittests,
|
|
194
196
|
}
|
|
195
197
|
|
|
196
198
|
return self.post_request(endpoint_url, headers, payload, run_state)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Plain2Code CLI Reference
|
|
2
|
+
|
|
3
|
+
```text
|
|
4
|
+
usage: generate_cli.py [-h] [--verbose] [--base-folder BASE_FOLDER] [--build-folder BUILD_FOLDER] [--log-to-file | --no-log-to-file] [--log-file-name LOG_FILE_NAME] [--config-name CONFIG_NAME]
|
|
5
|
+
[--render-range RENDER_RANGE | --render-from RENDER_FROM] [--force-render] [--unittests-script UNITTESTS_SCRIPT] [--conformance-tests-folder CONFORMANCE_TESTS_FOLDER]
|
|
6
|
+
[--conformance-tests-script CONFORMANCE_TESTS_SCRIPT] [--prepare-environment-script PREPARE_ENVIRONMENT_SCRIPT] [--test-script-timeout TEST_SCRIPT_TIMEOUT] [--api [API]] [--api-key API_KEY]
|
|
7
|
+
[--full-plain] [--dry-run] [--replay-with REPLAY_WITH] [--template-dir TEMPLATE_DIR] [--copy-build] [--build-dest BUILD_DEST] [--copy-conformance-tests]
|
|
8
|
+
[--conformance-tests-dest CONFORMANCE_TESTS_DEST] [--render-machine-graph] [--logging-config-path] [--headless]
|
|
9
|
+
filename
|
|
10
|
+
|
|
11
|
+
Render plain code to target code.
|
|
12
|
+
|
|
13
|
+
positional arguments:
|
|
14
|
+
filename Path to the plain file to render. The directory containing this file has highest precedence for template loading, so you can place custom templates here to override the defaults. See --template-dir
|
|
15
|
+
for more details about template loading.
|
|
16
|
+
|
|
17
|
+
options:
|
|
18
|
+
-h, --help show this help message and exit
|
|
19
|
+
--verbose, -v Enable verbose output
|
|
20
|
+
--base-folder BASE_FOLDER
|
|
21
|
+
Base folder for the build files
|
|
22
|
+
--build-folder BUILD_FOLDER
|
|
23
|
+
Folder for build files
|
|
24
|
+
--log-to-file, --no-log-to-file
|
|
25
|
+
Enable logging to a file. Defaults to True. Set to False to disable.
|
|
26
|
+
--log-file-name LOG_FILE_NAME
|
|
27
|
+
Name of the log file. Defaults to 'codeplain.log'.Always resolved relative to the plain file directory.If file on this path already exists, the already existing log file will be overwritten by the
|
|
28
|
+
current logs.
|
|
29
|
+
--render-range RENDER_RANGE
|
|
30
|
+
Specify a range of functional requirements to render (e.g. `1` , `2`, `3`). Use comma to separate start and end IDs. If only one ID is provided, only that requirement is rendered. Range is
|
|
31
|
+
inclusive of both start and end IDs.
|
|
32
|
+
--render-from RENDER_FROM
|
|
33
|
+
Continue generation starting from this specific functional requirement (e.g. `2`). The requirement with this ID will be included in the output. The ID must match one of the functional requirements
|
|
34
|
+
in your plain file.
|
|
35
|
+
--force-render Force re-render of all the required modules.
|
|
36
|
+
--unittests-script UNITTESTS_SCRIPT
|
|
37
|
+
Shell script to run unit tests on generated code. Receives the build folder path as its first argument (default: 'plain_modules').
|
|
38
|
+
--conformance-tests-folder CONFORMANCE_TESTS_FOLDER
|
|
39
|
+
Folder for conformance test files
|
|
40
|
+
--conformance-tests-script CONFORMANCE_TESTS_SCRIPT
|
|
41
|
+
Path to conformance tests shell script. Every conformance test script should accept two arguments: 1) Path to a folder (e.g. `plain_modules/module_name`) containing generated source code, 2) Path
|
|
42
|
+
to a subfolder of the conformance tests folder (e.g. `conformance_tests/subfoldername`) containing test files.
|
|
43
|
+
--prepare-environment-script PREPARE_ENVIRONMENT_SCRIPT
|
|
44
|
+
Path to a shell script that prepares the testing environment. The script should accept the source code folder path as its first argument.
|
|
45
|
+
--test-script-timeout TEST_SCRIPT_TIMEOUT
|
|
46
|
+
Timeout for test scripts in seconds. If not provided, the default timeout of 120 seconds is used.
|
|
47
|
+
--api [API] Alternative base URL for the API. Default: `https://api.codeplain.ai`
|
|
48
|
+
--api-key API_KEY API key used to access the API. If not provided, the `CODEPLAIN_API_KEY` environment variable is used.
|
|
49
|
+
--full-plain Full preview ***plain specification before code generation.Use when you want to preview context of all ***plain primitives that are going to be included in order to render the given module.
|
|
50
|
+
--dry-run Dry run preview of the code generation (without actually making any changes).
|
|
51
|
+
--replay-with REPLAY_WITH
|
|
52
|
+
--template-dir TEMPLATE_DIR
|
|
53
|
+
Path to a custom template directory. Templates are searched in the following order: 1) Directory containing the plain file, 2) Custom template directory (if provided through this argument), 3)
|
|
54
|
+
Built-in standard_template_library directory
|
|
55
|
+
--copy-build If set, copy the rendered contents of code in `--base-folder` folder to `--build-dest` folder after successful rendering.
|
|
56
|
+
--build-dest BUILD_DEST
|
|
57
|
+
Target folder to copy rendered contents of code to (used only if --copy-build is set).
|
|
58
|
+
--copy-conformance-tests
|
|
59
|
+
If set, copy the conformance tests of code in `--conformance-tests-folder` folder to `--conformance-tests-dest` folder successful rendering. Requires --conformance-tests-script.
|
|
60
|
+
--conformance-tests-dest CONFORMANCE_TESTS_DEST
|
|
61
|
+
Target folder to copy conformance tests of code to (used only if --copy-conformance-tests is set).
|
|
62
|
+
--render-machine-graph
|
|
63
|
+
If set, render the state machine graph.
|
|
64
|
+
--logging-config-path
|
|
65
|
+
Path to the logging configuration file.
|
|
66
|
+
--headless Run in headless mode: no TUI, no terminal output except a single render-started message. All logs are written to the log file.
|
|
67
|
+
|
|
68
|
+
configuration:
|
|
69
|
+
--config-name CONFIG_NAME
|
|
70
|
+
Path to the config file, defaults to config.yaml
|
|
71
|
+
|
|
72
|
+
```
|
|
@@ -21,35 +21,40 @@ my-new-project/
|
|
|
21
21
|
├── config.yaml # CLI configuration
|
|
22
22
|
├── run_unittests_[language].sh # Unit test script
|
|
23
23
|
├── run_conformance_tests_[language].sh # Conformance test script
|
|
24
|
-
├── build/ # Generated
|
|
25
|
-
|
|
24
|
+
├── build/ # Generated final code
|
|
25
|
+
├── plain_modules/ # Generated modules code
|
|
26
|
+
└── conformance_tests/ # Generated conformanece tests code
|
|
26
27
|
```
|
|
27
28
|
|
|
28
29
|
In this guide we will cover how to create each of these step by step.
|
|
29
30
|
|
|
30
31
|
## 1. Define Your .plain File
|
|
31
32
|
|
|
32
|
-
Create a `.plain` file. The following example shows how to specify the array sorting problem. For more details, see [***plain language specifications](
|
|
33
|
+
Create a `.plain` file. The following example shows how to specify the array sorting problem. For more details, see [***plain language specifications](https://www.plainlang.org/docs/).
|
|
33
34
|
|
|
34
35
|
**Example: `array_sorting.plain`**
|
|
35
36
|
```plain
|
|
36
|
-
|
|
37
|
+
---
|
|
38
|
+
description: 'Example showing how to specify the array sorting problem'
|
|
39
|
+
import:
|
|
40
|
+
- python-console-app-template
|
|
41
|
+
---
|
|
37
42
|
|
|
38
|
-
***
|
|
39
|
-
-
|
|
43
|
+
***definitions***
|
|
44
|
+
- :Array: is an array of integers received as input.
|
|
40
45
|
|
|
41
|
-
***
|
|
42
|
-
-
|
|
43
|
-
- Sort
|
|
44
|
-
- Display
|
|
46
|
+
***functional specs***
|
|
47
|
+
- :App: should be extended to receive :Array:
|
|
48
|
+
- Sort :Array:
|
|
49
|
+
- Display :Array:
|
|
45
50
|
|
|
46
|
-
***
|
|
47
|
-
- When given input "5 2 8 1 9",
|
|
48
|
-
- When given input "1 2 3 4 5",
|
|
51
|
+
***acceptance tests***
|
|
52
|
+
- When given input "5 2 8 1 9", :App: should output "1 2 5 8 9"
|
|
53
|
+
- When given input "1 2 3 4 5", :App: should output "1 2 3 4 5"
|
|
49
54
|
|
|
50
55
|
```
|
|
51
56
|
|
|
52
|
-
-
|
|
57
|
+
`python-console-app-template` is predefined template providing specification of a typical Python console application. Check [standard template library](../standard_template_library/) for available predefined templates.
|
|
53
58
|
|
|
54
59
|
## 2. Add Test Scripts
|
|
55
60
|
|
|
@@ -59,7 +64,7 @@ Include the appropriate test scripts to your project:
|
|
|
59
64
|
cp /path/to/plain2code_client/test_scripts/run_unittests_python.sh ./
|
|
60
65
|
cp /path/to/plain2code_client/test_scripts/run_conformance_tests_python.sh ./
|
|
61
66
|
```
|
|
62
|
-
|
|
67
|
+
You may need to modify these scripts based on your specific project requirements.
|
|
63
68
|
|
|
64
69
|
## 3. Configure Parameters
|
|
65
70
|
|
|
@@ -71,6 +76,8 @@ Example of a basic `config.yaml` file:
|
|
|
71
76
|
|
|
72
77
|
unittests-script: ./run_unittests_python.sh
|
|
73
78
|
conformance-tests-script: ./run_conformance_tests_python.sh
|
|
79
|
+
copy-build: true
|
|
80
|
+
build-dest: build
|
|
74
81
|
verbose: true
|
|
75
82
|
|
|
76
83
|
```
|
|
@@ -81,14 +88,7 @@ verbose: true
|
|
|
81
88
|
## 4. Generate & Run Your Project
|
|
82
89
|
|
|
83
90
|
```bash
|
|
84
|
-
|
|
91
|
+
codeplain my_app.plain
|
|
85
92
|
```
|
|
86
|
-
- Generated code will appear in build/ and conformance_tests/.
|
|
87
93
|
|
|
88
|
-
|
|
89
|
-
## 5. Notes
|
|
90
|
-
- `build/` and `conformance_tests/` folders are generated automatically
|
|
91
|
-
- These folders are excluded from git via `.gitignore`
|
|
92
|
-
- `dist/` and `dist_conformance_tests/` are created if you set `copy-build: true` and `copy-conformance-tests: true` in your config.yaml
|
|
93
|
-
- Always review generated code before using in production
|
|
94
|
-
- The `.plain` file is your source of truth - keep it well-documented and version-controlled
|
|
94
|
+
After rendering is completed the generated code will be available in build/ folder.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from collections import defaultdict
|
|
2
|
+
from typing import Any, Callable, Type
|
|
3
|
+
|
|
4
|
+
from plain2code_events import BaseEvent
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class EventBus:
|
|
8
|
+
def __init__(self):
|
|
9
|
+
self._listeners: defaultdict[Type[BaseEvent], list[Callable[[Any], None]]] = defaultdict(list)
|
|
10
|
+
self._dispatch_wrapper: Callable[[Callable], None] | None = None
|
|
11
|
+
|
|
12
|
+
def register_dispatch_wrapper(self, fn: Callable[[Callable], None]):
|
|
13
|
+
"""Set a wrapper for dispatching listeners (e.g., Textual's app.call_from_thread)."""
|
|
14
|
+
self._dispatch_wrapper = fn
|
|
15
|
+
|
|
16
|
+
def subscribe(self, event_type: Type[BaseEvent], listener: Callable[[Any], None]):
|
|
17
|
+
"""Registers a listener for a specific event type."""
|
|
18
|
+
self._listeners[event_type].append(listener)
|
|
19
|
+
|
|
20
|
+
def publish(self, event: BaseEvent):
|
|
21
|
+
"""Publishes an event to all registered listeners."""
|
|
22
|
+
|
|
23
|
+
def _dispatch():
|
|
24
|
+
for listener in self._listeners[type(event)]:
|
|
25
|
+
listener(event)
|
|
26
|
+
|
|
27
|
+
if self._dispatch_wrapper:
|
|
28
|
+
self._dispatch_wrapper(_dispatch)
|
|
29
|
+
else:
|
|
30
|
+
_dispatch()
|
|
@@ -236,8 +236,7 @@ def load_linked_resources(template_dirs: list[str], resources_list):
|
|
|
236
236
|
content = open_from(template_dirs, file_name)
|
|
237
237
|
|
|
238
238
|
if content is None:
|
|
239
|
-
raise FileNotFoundError(
|
|
240
|
-
f"""
|
|
239
|
+
raise FileNotFoundError(f"""
|
|
241
240
|
Resource file {file_name} not found. Resource files are searched in the following order (highest to lowest precedence):
|
|
242
241
|
|
|
243
242
|
1. The directory containing your .plain file
|
|
@@ -245,8 +244,7 @@ def load_linked_resources(template_dirs: list[str], resources_list):
|
|
|
245
244
|
3. The built-in 'standard_template_library' directory
|
|
246
245
|
|
|
247
246
|
Please ensure that the resource exists in one of these locations, or specify the correct --template-dir if using custom templates.
|
|
248
|
-
"""
|
|
249
|
-
)
|
|
247
|
+
""")
|
|
250
248
|
|
|
251
249
|
linked_resources[file_name] = content
|
|
252
250
|
|
|
@@ -14,11 +14,11 @@ CONFORMANCE_TEST_MEMORY_SUBFOLDER = "conformance_test_memory"
|
|
|
14
14
|
class MemoryManager:
|
|
15
15
|
|
|
16
16
|
@staticmethod
|
|
17
|
-
def fetch_memory_files(memory_folder: str):
|
|
17
|
+
def fetch_memory_files(memory_folder: str) -> tuple[list[str], dict[str, str]]:
|
|
18
18
|
"""Fetch memory files from memory_folder/conformance_test_memory."""
|
|
19
19
|
memory_path = os.path.join(memory_folder, CONFORMANCE_TEST_MEMORY_SUBFOLDER)
|
|
20
20
|
if not os.path.exists(memory_path):
|
|
21
|
-
return
|
|
21
|
+
return [], {}
|
|
22
22
|
memory_files = file_utils.list_all_text_files(memory_path)
|
|
23
23
|
memory_files_content = file_utils.get_existing_files_content(memory_path, memory_files)
|
|
24
24
|
console.info(f"Loaded {len(memory_files_content)} memory files.")
|
|
@@ -61,7 +61,7 @@ class MemoryManager:
|
|
|
61
61
|
existing_files, existing_files_content = ImplementationCodeHelpers.fetch_existing_files(
|
|
62
62
|
render_context.build_folder
|
|
63
63
|
)
|
|
64
|
-
|
|
64
|
+
memory_files, memory_files_content = MemoryManager.fetch_memory_files(self.memory_folder)
|
|
65
65
|
|
|
66
66
|
conformance_tests_folder_name = (
|
|
67
67
|
render_context.conformance_tests_running_context.get_current_conformance_test_folder_name()
|
|
@@ -96,7 +96,7 @@ class MemoryManager:
|
|
|
96
96
|
)
|
|
97
97
|
if len(response_files) > 0:
|
|
98
98
|
memory_folder_path = os.path.join(self.memory_folder, CONFORMANCE_TEST_MEMORY_SUBFOLDER)
|
|
99
|
-
file_utils.store_response_files(memory_folder_path, response_files,
|
|
99
|
+
file_utils.store_response_files(memory_folder_path, response_files, memory_files)
|
|
100
100
|
|
|
101
101
|
def delete_unresolved_memory_files(self):
|
|
102
102
|
"""Delete memory files whose resolution_status is not 'RESOLVED'."""
|