plain-parser 0.1.3__tar.gz → 0.1.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.
- {plain_parser-0.1.3 → plain_parser-0.1.4}/.github/dependabot.yml +12 -1
- {plain_parser-0.1.3 → plain_parser-0.1.4}/.github/workflows/lint-and-test.yml +1 -1
- plain_parser-0.1.4/.github/workflows/notify-slack-on-main-merge.yml +39 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/.github/workflows/publish-dev-to-pypi.yml +68 -27
- plain_parser-0.1.4/.github/workflows/publish-to-pypi.yml +213 -0
- plain_parser-0.1.4/PKG-INFO +125 -0
- plain_parser-0.1.4/README.md +102 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/pyproject.toml +4 -4
- plain_parser-0.1.4/src/plain_parser/cli.py +233 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/src/plain_parser/loaders.py +26 -5
- {plain_parser-0.1.3 → plain_parser-0.1.4}/src/plain_parser/plain_file.py +62 -28
- plain_parser-0.1.4/tests/data/cli/parent_link/a/spec/top.plain +7 -0
- plain_parser-0.1.4/tests/data/cli/parent_link/b/shared/notes.md +1 -0
- plain_parser-0.1.4/tests/data/cli/parent_link/b/tpl/.gitkeep +0 -0
- plain_parser-0.1.4/tests/data/cli/resource_before_frid_walk/base.plain +8 -0
- plain_parser-0.1.4/tests/data/cli/resource_before_frid_walk/snippet.plain +1 -0
- plain_parser-0.1.4/tests/data/cli/resource_before_frid_walk/top.plain +14 -0
- plain_parser-0.1.4/tests/data/cli/shared_link_helper.plain +7 -0
- plain_parser-0.1.4/tests/data/cli/shared_link_top.plain +12 -0
- plain_parser-0.1.4/tests/data/cli/template_link/spec/top.plain +7 -0
- plain_parser-0.1.4/tests/data/cli/template_link/tpl/notes.md +1 -0
- plain_parser-0.1.4/tests/test_cli.py +695 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/test_loaders.py +32 -1
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/test_requires.py +104 -3
- plain_parser-0.1.3/.github/workflows/publish-to-pypi.yml +0 -171
- plain_parser-0.1.3/PKG-INFO +0 -76
- plain_parser-0.1.3/README.md +0 -53
- plain_parser-0.1.3/src/plain_parser/cli.py +0 -117
- plain_parser-0.1.3/tests/test_cli.py +0 -329
- {plain_parser-0.1.3 → plain_parser-0.1.4}/.flake8 +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/.gitignore +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/LICENSE +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/src/plain_parser/__init__.py +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/src/plain_parser/concept_utils.py +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/src/plain_parser/exceptions.py +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/src/plain_parser/graph.py +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/src/plain_parser/liquid_nodes.py +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/src/plain_parser/plain_spec.py +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/__init__.py +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/conftest.py +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/cli/acceptance_test_binary_resource.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/cli/acceptance_test_resource.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/cli/base64_resource.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/cli/binary.bin +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/cli/binary_resource.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/cli/code_variable_conflict.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/cli/code_variable_template.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/cli/missing_resource.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/cli/not_plain.md +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/cli/notes.md +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/cli/requires_binary_resource_base.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/cli/requires_binary_resource_top.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/cli/subdir/nested.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/cli/undefined_concept.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/cli/valid.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/imports/circular_imports_1.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/imports/circular_imports_2.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/imports/circular_imports_main.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/imports/diamond_import_1.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/imports/diamond_import_2.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/imports/diamond_import_common.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/imports/diamond_imports_main.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/imports/import_with_functionalities.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/imports/imports_module_with_functionalities.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/imports/non_existent_import.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfile/add_new_task_modal_specification.yaml +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfile/duplicate_specification_heading.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfile/empty_functional_specs_section.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfile/invalid_specification_order.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfile/missing_non_functional_requirements.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfile/no_functional_specs_section.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfile/plain_source_with_absolute_link.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfile/plain_source_with_missing_link.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfile/plain_source_with_url_link.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfile/task_list_ui_specification.yaml +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfile/task_manager_with_reference_links.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfile/without_non_functional_requirement.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/concept_validation_acceptance_tests.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/concept_validation_acceptance_tests_nondefined.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/concept_validation_defined_nondefined.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/concept_validation_defined_nondefined_2.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/concept_validation_definition.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/concept_validation_noconcepts.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/concept_validation_nonconcept.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/concept_validation_nondefined.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/concept_validation_redefinition.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/concept_validation_several_concepts.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/concept_validation_valid.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/cyclic_definitions.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/cyclic_definitions_across_import.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/cyclic_definitions_long.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/cyclic_definitions_sub_bullet.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/exported_concepts.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/exported_concepts_base.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/exported_concepts_defaults_exported.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/exported_concepts_example.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/exported_concepts_imported_exported.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/exported_concepts_inherited_reexported.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/exported_concepts_malformed.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/exported_concepts_missing_definition.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/exported_concepts_missing_definition_example.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/exported_concepts_multiple_per_bullet.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/exported_concepts_multiple_per_bullet_undefined.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/exported_concepts_nested.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/exported_concepts_nested_example.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/exported_concepts_no_definitions.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/exported_concepts_not_declared.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/exported_concepts_not_declared_example.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/exported_concepts_transitive_example.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/exported_concepts_transitive_l1.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/exported_concepts_transitive_l2.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/plain_file_parser_with_comments.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/plain_file_with_comments_indented.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/regular_plain_source.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/required_concepts.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/required_concepts_defs.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/required_concepts_example.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/required_concepts_l1.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/required_concepts_l2.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/required_concepts_missing.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/required_concepts_module.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/required_concepts_partial.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/required_concepts_partial_duplicate.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/requires_without_definitions_example.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/topological_sort.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/plainfileparser/topological_sort_not_referenced.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/chain_base.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/chain_fork_top.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/chain_middle.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/chain_top.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/circular_requires_main.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/circular_requires_sub.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/diamond_requires_1.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/diamond_requires_2.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/diamond_requires_common.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/diamond_requires_main.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/independent_requires_1.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/independent_requires_2.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/independent_requires_main.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/invalid_ancestor_base.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/invalid_ancestor_top.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/non_existent_require.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/normal_requires_1.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/normal_requires_2.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/normal_requires_common.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/normal_requires_main.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/shared_export_above.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/shared_export_base.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/shared_export_middle.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/requires/shared_export_top.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/sample_base64_image.txt +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/simple.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/templates/block_level_include.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/templates/code_variables.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/templates/header.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/templates/implement.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/templates/implement_2.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/templates/malformed_tag.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/templates/template_include.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/templates/test_hardest_problem.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/data/templates/unterminated_output.plain +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/test_concept_utils.py +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/test_exceptions.py +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/test_graph.py +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/test_imports.py +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/test_plainfile.py +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/test_plainfileparser.py +0 -0
- {plain_parser-0.1.3 → plain_parser-0.1.4}/tests/test_plainspec.py +0 -0
|
@@ -4,11 +4,22 @@ updates:
|
|
|
4
4
|
directory: "/"
|
|
5
5
|
schedule:
|
|
6
6
|
interval: "weekly"
|
|
7
|
-
|
|
7
|
+
# Skip releases younger than two days. Security updates are never delayed.
|
|
8
|
+
cooldown:
|
|
9
|
+
default-days: 2
|
|
10
|
+
open-pull-requests-limit: 5
|
|
11
|
+
# "chore(deps): ..." / "chore(deps-dev): ..." — also applies to pip security update PRs.
|
|
8
12
|
commit-message:
|
|
9
13
|
prefix: "chore"
|
|
14
|
+
include: "scope"
|
|
10
15
|
labels:
|
|
11
16
|
- "dependencies"
|
|
17
|
+
# Routine bumps arrive as one weekly PR; majors stay separate.
|
|
18
|
+
groups:
|
|
19
|
+
pip-minor-and-patch:
|
|
20
|
+
update-types:
|
|
21
|
+
- "minor"
|
|
22
|
+
- "patch"
|
|
12
23
|
|
|
13
24
|
- package-ecosystem: "github-actions"
|
|
14
25
|
directory: "/"
|
|
@@ -20,7 +20,7 @@ jobs:
|
|
|
20
20
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
21
21
|
with:
|
|
22
22
|
persist-credentials: false
|
|
23
|
-
- uses: actions/setup-python@
|
|
23
|
+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
24
24
|
with:
|
|
25
25
|
python-version: "3.11"
|
|
26
26
|
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Notify Slack on Merge to Main
|
|
2
|
+
|
|
3
|
+
# Posts to Slack when a PR lands on main. Opening a PR notifies nobody.
|
|
4
|
+
# pull_request_target runs this file from main with secrets, so merged PRs from
|
|
5
|
+
# forks post too. Nothing from the PR is checked out or run; the title only
|
|
6
|
+
# reaches the shell through an env var.
|
|
7
|
+
on:
|
|
8
|
+
pull_request_target:
|
|
9
|
+
types: [closed]
|
|
10
|
+
branches: [main]
|
|
11
|
+
|
|
12
|
+
permissions: {}
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
notify:
|
|
16
|
+
name: Notify Slack
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
if: ${{ github.event.pull_request.merged && vars.SLACK_CHANNEL_ID != '' }}
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
# Slack reads <, > and & as markup: escape them so a PR title cannot
|
|
22
|
+
# mention @channel or rewrite the link.
|
|
23
|
+
- name: Escape the PR title for Slack
|
|
24
|
+
id: pr
|
|
25
|
+
env:
|
|
26
|
+
TITLE: ${{ github.event.pull_request.title }}
|
|
27
|
+
run: |
|
|
28
|
+
printf 'title=%s\n' "$(printf '%s' "$TITLE" | tr '\r\n' ' ' | sed -e 's/&/\&/g' -e 's/</\</g' -e 's/>/\>/g')" >> "$GITHUB_OUTPUT"
|
|
29
|
+
|
|
30
|
+
- name: Notify Slack (merged to main)
|
|
31
|
+
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
|
|
32
|
+
with:
|
|
33
|
+
method: chat.postMessage
|
|
34
|
+
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
35
|
+
errors: true
|
|
36
|
+
# toJSON quotes the title, so quotes and colons in it keep the payload valid.
|
|
37
|
+
payload: |
|
|
38
|
+
channel: ${{ vars.SLACK_CHANNEL_ID }}
|
|
39
|
+
text: ${{ toJSON(format('*plain-parser*: <{0}|#{1} {2}> merged to `main` — by *{3}*.', github.event.pull_request.html_url, github.event.pull_request.number, steps.pr.outputs.title, github.event.pull_request.user.login)) }}
|
|
@@ -52,7 +52,7 @@ jobs:
|
|
|
52
52
|
- name: Install uv
|
|
53
53
|
# uv provisions its own Python (honoring requires-python), so no
|
|
54
54
|
# separate actions/setup-python step is needed.
|
|
55
|
-
uses: astral-sh/setup-uv@
|
|
55
|
+
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
|
56
56
|
with:
|
|
57
57
|
version: "0.12.23"
|
|
58
58
|
enable-cache: false
|
|
@@ -104,7 +104,7 @@ jobs:
|
|
|
104
104
|
|
|
105
105
|
- name: Store the distribution packages
|
|
106
106
|
if: steps.version.outputs.should-publish == 'true'
|
|
107
|
-
uses: actions/upload-artifact@
|
|
107
|
+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
108
108
|
with:
|
|
109
109
|
name: dev-package-distributions
|
|
110
110
|
path: dist/
|
|
@@ -124,40 +124,81 @@ jobs:
|
|
|
124
124
|
|
|
125
125
|
steps:
|
|
126
126
|
- name: Download distribution packages
|
|
127
|
-
uses: actions/download-artifact@
|
|
127
|
+
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
128
128
|
with:
|
|
129
129
|
name: dev-package-distributions
|
|
130
130
|
path: dist/
|
|
131
131
|
|
|
132
132
|
- name: Publish to PyPI
|
|
133
|
-
uses: pypa/gh-action-pypi-publish@
|
|
133
|
+
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # release/v1
|
|
134
134
|
with:
|
|
135
135
|
# PyPI uploads are immutable, so a re-run of an already-published
|
|
136
136
|
# version should be a no-op, not a red build.
|
|
137
137
|
skip-existing: true
|
|
138
138
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
139
|
+
# End-of-run notices run in their own job: a failed Slack post fails only this
|
|
140
|
+
# job, not the publish or its GitHub deployment, and "Re-run failed jobs"
|
|
141
|
+
# re-posts without publishing again.
|
|
142
|
+
notify:
|
|
143
|
+
name: Notify Slack
|
|
144
|
+
needs: [pre-publish-checks, build, publish-dev]
|
|
145
|
+
if: ${{ !cancelled() && vars.SLACK_CHANNEL_ID != '' }}
|
|
146
|
+
runs-on: ubuntu-latest
|
|
147
|
+
|
|
148
|
+
steps:
|
|
149
|
+
- name: Short SHA
|
|
150
|
+
run: echo "SHORT_SHA=${GITHUB_SHA:0:7}" >> "$GITHUB_ENV"
|
|
151
|
+
|
|
152
|
+
- name: Notify Slack (checks failed)
|
|
153
|
+
if: ${{ needs.pre-publish-checks.result == 'failure' }}
|
|
154
|
+
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
|
|
155
|
+
with:
|
|
156
|
+
method: chat.postMessage
|
|
157
|
+
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
158
|
+
errors: true
|
|
159
|
+
payload: |
|
|
160
|
+
channel: ${{ vars.SLACK_CHANNEL_ID }}
|
|
161
|
+
text: >-
|
|
162
|
+
*plain-parser*: dev build of `${{ env.SHORT_SHA }}` halted — pre-publish checks FAILED :x:. Nothing was published to PyPI.
|
|
163
|
+
See <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|the run log>.
|
|
164
|
+
|
|
165
|
+
- name: Notify Slack (build failure)
|
|
166
|
+
if: ${{ needs.build.result == 'failure' }}
|
|
167
|
+
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
|
|
168
|
+
with:
|
|
169
|
+
method: chat.postMessage
|
|
170
|
+
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
171
|
+
errors: true
|
|
172
|
+
payload: |
|
|
173
|
+
channel: ${{ vars.SLACK_CHANNEL_ID }}
|
|
174
|
+
text: >-
|
|
175
|
+
*plain-parser*: Building the dev build FAILED :x: (commit `${{ env.SHORT_SHA }}`). Nothing was published to PyPI.
|
|
176
|
+
See <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|the run log>.
|
|
152
177
|
|
|
153
178
|
- name: Notify Slack (failure)
|
|
154
|
-
if: failure
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
179
|
+
if: ${{ needs.publish-dev.result == 'failure' }}
|
|
180
|
+
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
|
|
181
|
+
with:
|
|
182
|
+
method: chat.postMessage
|
|
183
|
+
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
184
|
+
errors: true
|
|
185
|
+
payload: |
|
|
186
|
+
channel: ${{ vars.SLACK_CHANNEL_ID }}
|
|
187
|
+
text: >-
|
|
188
|
+
*plain-parser*: Publishing dev build to PyPI FAILED :x: (commit `${{ env.SHORT_SHA }}`).
|
|
189
|
+
See <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|the run log>.
|
|
190
|
+
|
|
191
|
+
# Spell out the --pre install: a plain "pip install plain-parser" will
|
|
192
|
+
# NOT pick this up, which otherwise reads as a broken publish.
|
|
193
|
+
- name: Notify Slack (success)
|
|
194
|
+
if: ${{ needs.publish-dev.result == 'success' }}
|
|
195
|
+
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
|
|
196
|
+
with:
|
|
197
|
+
method: chat.postMessage
|
|
198
|
+
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
199
|
+
errors: true
|
|
200
|
+
payload: |
|
|
201
|
+
channel: ${{ vars.SLACK_CHANNEL_ID }}
|
|
202
|
+
text: >-
|
|
203
|
+
*plain-parser*: dev build `${{ needs.build.outputs.version }}` published to PyPI :test_tube:.
|
|
204
|
+
Normal installs are unaffected — try it with `pip install --pre plain-parser==${{ needs.build.outputs.version }}`.
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
# Least privilege by default: jobs get no GITHUB_TOKEN scopes unless they
|
|
8
|
+
# opt in below.
|
|
9
|
+
permissions: {}
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
pre-publish-checks:
|
|
13
|
+
name: Pre-publish checks
|
|
14
|
+
# Publishing is gated on the same checks PRs run: a red main must not
|
|
15
|
+
# ship. Running here rather than as a separate workflow is the only way
|
|
16
|
+
# to make the build job depend on the result.
|
|
17
|
+
uses: ./.github/workflows/lint-and-test.yml
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
|
|
21
|
+
build:
|
|
22
|
+
name: Build distribution
|
|
23
|
+
needs: pre-publish-checks
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
permissions:
|
|
26
|
+
contents: read
|
|
27
|
+
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
30
|
+
with:
|
|
31
|
+
# hatch-vcs derives the version from git tags, so we need full history.
|
|
32
|
+
fetch-depth: 0
|
|
33
|
+
persist-credentials: false
|
|
34
|
+
|
|
35
|
+
# Non-fatal: Slack being down must not block the release.
|
|
36
|
+
- name: Notify Slack (start)
|
|
37
|
+
if: ${{ vars.SLACK_CHANNEL_ID != '' }}
|
|
38
|
+
continue-on-error: true
|
|
39
|
+
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
|
|
40
|
+
with:
|
|
41
|
+
method: chat.postMessage
|
|
42
|
+
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
43
|
+
errors: true
|
|
44
|
+
payload: |
|
|
45
|
+
channel: ${{ vars.SLACK_CHANNEL_ID }}
|
|
46
|
+
text: >-
|
|
47
|
+
*plain-parser*: Release `${{ github.ref_name }}` published by *${{ github.actor }}*
|
|
48
|
+
— building and publishing to PyPI...
|
|
49
|
+
|
|
50
|
+
- name: Install uv
|
|
51
|
+
# uv provisions its own Python (honoring requires-python), so no
|
|
52
|
+
# separate actions/setup-python step is needed.
|
|
53
|
+
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
|
54
|
+
with:
|
|
55
|
+
version: "0.12.23"
|
|
56
|
+
enable-cache: false
|
|
57
|
+
|
|
58
|
+
- name: Build package
|
|
59
|
+
# hatch-vcs reads the version straight from the release tag.
|
|
60
|
+
run: |
|
|
61
|
+
uv build
|
|
62
|
+
echo "Built distributions:"
|
|
63
|
+
ls -l dist/
|
|
64
|
+
|
|
65
|
+
- name: Store the distribution packages
|
|
66
|
+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
67
|
+
with:
|
|
68
|
+
name: python-package-distributions
|
|
69
|
+
path: dist/
|
|
70
|
+
|
|
71
|
+
upload-release-assets:
|
|
72
|
+
name: Upload assets to GitHub Release
|
|
73
|
+
needs: build
|
|
74
|
+
runs-on: ubuntu-latest
|
|
75
|
+
permissions:
|
|
76
|
+
contents: write
|
|
77
|
+
|
|
78
|
+
steps:
|
|
79
|
+
- name: Download distribution packages
|
|
80
|
+
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
81
|
+
with:
|
|
82
|
+
name: python-package-distributions
|
|
83
|
+
path: dist/
|
|
84
|
+
|
|
85
|
+
- name: Upload assets to GitHub Release
|
|
86
|
+
env:
|
|
87
|
+
GH_TOKEN: ${{ github.token }}
|
|
88
|
+
GH_REPO: ${{ github.repository }}
|
|
89
|
+
TAG: ${{ github.ref_name }}
|
|
90
|
+
run: |
|
|
91
|
+
gh release upload "$TAG" dist/* --clobber
|
|
92
|
+
|
|
93
|
+
publish-to-pypi:
|
|
94
|
+
name: Publish to PyPI
|
|
95
|
+
needs: [build, upload-release-assets]
|
|
96
|
+
runs-on: ubuntu-latest
|
|
97
|
+
environment:
|
|
98
|
+
name: pypi
|
|
99
|
+
url: https://pypi.org/p/plain-parser
|
|
100
|
+
permissions:
|
|
101
|
+
# Mint a short-lived OIDC token so PyPI Trusted Publishing can
|
|
102
|
+
# authenticate this run — no long-lived API token needed.
|
|
103
|
+
id-token: write
|
|
104
|
+
|
|
105
|
+
steps:
|
|
106
|
+
- name: Download distribution packages
|
|
107
|
+
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
108
|
+
with:
|
|
109
|
+
name: python-package-distributions
|
|
110
|
+
path: dist/
|
|
111
|
+
|
|
112
|
+
- name: Publish to PyPI
|
|
113
|
+
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # release/v1
|
|
114
|
+
|
|
115
|
+
# End-of-run notices run in their own job: a failed Slack post fails only this
|
|
116
|
+
# job, not the publish or its GitHub deployment, and "Re-run failed jobs"
|
|
117
|
+
# re-posts without publishing again.
|
|
118
|
+
notify:
|
|
119
|
+
name: Notify Slack
|
|
120
|
+
needs: [pre-publish-checks, build, upload-release-assets, publish-to-pypi]
|
|
121
|
+
if: ${{ !cancelled() && vars.SLACK_CHANNEL_ID != '' }}
|
|
122
|
+
runs-on: ubuntu-latest
|
|
123
|
+
|
|
124
|
+
steps:
|
|
125
|
+
- name: Notify Slack (checks failed)
|
|
126
|
+
if: ${{ needs.pre-publish-checks.result == 'failure' }}
|
|
127
|
+
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
|
|
128
|
+
with:
|
|
129
|
+
method: chat.postMessage
|
|
130
|
+
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
131
|
+
errors: true
|
|
132
|
+
payload: |
|
|
133
|
+
channel: ${{ vars.SLACK_CHANNEL_ID }}
|
|
134
|
+
text: >-
|
|
135
|
+
*plain-parser*: Release `${{ github.ref_name }}` halted — pre-publish checks FAILED :x:. Nothing was published to PyPI.
|
|
136
|
+
See <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|the run log>.
|
|
137
|
+
|
|
138
|
+
- name: Notify Slack (build failure)
|
|
139
|
+
if: ${{ needs.build.result == 'failure' }}
|
|
140
|
+
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
|
|
141
|
+
with:
|
|
142
|
+
method: chat.postMessage
|
|
143
|
+
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
144
|
+
errors: true
|
|
145
|
+
payload: |
|
|
146
|
+
channel: ${{ vars.SLACK_CHANNEL_ID }}
|
|
147
|
+
text: >-
|
|
148
|
+
*plain-parser*: Build of `${{ github.ref_name }}` FAILED :x:. Nothing was published to PyPI.
|
|
149
|
+
See <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|the run log>.
|
|
150
|
+
|
|
151
|
+
- name: Notify Slack (upload failure)
|
|
152
|
+
if: ${{ needs.upload-release-assets.result == 'failure' }}
|
|
153
|
+
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
|
|
154
|
+
with:
|
|
155
|
+
method: chat.postMessage
|
|
156
|
+
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
157
|
+
errors: true
|
|
158
|
+
payload: |
|
|
159
|
+
channel: ${{ vars.SLACK_CHANNEL_ID }}
|
|
160
|
+
text: >-
|
|
161
|
+
*plain-parser*: Uploading `${{ github.ref_name }}` to the GitHub Release FAILED :x:. Nothing was published to PyPI.
|
|
162
|
+
See <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|the run log>.
|
|
163
|
+
|
|
164
|
+
- name: Notify Slack (failure)
|
|
165
|
+
if: ${{ needs.publish-to-pypi.result == 'failure' }}
|
|
166
|
+
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
|
|
167
|
+
with:
|
|
168
|
+
method: chat.postMessage
|
|
169
|
+
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
170
|
+
errors: true
|
|
171
|
+
payload: |
|
|
172
|
+
channel: ${{ vars.SLACK_CHANNEL_ID }}
|
|
173
|
+
text: >-
|
|
174
|
+
*plain-parser*: Publishing `${{ github.ref_name }}` to PyPI FAILED :x:.
|
|
175
|
+
See <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|the run log>.
|
|
176
|
+
|
|
177
|
+
# The tag (v0.2.0rc1) without its "v", for the install command below.
|
|
178
|
+
- name: Version from tag
|
|
179
|
+
id: version
|
|
180
|
+
if: ${{ needs.publish-to-pypi.result == 'success' }}
|
|
181
|
+
env:
|
|
182
|
+
TAG: ${{ github.ref_name }}
|
|
183
|
+
run: echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
|
|
184
|
+
|
|
185
|
+
# GitHub marks the release itself as a pre-release; the tag (v0.2.0rc1)
|
|
186
|
+
# carries the same intent for PEP 440. pip and uv skip pre-releases by
|
|
187
|
+
# default, so "--upgrade" would NOT pick one up. Tell people the command
|
|
188
|
+
# that actually works.
|
|
189
|
+
- name: Notify Slack (pre-release published)
|
|
190
|
+
if: ${{ needs.publish-to-pypi.result == 'success' && github.event.release.prerelease }}
|
|
191
|
+
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
|
|
192
|
+
with:
|
|
193
|
+
method: chat.postMessage
|
|
194
|
+
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
195
|
+
errors: true
|
|
196
|
+
payload: |
|
|
197
|
+
channel: ${{ vars.SLACK_CHANNEL_ID }}
|
|
198
|
+
text: >-
|
|
199
|
+
*plain-parser*: pre-release `${{ github.ref_name }}` published to PyPI :test_tube:.
|
|
200
|
+
Normal installs are unaffected — try it with `pip install --pre plain-parser==${{ steps.version.outputs.version }}`.
|
|
201
|
+
|
|
202
|
+
- name: Notify Slack (release published)
|
|
203
|
+
if: ${{ needs.publish-to-pypi.result == 'success' && !github.event.release.prerelease }}
|
|
204
|
+
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
|
|
205
|
+
with:
|
|
206
|
+
method: chat.postMessage
|
|
207
|
+
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
208
|
+
errors: true
|
|
209
|
+
payload: |
|
|
210
|
+
channel: ${{ vars.SLACK_CHANNEL_ID }}
|
|
211
|
+
text: >-
|
|
212
|
+
*plain-parser*: `${{ github.ref_name }}` published to PyPI :white_check_mark:.
|
|
213
|
+
Install with `pip install --upgrade plain-parser`.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: plain-parser
|
|
3
|
+
Version: 0.1.4
|
|
4
|
+
Summary: Parser for ***plain specification files
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Classifier: Intended Audience :: Developers
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
11
|
+
Requires-Python: >=3.11
|
|
12
|
+
Requires-Dist: mistletoe<2,>=1.6.0
|
|
13
|
+
Requires-Dist: python-frontmatter<2,>=1.3.0
|
|
14
|
+
Requires-Dist: python-liquid2<0.5,>=0.4.0
|
|
15
|
+
Requires-Dist: pyyaml<7,>=6
|
|
16
|
+
Provides-Extra: dev
|
|
17
|
+
Requires-Dist: black==26.10.1; extra == 'dev'
|
|
18
|
+
Requires-Dist: flake8==7.4.1; extra == 'dev'
|
|
19
|
+
Requires-Dist: isort==9.0.2; extra == 'dev'
|
|
20
|
+
Requires-Dist: mypy==2.4.0; extra == 'dev'
|
|
21
|
+
Requires-Dist: pytest==9.1.1; extra == 'dev'
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# plain-parser
|
|
25
|
+
|
|
26
|
+
Python parser for [`***plain`](https://www.plainlang.org/docs/) specification files.
|
|
27
|
+
|
|
28
|
+
Reads a `.plain` module and its `import` / `requires` chain, resolves Liquid templates,
|
|
29
|
+
validates concepts and linked resources, and returns the marshalled specification tree
|
|
30
|
+
plus the ordered list of functionalities (FRIDs).
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install plain-parser
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Command line
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
plain-parser check <file.plain> [--template-dir DIR] [--config-name NAME]
|
|
42
|
+
plain-parser parse <file.plain> [--template-dir DIR] [--config-name NAME]
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Both commands parse the module and its `requires` chain, check that every linked resource is an existing
|
|
46
|
+
file (not a directory), and walk the module's functionalities. They stop at the first error.
|
|
47
|
+
|
|
48
|
+
### `check`
|
|
49
|
+
|
|
50
|
+
Validates the module. In addition to the steps above it reads every linked file and rejects binary files and
|
|
51
|
+
files holding a large base64 blob.
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
$ plain-parser check my_spec.plain
|
|
55
|
+
my_spec.plain: OK
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Exit `0` when the module is valid. On an error, `Error: …` is written to stderr and the exit code is `1`.
|
|
59
|
+
|
|
60
|
+
### `parse`
|
|
61
|
+
|
|
62
|
+
Prints the parse result as one UTF-8 JSON document on stdout. Linked files are located but not read.
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
$ plain-parser parse my_spec.plain
|
|
66
|
+
{
|
|
67
|
+
"format_version": 1,
|
|
68
|
+
"modules": [{"module": "...", "tree": {...}}, ...],
|
|
69
|
+
"resources": {...}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
- `format_version`: `1`.
|
|
74
|
+
- `modules`: every module in the `requires` chain, in build order: deepest ancestor first, the module itself last.
|
|
75
|
+
Each entry has the module name and its specification tree, in the shape described under *Python* below.
|
|
76
|
+
- `resources`: every linked-resource target in the chain, as written in the spec, mapped to the path it resolves
|
|
77
|
+
to, relative to the entry module's directory, with `/` as separator: `notes.md` when found next to the module,
|
|
78
|
+
`../tpl/notes.md` when found in a template directory. The directory part is lexical (symlinks not resolved) and
|
|
79
|
+
the target is appended as written (`..` kept), so joining the value onto the entry module's directory names the
|
|
80
|
+
file the parser matched. When no relative path exists (another drive on Windows) the value is the absolute path,
|
|
81
|
+
still with `/`. Two spellings of one file (`notes.md`, `./notes.md`) are two keys.
|
|
82
|
+
|
|
83
|
+
Exit `0` on success. On a parser error the JSON is `{"format_version": 1, "type": "<error class>",
|
|
84
|
+
"message": "…"}` and the exit code is `1`.
|
|
85
|
+
|
|
86
|
+
### Options and exit codes
|
|
87
|
+
|
|
88
|
+
Modules and `{% include %}` templates are looked up in the `.plain` file's directory, then in `--template-dir`.
|
|
89
|
+
When `--template-dir` is not given, it is read from the `template-dir` key of `config.yaml` (or the file named by
|
|
90
|
+
`--config-name`), found next to the `.plain` file or in the working directory. Finding it in both is a usage
|
|
91
|
+
error. The config file is read even when `--template-dir` is given, so a malformed one fails the run either way.
|
|
92
|
+
Other config keys are ignored.
|
|
93
|
+
|
|
94
|
+
| Exit code | Meaning |
|
|
95
|
+
|---|---|
|
|
96
|
+
| `0` | Success |
|
|
97
|
+
| `1` | The module, its chain, or a linked resource is invalid |
|
|
98
|
+
| `2` | Usage error, including an ambiguous or malformed config file |
|
|
99
|
+
| `130` | Interrupted |
|
|
100
|
+
|
|
101
|
+
## Python
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from plain_parser import plain_file_parser
|
|
105
|
+
|
|
106
|
+
module_name, plain_source_tree, required_modules = plain_file_parser("my_spec.plain", ["."])
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
`plain_source_tree` is a dict keyed by section (`definitions`, `implementation reqs`,
|
|
110
|
+
`test reqs`, `functional specs`), each a list of `{"markdown": ..., "linked_resources": [...]}`
|
|
111
|
+
entries. `plain_parser.plain_spec` has helpers for walking functionalities
|
|
112
|
+
(`get_frids`, `get_specifications_for_frid`, `collect_linked_resources`).
|
|
113
|
+
|
|
114
|
+
## Development
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
uv venv --python 3.11 && source .venv/bin/activate
|
|
118
|
+
uv pip install -e ".[dev]"
|
|
119
|
+
pytest
|
|
120
|
+
black . --check && isort . --check-only && flake8 . && mypy src
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
MIT, see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# plain-parser
|
|
2
|
+
|
|
3
|
+
Python parser for [`***plain`](https://www.plainlang.org/docs/) specification files.
|
|
4
|
+
|
|
5
|
+
Reads a `.plain` module and its `import` / `requires` chain, resolves Liquid templates,
|
|
6
|
+
validates concepts and linked resources, and returns the marshalled specification tree
|
|
7
|
+
plus the ordered list of functionalities (FRIDs).
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install plain-parser
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Command line
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
plain-parser check <file.plain> [--template-dir DIR] [--config-name NAME]
|
|
19
|
+
plain-parser parse <file.plain> [--template-dir DIR] [--config-name NAME]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Both commands parse the module and its `requires` chain, check that every linked resource is an existing
|
|
23
|
+
file (not a directory), and walk the module's functionalities. They stop at the first error.
|
|
24
|
+
|
|
25
|
+
### `check`
|
|
26
|
+
|
|
27
|
+
Validates the module. In addition to the steps above it reads every linked file and rejects binary files and
|
|
28
|
+
files holding a large base64 blob.
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
$ plain-parser check my_spec.plain
|
|
32
|
+
my_spec.plain: OK
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Exit `0` when the module is valid. On an error, `Error: …` is written to stderr and the exit code is `1`.
|
|
36
|
+
|
|
37
|
+
### `parse`
|
|
38
|
+
|
|
39
|
+
Prints the parse result as one UTF-8 JSON document on stdout. Linked files are located but not read.
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
$ plain-parser parse my_spec.plain
|
|
43
|
+
{
|
|
44
|
+
"format_version": 1,
|
|
45
|
+
"modules": [{"module": "...", "tree": {...}}, ...],
|
|
46
|
+
"resources": {...}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- `format_version`: `1`.
|
|
51
|
+
- `modules`: every module in the `requires` chain, in build order: deepest ancestor first, the module itself last.
|
|
52
|
+
Each entry has the module name and its specification tree, in the shape described under *Python* below.
|
|
53
|
+
- `resources`: every linked-resource target in the chain, as written in the spec, mapped to the path it resolves
|
|
54
|
+
to, relative to the entry module's directory, with `/` as separator: `notes.md` when found next to the module,
|
|
55
|
+
`../tpl/notes.md` when found in a template directory. The directory part is lexical (symlinks not resolved) and
|
|
56
|
+
the target is appended as written (`..` kept), so joining the value onto the entry module's directory names the
|
|
57
|
+
file the parser matched. When no relative path exists (another drive on Windows) the value is the absolute path,
|
|
58
|
+
still with `/`. Two spellings of one file (`notes.md`, `./notes.md`) are two keys.
|
|
59
|
+
|
|
60
|
+
Exit `0` on success. On a parser error the JSON is `{"format_version": 1, "type": "<error class>",
|
|
61
|
+
"message": "…"}` and the exit code is `1`.
|
|
62
|
+
|
|
63
|
+
### Options and exit codes
|
|
64
|
+
|
|
65
|
+
Modules and `{% include %}` templates are looked up in the `.plain` file's directory, then in `--template-dir`.
|
|
66
|
+
When `--template-dir` is not given, it is read from the `template-dir` key of `config.yaml` (or the file named by
|
|
67
|
+
`--config-name`), found next to the `.plain` file or in the working directory. Finding it in both is a usage
|
|
68
|
+
error. The config file is read even when `--template-dir` is given, so a malformed one fails the run either way.
|
|
69
|
+
Other config keys are ignored.
|
|
70
|
+
|
|
71
|
+
| Exit code | Meaning |
|
|
72
|
+
|---|---|
|
|
73
|
+
| `0` | Success |
|
|
74
|
+
| `1` | The module, its chain, or a linked resource is invalid |
|
|
75
|
+
| `2` | Usage error, including an ambiguous or malformed config file |
|
|
76
|
+
| `130` | Interrupted |
|
|
77
|
+
|
|
78
|
+
## Python
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from plain_parser import plain_file_parser
|
|
82
|
+
|
|
83
|
+
module_name, plain_source_tree, required_modules = plain_file_parser("my_spec.plain", ["."])
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`plain_source_tree` is a dict keyed by section (`definitions`, `implementation reqs`,
|
|
87
|
+
`test reqs`, `functional specs`), each a list of `{"markdown": ..., "linked_resources": [...]}`
|
|
88
|
+
entries. `plain_parser.plain_spec` has helpers for walking functionalities
|
|
89
|
+
(`get_frids`, `get_specifications_for_frid`, `collect_linked_resources`).
|
|
90
|
+
|
|
91
|
+
## Development
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
uv venv --python 3.11 && source .venv/bin/activate
|
|
95
|
+
uv pip install -e ".[dev]"
|
|
96
|
+
pytest
|
|
97
|
+
black . --check && isort . --check-only && flake8 . && mypy src
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
MIT, see [LICENSE](LICENSE).
|
|
@@ -26,10 +26,10 @@ dependencies = [
|
|
|
26
26
|
[project.optional-dependencies]
|
|
27
27
|
dev = [
|
|
28
28
|
"pytest==9.1.1",
|
|
29
|
-
"flake8==7.
|
|
30
|
-
"black==26.
|
|
31
|
-
"isort==
|
|
32
|
-
"mypy==2.
|
|
29
|
+
"flake8==7.4.1",
|
|
30
|
+
"black==26.10.1",
|
|
31
|
+
"isort==9.0.2",
|
|
32
|
+
"mypy==2.4.0",
|
|
33
33
|
]
|
|
34
34
|
|
|
35
35
|
[project.scripts]
|