matchify 0.2.0__tar.gz → 0.3.1__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.
- {matchify-0.2.0 → matchify-0.3.1}/.copier-answers.yml +3 -3
- matchify-0.3.1/.gitattributes +1 -0
- {matchify-0.2.0 → matchify-0.3.1}/.github/actions/setup/action.yml +2 -2
- {matchify-0.2.0 → matchify-0.3.1}/.github/workflows/ci.yml +56 -35
- matchify-0.3.1/.github/workflows/deploy_development_docs.yml +35 -0
- matchify-0.3.1/.github/workflows/docs.yml +37 -0
- {matchify-0.2.0 → matchify-0.3.1}/.github/workflows/release-pr.yml +11 -2
- matchify-0.3.1/.github/workflows/test-release.yml +81 -0
- matchify-0.3.1/.github/workflows/test_docs.yml +16 -0
- {matchify-0.2.0 → matchify-0.3.1}/.github/workflows/weekly.yml +13 -4
- {matchify-0.2.0 → matchify-0.3.1}/.pre-commit-config.yaml +17 -20
- {matchify-0.2.0 → matchify-0.3.1}/.pre-commit-hooks.yaml +1 -1
- {matchify-0.2.0 → matchify-0.3.1}/AGENTS.md +16 -5
- {matchify-0.2.0 → matchify-0.3.1}/CHANGELOG.md +51 -0
- {matchify-0.2.0 → matchify-0.3.1}/PKG-INFO +93 -160
- {matchify-0.2.0 → matchify-0.3.1}/README.md +89 -156
- matchify-0.3.1/code_sample_format.py +118 -0
- matchify-0.3.1/code_sample_runtime.py +27 -0
- matchify-0.3.1/code_sample_writer.py +39 -0
- {matchify-0.2.0 → matchify-0.3.1}/design.md +1 -1
- matchify-0.3.1/docs/assumptions.md +181 -0
- matchify-0.3.1/docs/contributing.md +1 -0
- matchify-0.3.1/docs/index.md +34 -0
- matchify-0.3.1/docs/selective-conversion.md +560 -0
- matchify-0.2.0/find_new_issue_2.py → matchify-0.3.1/find_pattern_coverage_issue.py +50 -119
- matchify-0.2.0/find_new_issue.py → matchify-0.3.1/find_random_trace_issue.py +39 -106
- matchify-0.3.1/mkdocs.yml +18 -0
- {matchify-0.2.0 → matchify-0.3.1}/pyproject.toml +23 -11
- {matchify-0.2.0 → matchify-0.3.1}/src/matchify/access_path.py +3 -3
- matchify-0.3.1/src/matchify/assumptions.py +77 -0
- matchify-0.3.1/src/matchify/cli.py +735 -0
- {matchify-0.2.0 → matchify-0.3.1}/src/matchify/compiler.py +42 -24
- {matchify-0.2.0 → matchify-0.3.1}/src/matchify/conditions.py +43 -20
- matchify-0.3.1/src/matchify/conversion_filter.py +330 -0
- matchify-0.3.1/src/matchify/diff.py +201 -0
- {matchify-0.2.0 → matchify-0.3.1}/src/matchify/facts.py +18 -7
- {matchify-0.2.0 → matchify-0.3.1}/src/matchify/lookup_tables.py +53 -19
- {matchify-0.2.0 → matchify-0.3.1}/src/matchify/pattern_builder.py +60 -13
- {matchify-0.2.0 → matchify-0.3.1}/src/matchify/patterns.py +7 -3
- {matchify-0.2.0 → matchify-0.3.1}/src/matchify/safety.py +3 -1
- matchify-0.3.1/src/matchify/transform.py +328 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_can_select_using_all_source_and_result_metrics_rejected.py +29 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_can_select_using_all_source_and_result_metrics_selected.py +30 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_counts_maximum_generated_pattern_depth_rejected.py +33 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_counts_maximum_generated_pattern_depth_selected.py +34 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_counts_names_once_across_or_pattern_alternatives.py +22 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_counts_qualified_value_patterns_class_rejected.py +53 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_counts_qualified_value_patterns_class_selected.py +54 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_counts_qualified_value_patterns_guard_rejected.py +51 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_counts_qualified_value_patterns_guard_selected.py +52 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_counts_qualified_value_patterns_inside_composite_patterns.py +52 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_counts_qualified_value_patterns_literal_rejected.py +35 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_counts_qualified_value_patterns_literal_selected.py +36 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_counts_qualified_value_patterns_membership_rejected.py +53 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_counts_qualified_value_patterns_membership_selected.py +54 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_counts_qualified_value_patterns_self_attribute_rejected.py +45 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_counts_qualified_value_patterns_self_attribute_selected.py +46 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_counts_qualified_value_patterns_singleton_rejected.py +35 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_counts_qualified_value_patterns_singleton_selected.py +36 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_counts_sequence_checks_guards_and_captures.py +24 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_distinguishes_self_value_patterns_class_rejected.py +47 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_distinguishes_self_value_patterns_class_selected.py +48 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_distinguishes_self_value_patterns_guard_rejected.py +51 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_distinguishes_self_value_patterns_guard_selected.py +52 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_distinguishes_self_value_patterns_membership_rejected.py +49 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_distinguishes_self_value_patterns_membership_selected.py +50 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_distinguishes_self_value_patterns_nested_other_self_rejected.py +47 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_distinguishes_self_value_patterns_nested_other_self_selected.py +48 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_distinguishes_self_value_patterns_nested_self_attribute_rejected.py +45 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_distinguishes_self_value_patterns_nested_self_attribute_selected.py +46 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_distinguishes_self_value_patterns_other_attribute_rejected.py +47 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_distinguishes_self_value_patterns_other_attribute_selected.py +48 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_distinguishes_self_value_patterns_self_attribute_rejected.py +45 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_distinguishes_self_value_patterns_self_attribute_selected.py +46 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_distinguishes_self_value_patterns_similar_name_rejected.py +45 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_distinguishes_self_value_patterns_similar_name_selected.py +46 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_does_not_apply_to_lookup_conversions.py +21 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_preserves_python_boolean_semantics_and_short_circuit.py +18 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_preserves_python_boolean_semantics_and_value.py +19 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_preserves_python_boolean_semantics_comparison_short_circuit.py +18 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_preserves_python_boolean_semantics_or_branches.py +19 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_preserves_python_boolean_semantics_or_fallback.py +19 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_preserves_python_boolean_semantics_or_rejected.py +18 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_preserves_python_boolean_semantics_or_short_circuit.py +19 -0
- matchify-0.3.1/tests/code_samples/conversion_filter_runs_after_assumption_resolution.py +24 -0
- matchify-0.3.1/tests/code_samples/edge_cases_chained_comparison_not_converted.py +18 -0
- matchify-0.3.1/tests/code_samples/edge_cases_comment_preservation_before_elif_and_else.py +43 -0
- matchify-0.3.1/tests/code_samples/edge_cases_comment_preservation_before_if.py +29 -0
- matchify-0.3.1/tests/code_samples/edge_cases_different_dynamic_subscript_subjects_are_not_converted.py +27 -0
- matchify-0.3.1/tests/code_samples/edge_cases_dynamic_and_slice_subscript_subjects_are_not_conflated.py +20 -0
- matchify-0.3.1/tests/code_samples/edge_cases_guard_pattern_with_boolean_attribute.py +25 -0
- matchify-0.3.1/tests/code_samples/edge_cases_guard_pattern_with_global_variable.py +29 -0
- matchify-0.3.1/tests/code_samples/edge_cases_guard_pattern_with_ignored_type_check_on_other_subject.py +31 -0
- matchify-0.3.1/tests/code_samples/edge_cases_guard_pattern_with_independent_condition.py +29 -0
- matchify-0.3.1/tests/code_samples/edge_cases_guard_pattern_with_isinstance_check.py +27 -0
- matchify-0.3.1/tests/code_samples/edge_cases_guard_pattern_with_multiple_classes.py +35 -0
- matchify-0.3.1/tests/code_samples/edge_cases_guard_pattern_with_multiple_conditions.py +31 -0
- matchify-0.3.1/tests/code_samples/edge_cases_guard_pattern_with_nested_boolean_attribute.py +31 -0
- matchify-0.3.1/tests/code_samples/edge_cases_inconsistent_tuple_subject_order_is_not_converted.py +28 -0
- matchify-0.3.1/tests/code_samples/edge_cases_is_not_operator_not_converted.py +18 -0
- matchify-0.3.1/tests/code_samples/edge_cases_is_operator_with_non_singleton_not_converted.py +20 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_proper_type_with_second_isinstance_becomes_guard.py +53 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_tuple_with_attribute_checks.py +35 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_tuple_with_attributes_converted.py +35 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_with_attribute_guard_converted.py +57 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_with_boolean_attribute_guard_real_world.py +65 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_with_deeply_nested_isinstance_on_attributes.py +41 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_with_empty_tuple_not_converted.py +18 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_with_ignored_class_alias_in_tuple_enabled.py +49 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_with_len_check_on_attribute_not_converted.py +46 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_with_nested_class_sequence_attribute.py +54 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_with_nested_isinstance_and_attr_checks.py +35 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_with_nested_isinstance_and_multiple_attr_checks.py +56 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_with_nested_isinstance_on_attributes.py +33 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_with_nested_isinstance_tuple.py +53 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_with_nested_or_attribute_check.py +35 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_with_non_literal_attribute_becomes_guard.py +29 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_with_qualified_ignored_type_ignored.py +36 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_with_starred_element_not_converted.py +20 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_with_type_variable_ignored_enabled.py +35 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_with_type_variable_ignored_ignored.py +35 -0
- matchify-0.3.1/tests/code_samples/edge_cases_isinstance_with_type_variable_in_tuple_ignored_ignored.py +49 -0
- matchify-0.3.1/tests/code_samples/edge_cases_len_attribute_with_unsupported_operator_stays_guard.py +27 -0
- matchify-0.3.1/tests/code_samples/edge_cases_len_attribute_with_variable_length_stays_guard.py +29 -0
- matchify-0.3.1/tests/code_samples/edge_cases_malformed_isinstance_on_other_value_not_converted.py +20 -0
- matchify-0.3.1/tests/code_samples/edge_cases_mixed_sequence_patterns_in_chain.py +23 -0
- matchify-0.3.1/tests/code_samples/edge_cases_multiple_subjects_preserve_short_circuiting_in_guards.py +28 -0
- matchify-0.3.1/tests/code_samples/edge_cases_nested_isinstance_tuple_with_sequence_attribute_checks.py +43 -0
- matchify-0.3.1/tests/code_samples/edge_cases_nested_isinstance_with_walrus_converted_to_pattern_and_guard.py +71 -0
- matchify-0.3.1/tests/code_samples/edge_cases_non_equality_condition_after_pattern_becomes_guard.py +25 -0
- matchify-0.3.1/tests/code_samples/edge_cases_or_pattern_with_guard_condition.py +21 -0
- matchify-0.3.1/tests/code_samples/edge_cases_parenthesized_or_condition_after_pattern_becomes_guard.py +31 -0
- matchify-0.3.1/tests/code_samples/edge_cases_path_bearing_guard_can_anchor_sequence_subject.py +27 -0
- matchify-0.3.1/tests/code_samples/edge_cases_problematic_empty_isinstance_tuple_inside_and_not_converted.py +18 -0
- matchify-0.3.1/tests/code_samples/edge_cases_problematic_ignored_isinstance_tuple_element_inside_and_not_converted.py +21 -0
- matchify-0.3.1/tests/code_samples/edge_cases_problematic_isinstance_inside_and_not_converted.py +21 -0
- matchify-0.3.1/tests/code_samples/edge_cases_problematic_starred_isinstance_tuple_inside_and_not_converted.py +20 -0
- matchify-0.3.1/tests/code_samples/edge_cases_redundant_hasattr_removed_when_attribute_is_pattern_checked.py +27 -0
- matchify-0.3.1/tests/code_samples/edge_cases_sequence_with_non_integer_subscript_not_converted.py +20 -0
- matchify-0.3.1/tests/code_samples/edge_cases_starred_isinstance_on_other_value_stays_guard.py +23 -0
- matchify-0.3.1/tests/code_samples/edge_cases_starred_isinstance_on_subject_attribute_stays_guard.py +29 -0
- matchify-0.3.1/tests/code_samples/edge_cases_typed_predicate_outside_subject_remains_guard.py +39 -0
- matchify-0.3.1/tests/code_samples/edge_cases_value_pattern_with_guard_condition.py +21 -0
- matchify-0.3.1/tests/code_samples/edge_cases_walrus_operator_in_isinstance_converted_to_guard.py +37 -0
- matchify-0.3.1/tests/code_samples/edge_cases_walrus_operator_in_isinstance_subject_not_converted.py +22 -0
- matchify-0.3.1/tests/code_samples/example.py +37 -0
- matchify-0.3.1/tests/code_samples/guard_multiline_match_case_guard_is_parenthesized.py +31 -0
- matchify-0.3.1/tests/code_samples/lookup_chained_subscription.py +16 -0
- matchify-0.3.1/tests/code_samples/lookup_function_local_lookup_assignment_is_removed.py +21 -0
- matchify-0.3.1/tests/code_samples/lookup_inline_lookup_in_arbitrary_statement.py +23 -0
- matchify-0.3.1/tests/code_samples/lookup_invalid_slice.py +22 -0
- matchify-0.3.1/tests/code_samples/lookup_lookup_comments_remain_before_the_generated_match.py +20 -0
- matchify-0.3.1/tests/code_samples/lookup_lookup_values_can_be_arbitrary_expressions.py +40 -0
- matchify-0.3.1/tests/code_samples/lookup_module_source_unchanged.py +16 -0
- matchify-0.3.1/tests/code_samples/lookup_one_line_functions_are_ignored.py +12 -0
- matchify-0.3.1/tests/code_samples/lookup_only_the_chained_lookup_is_excluded.py +26 -0
- matchify-0.3.1/tests/code_samples/lookup_reused_source_unchanged.py +20 -0
- matchify-0.3.1/tests/code_samples/lookup_source.py +18 -0
- matchify-0.3.1/tests/code_samples/lookup_subject_is_evaluated_once_and_missing_key_is_preserved.py +36 -0
- matchify-0.3.1/tests/code_samples/lookup_table.py +20 -0
- matchify-0.3.1/tests/code_samples/lookup_tuple_and_nested_tuple_keys_become_sequence_patterns.py +29 -0
- matchify-0.3.1/tests/code_samples/lookup_unsafe_01.py +28 -0
- matchify-0.3.1/tests/code_samples/lookup_unsafe_02.py +26 -0
- matchify-0.3.1/tests/code_samples/lookup_unsafe_03.py +26 -0
- matchify-0.3.1/tests/code_samples/lookup_unsafe_04.py +26 -0
- matchify-0.3.1/tests/code_samples/lookup_unsafe_05.py +28 -0
- matchify-0.3.1/tests/code_samples/lookup_unsafe_06.py +28 -0
- matchify-0.3.1/tests/code_samples/lookup_unsafe_07.py +28 -0
- matchify-0.3.1/tests/code_samples/lookup_unsafe_08.py +28 -0
- matchify-0.3.1/tests/code_samples/lookup_unsafe_09.py +26 -0
- matchify-0.3.1/tests/code_samples/lookup_unsafe_10.py +28 -0
- matchify-0.3.1/tests/code_samples/lookup_use_before_assignment.py +22 -0
- matchify-0.3.1/tests/code_samples/nested_statement_rewrites_preserve_expressions.py +39 -0
- matchify-0.3.1/tests/code_samples/planning_missing_parent_assumptions_do_not_block_children_enabled_after_safe.py +51 -0
- matchify-0.3.1/tests/code_samples/planning_missing_parent_assumptions_do_not_block_children_risky.py +50 -0
- matchify-0.3.1/tests/code_samples/planning_missing_parent_assumptions_do_not_block_children_safe.py +49 -0
- matchify-0.3.1/tests/code_samples/public_accepts_deeply_qualified_class_patterns.py +39 -0
- matchify-0.3.1/tests/code_samples/public_capture_stays_in_body_for_an_incompatible_attribute_parent.py +29 -0
- matchify-0.3.1/tests/code_samples/public_capture_stays_in_body_when_class_attribute_is_not_patterned.py +31 -0
- matchify-0.3.1/tests/code_samples/public_capture_stays_in_body_when_only_one_or_alternative_can_bind.py +25 -0
- matchify-0.3.1/tests/code_samples/public_conflicting_value_facts_fall_back_to_a_guard.py +24 -0
- matchify-0.3.1/tests/code_samples/public_deep_capture_stays_in_body_when_intermediate_element_is_missing.py +25 -0
- matchify-0.3.1/tests/code_samples/public_duplicate_capture_with_multiple_remaining_statements.py +24 -0
- matchify-0.3.1/tests/code_samples/public_incompatible_class_and_subscript_facts_are_rejected.py +26 -0
- matchify-0.3.1/tests/code_samples/public_list_and_tuple_type_guards_are_kept_for_sequence_patterns.py +23 -0
- matchify-0.3.1/tests/code_samples/public_nested_capture_stays_in_body_when_the_child_is_not_a_sequence.py +33 -0
- matchify-0.3.1/tests/code_samples/public_nested_or_fact_with_a_shared_guard_is_rendered.py +25 -0
- matchify-0.3.1/tests/code_samples/public_nested_subscription_without_sequence_anchor_stays_in_guard.py +35 -0
- matchify-0.3.1/tests/code_samples/public_or_alternatives_with_different_guards_fall_back_to_a_guard.py +27 -0
- matchify-0.3.1/tests/code_samples/public_qualified_sequence_type_checks_remain_guards.py +31 -0
- matchify-0.3.1/tests/code_samples/public_rejects_dynamic_and_non_string_hasattr_names.py +22 -0
- matchify-0.3.1/tests/code_samples/public_rejects_non_literal_and_starred_membership_containers.py +35 -0
- matchify-0.3.1/tests/code_samples/public_rejects_unsafe_equality_on_a_selected_subject.py +22 -0
- matchify-0.3.1/tests/code_samples/public_rejects_unsafe_identity_on_a_selected_subject.py +22 -0
- matchify-0.3.1/tests/code_samples/public_sequence_type_guard_preserves_runtime_for_other_sequence_types.py +23 -0
- matchify-0.3.1/tests/code_samples/public_sequence_type_guards_can_be_assumed_for_or_patterns.py +23 -0
- matchify-0.3.1/tests/code_samples/public_single_literal_membership_becomes_a_value_pattern.py +21 -0
- matchify-0.3.1/tests/code_samples/public_subscript_or_expression_does_not_hide_a_later_value_subject.py +25 -0
- matchify-0.3.1/tests/code_samples/sequence_list_assumption_does_not_apply_to_tuple_checks_list_assumed.py +22 -0
- matchify-0.3.1/tests/code_samples/sequence_list_check_requires_list_sequence_pattern_assumption_assumed.py +23 -0
- matchify-0.3.1/tests/code_samples/sequence_list_check_requires_list_sequence_pattern_assumption_safe.py +22 -0
- matchify-0.3.1/tests/code_samples/sequence_sequence_assumptions_do_not_apply_to_qualified_class_checks_both_assumed.py +31 -0
- matchify-0.3.1/tests/code_samples/sequence_tuple_check_requires_tuple_sequence_pattern_assumption_assumed.py +23 -0
- matchify-0.3.1/tests/code_samples/sequence_tuple_check_requires_tuple_sequence_pattern_assumption_safe.py +22 -0
- matchify-0.3.1/tests/code_samples/transform_all_negated_isinstance_chain_is_not_converted.py +18 -0
- matchify-0.3.1/tests/code_samples/transform_assumed_pure_and_subjects_use_a_composite_match_subject_pure_subjects.py +32 -0
- matchify-0.3.1/tests/code_samples/transform_assumed_pure_and_subjects_use_a_composite_match_subject_safe.py +31 -0
- matchify-0.3.1/tests/code_samples/transform_assumed_pure_and_subjects_use_a_composite_match_subject_use_object.py +31 -0
- matchify-0.3.1/tests/code_samples/transform_assumed_pure_attribute_subject_uses_object_patterns_pure_subjects.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_assumed_pure_attribute_subject_uses_object_patterns_safe.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_assumed_pure_attribute_subject_uses_object_patterns_use_object.py +28 -0
- matchify-0.3.1/tests/code_samples/transform_assumed_pure_attributes_with_one_root_share_one_object_pattern.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_assumed_pure_nested_attributes_get_recursive_object_patterns.py +31 -0
- matchify-0.3.1/tests/code_samples/transform_assumed_pure_subject_used_by_a_majority_joins_match_subject_pure_subjects.py +40 -0
- matchify-0.3.1/tests/code_samples/transform_attribute_access_variable.py +23 -0
- matchify-0.3.1/tests/code_samples/transform_bare_constants_are_not_value_patterns.py +22 -0
- matchify-0.3.1/tests/code_samples/transform_capture_does_not_replace_an_existing_value_pattern.py +25 -0
- matchify-0.3.1/tests/code_samples/transform_capture_only_body_becomes_pass.py +29 -0
- matchify-0.3.1/tests/code_samples/transform_capture_pattern_class_union.py +36 -0
- matchify-0.3.1/tests/code_samples/transform_capture_pattern_direct_sequence_subject.py +20 -0
- matchify-0.3.1/tests/code_samples/transform_capture_pattern_direct_sequence_subject_or_pattern.py +21 -0
- matchify-0.3.1/tests/code_samples/transform_capture_pattern_direct_star_sequence_subject.py +20 -0
- matchify-0.3.1/tests/code_samples/transform_capture_pattern_from_assignment.py +28 -0
- matchify-0.3.1/tests/code_samples/transform_capture_pattern_multi_attribute.py +31 -0
- matchify-0.3.1/tests/code_samples/transform_capture_pattern_multi_attribute_multiple_captures.py +33 -0
- matchify-0.3.1/tests/code_samples/transform_capture_pattern_multiple_values.py +29 -0
- matchify-0.3.1/tests/code_samples/transform_capture_pattern_nested_attribute.py +36 -0
- matchify-0.3.1/tests/code_samples/transform_capture_pattern_nested_class_union_sequence_attribute.py +44 -0
- matchify-0.3.1/tests/code_samples/transform_capture_pattern_non_consecutive_indices.py +29 -0
- matchify-0.3.1/tests/code_samples/transform_capture_pattern_non_consecutive_multi_gap.py +31 -0
- matchify-0.3.1/tests/code_samples/transform_capture_pattern_not_starting_from_zero.py +29 -0
- matchify-0.3.1/tests/code_samples/transform_capture_pattern_sequence_attribute_or_pattern.py +29 -0
- matchify-0.3.1/tests/code_samples/transform_capture_pattern_sequence_element_class_attribute.py +28 -0
- matchify-0.3.1/tests/code_samples/transform_capture_pattern_sequence_element_class_union_nested_attribute.py +36 -0
- matchify-0.3.1/tests/code_samples/transform_capture_pattern_three_values.py +30 -0
- matchify-0.3.1/tests/code_samples/transform_common_subject_is_built_from_branch_path_prefixes.py +41 -0
- matchify-0.3.1/tests/code_samples/transform_comparison_with_variable_not_converted.py +26 -0
- matchify-0.3.1/tests/code_samples/transform_complex_real_world_example.py +45 -0
- matchify-0.3.1/tests/code_samples/transform_convertible_chain_after_non_convertible_chain.py +83 -0
- matchify-0.3.1/tests/code_samples/transform_different_subjects_not_converted.py +26 -0
- matchify-0.3.1/tests/code_samples/transform_different_variables_not_converted.py +20 -0
- matchify-0.3.1/tests/code_samples/transform_duplicate_capture_index_uses_alias_assignment.py +30 -0
- matchify-0.3.1/tests/code_samples/transform_duplicate_capture_only_body_keeps_alias_without_pass.py +30 -0
- matchify-0.3.1/tests/code_samples/transform_f_string_attribute_check_becomes_guard.py +25 -0
- matchify-0.3.1/tests/code_samples/transform_f_string_sequence_element_check_becomes_guard.py +18 -0
- matchify-0.3.1/tests/code_samples/transform_f_string_value_pattern_not_converted.py +18 -0
- matchify-0.3.1/tests/code_samples/transform_function_call_converted.py +21 -0
- matchify-0.3.1/tests/code_samples/transform_guard_branch_with_else_is_not_converted.py +22 -0
- matchify-0.3.1/tests/code_samples/transform_if_elif_without_else.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_invalid_capture_assignments_stay_in_body.py +88 -0
- matchify-0.3.1/tests/code_samples/transform_is_none_converted.py +23 -0
- matchify-0.3.1/tests/code_samples/transform_isinstance_converted.py +31 -0
- matchify-0.3.1/tests/code_samples/transform_isinstance_none_type_becomes_singleton_pattern.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_isinstance_subscript_subject.py +29 -0
- matchify-0.3.1/tests/code_samples/transform_isinstance_tuple_converted.py +23 -0
- matchify-0.3.1/tests/code_samples/transform_isinstance_tuple_with_none_type_becomes_or_pattern.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_isinstance_with_and_converted.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_isinstance_with_is_none_attribute.py +31 -0
- matchify-0.3.1/tests/code_samples/transform_isinstance_with_is_true_false.py +29 -0
- matchify-0.3.1/tests/code_samples/transform_isinstance_with_multiple_and_converted.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_isinstance_with_nested_sequence_attributes.py +29 -0
- matchify-0.3.1/tests/code_samples/transform_isinstance_with_nested_sequence_in_sequence_attribute.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_isinstance_with_or_attribute.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_isinstance_with_sequence_and_nested_class_attributes.py +39 -0
- matchify-0.3.1/tests/code_samples/transform_isinstance_with_sequence_and_scalar_attributes.py +29 -0
- matchify-0.3.1/tests/code_samples/transform_isinstance_with_sequence_attribute_converted.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_isinstance_with_sequence_attribute_mixed_types.py +33 -0
- matchify-0.3.1/tests/code_samples/transform_leading_guard_branch_is_not_converted.py +18 -0
- matchify-0.3.1/tests/code_samples/transform_list_tuple_sequence_checks_require_both_assumptions_list_sequence_pattern.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_list_tuple_sequence_checks_require_both_assumptions_list_sequence_pattern_tuple_sequence_pattern.py +20 -0
- matchify-0.3.1/tests/code_samples/transform_list_tuple_sequence_checks_require_both_assumptions_safe.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_list_tuple_sequence_checks_require_both_assumptions_tuple_sequence_pattern.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_literal_membership_becomes_or_pattern.py +23 -0
- matchify-0.3.1/tests/code_samples/transform_literal_set_membership_requires_hashable_subjects_assumption_hashable_subjects.py +20 -0
- matchify-0.3.1/tests/code_samples/transform_literal_set_membership_requires_hashable_subjects_assumption_safe.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_many_branches_no_limit.py +59 -0
- matchify-0.3.1/tests/code_samples/transform_many_sibling_attributes_no_limit.py +43 -0
- matchify-0.3.1/tests/code_samples/transform_mixed_is_none_and_isinstance.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_mixed_operators_not_converted.py +18 -0
- matchify-0.3.1/tests/code_samples/transform_mixed_pattern_types_in_chain.py +41 -0
- matchify-0.3.1/tests/code_samples/transform_multiple_independent_if_chains.py +31 -0
- matchify-0.3.1/tests/code_samples/transform_multiple_sibling_attributes_with_literals.py +29 -0
- matchify-0.3.1/tests/code_samples/transform_multiple_statements_in_body.py +32 -0
- matchify-0.3.1/tests/code_samples/transform_negated_isinstance_chain_is_not_converted.py +18 -0
- matchify-0.3.1/tests/code_samples/transform_negative_numbers_in_attributes.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_negative_numbers_in_comparisons.py +23 -0
- matchify-0.3.1/tests/code_samples/transform_nested_attribute_non_literal_check_preserved_as_guard.py +31 -0
- matchify-0.3.1/tests/code_samples/transform_nested_if_not_affected.py +28 -0
- matchify-0.3.1/tests/code_samples/transform_nested_literal_membership_becomes_or_pattern.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_nested_sequence_attribute_relational_check_preserved_as_guard.py +35 -0
- matchify-0.3.1/tests/code_samples/transform_non_equality_comparisons_not_converted.py +18 -0
- matchify-0.3.1/tests/code_samples/transform_non_integer_sequence_subscripts_fall_back_to_guards.py +37 -0
- matchify-0.3.1/tests/code_samples/transform_numeric_comparisons.py +23 -0
- matchify-0.3.1/tests/code_samples/transform_or_class_pattern_with_common_attribute_check.py +33 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_different_subjects_not_converted.py +20 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_in_mixed_chain.py +31 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_mixed_types.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_simple.py +23 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_three_values.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_class_attribute_alternative.py +33 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_common_call_guard_stays_guard.py +35 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_common_simple_guard_is_lifted.py +35 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_deep_nested_class_redundant_hasattr.py +43 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_guarded_alternative_stays_guard.py +33 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_is_none.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_isinstance_classes.py +31 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_mixed_value_and_class_attribute_alternative.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_mixed_value_and_isinstance.py +25 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_negative_numbers.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_nested_class_redundant_hasattr.py +35 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_redundant_hasattr_class_attribute_alternative.py +33 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_safe_sequence_alternative_list_sequence_pattern_tuple_sequence_pattern.py +20 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_safe_sequence_alternative_safe.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_safe_sequence_attribute_alternative_list_sequence_pattern_tuple_sequence_pattern.py +28 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_safe_sequence_attribute_alternative_safe.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_sequence_alternative.py +25 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_sequence_attribute_alternative.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_sequence_element_redundant_hasattr.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_strings.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_or_pattern_with_variable_not_converted.py +20 -0
- matchify-0.3.1/tests/code_samples/transform_other_isinstance_classinfo_call_becomes_guard.py +25 -0
- matchify-0.3.1/tests/code_samples/transform_parenthesized_isinstance_class_converted.py +25 -0
- matchify-0.3.1/tests/code_samples/transform_plain_list_tuple_isinstance_becomes_class_pattern.py +31 -0
- matchify-0.3.1/tests/code_samples/transform_qualified_constants_become_value_patterns.py +31 -0
- matchify-0.3.1/tests/code_samples/transform_qualified_identity_requires_identity_equality_assumption_identity_equality.py +32 -0
- matchify-0.3.1/tests/code_samples/transform_qualified_identity_requires_identity_equality_assumption_safe.py +31 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_attribute_element_non_literal_check_preserved_as_guard.py +35 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_attribute_type_guard_preserves_len_check.py +28 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_element_beyond_checked_length_falls_back_to_guard.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_element_class_union_nested_attribute_redundant_hasattr.py +45 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_nested_element_non_literal_check_preserved_as_guard.py +35 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_many_elements_no_limit.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_missing_index_not_converted.py +18 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_simple.py +23 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_star_with_isinstance.py +23 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_star_with_wildcard_gap.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_three_elements.py +23 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_with_class_attribute_or_element.py +35 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_with_class_element_attributes.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_with_class_or_element.py +31 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_with_guard_condition.py +21 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_with_isinstance_and_is_none.py +23 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_with_isinstance_element.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_with_isinstance_tuple.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_with_isinstance_tuple_and_attribute.py +35 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_with_mixed_isinstance_and_literals.py +27 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_with_mixed_or_element.py +25 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_with_nested_class_attribute_or_element.py +41 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_with_nested_class_element_attributes.py +35 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_with_or_element.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_with_safe_nested_class_attribute_or_element.py +41 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_with_star.py +23 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_with_strings.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_with_subject_guard_condition.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_with_variable_element_guard.py +20 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_pattern_without_len_not_converted.py +18 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_with_deeply_nested_sequence.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_with_multiple_nested_sequences.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_with_nested_class_in_element.py +29 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_with_nested_sequence_and_isinstance.py +25 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_with_nested_sequence_simple.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_with_nested_sequence_strings.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_sequence_with_nested_star_sequence.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_simple_if_elif_else_chain.py +23 -0
- matchify-0.3.1/tests/code_samples/transform_simple_if_only_not_converted.py +14 -0
- matchify-0.3.1/tests/code_samples/transform_singleton_membership_is_not_converted.py +18 -0
- matchify-0.3.1/tests/code_samples/transform_tuple_comparisons_are_not_converted.py +30 -0
- matchify-0.3.1/tests/code_samples/transform_unary_plus_numbers_are_normalized_in_patterns.py +29 -0
- matchify-0.3.1/tests/code_samples/transform_unsafe_set_membership_is_not_converted_hashable_subjects.py +68 -0
- matchify-0.3.1/tests/code_samples/transform_walrus_guard_is_preserved.py +37 -0
- matchify-0.3.1/tests/code_samples/transform_wildcard_pattern_at_end.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_wildcard_pattern_at_start.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_wildcard_pattern_multiple_groups.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_wildcard_pattern_not_used_for_mixed.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_wildcard_pattern_simple.py +23 -0
- matchify-0.3.1/tests/code_samples/transform_wildcard_pattern_three_consecutive_not_converted.py +18 -0
- matchify-0.3.1/tests/code_samples/transform_wildcard_pattern_two_consecutive.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_wildcard_pattern_with_is_none.py +19 -0
- matchify-0.3.1/tests/code_samples/transform_wildcard_pattern_with_isinstance.py +23 -0
- matchify-0.3.1/tests/test_assumptions.py +50 -0
- matchify-0.3.1/tests/test_cli.py +2496 -0
- matchify-0.3.1/tests/test_code_samples.py +195 -0
- matchify-0.3.1/tests/test_conversion_filter.py +172 -0
- matchify-0.3.1/tests/test_documentation.py +129 -0
- matchify-0.2.0/tests/test_find_new_issue_2.py → matchify-0.3.1/tests/test_find_pattern_coverage_issue.py +1 -1
- matchify-0.3.1/tests/test_internal_coverage.py +107 -0
- matchify-0.3.1/tests/test_issue_code_samples.py +173 -0
- matchify-0.3.1/tests/test_lookup_tables.py +20 -0
- matchify-0.3.1/tests/test_planning.py +310 -0
- {matchify-0.2.0 → matchify-0.3.1}/uv.lock +22 -97
- matchify-0.2.0/.copier-enforce.json +0 -5
- matchify-0.2.0/src/matchify/assumptions.py +0 -93
- matchify-0.2.0/src/matchify/cli.py +0 -209
- matchify-0.2.0/src/matchify/transform.py +0 -175
- matchify-0.2.0/tests/helpers.py +0 -64
- matchify-0.2.0/tests/samples/.gitkeep +0 -0
- matchify-0.2.0/tests/test_cli.py +0 -867
- matchify-0.2.0/tests/test_edge_cases.py +0 -1913
- matchify-0.2.0/tests/test_generated_roundtrip.py +0 -114
- matchify-0.2.0/tests/test_guard_rendering.py +0 -33
- matchify-0.2.0/tests/test_lookup_tables.py +0 -284
- matchify-0.2.0/tests/test_public_coverage.py +0 -359
- matchify-0.2.0/tests/test_readme.py +0 -81
- matchify-0.2.0/tests/test_sequence_assumptions.py +0 -101
- matchify-0.2.0/tests/test_transform.py +0 -5388
- {matchify-0.2.0 → matchify-0.3.1}/.github/FUNDING.yml +0 -0
- {matchify-0.2.0 → matchify-0.3.1}/.github/pull_request_template.md +0 -0
- {matchify-0.2.0 → matchify-0.3.1}/.gitignore +0 -0
- {matchify-0.2.0 → matchify-0.3.1}/CONTRIBUTING.md +0 -0
- {matchify-0.2.0 → matchify-0.3.1}/COPIER_TEMPLATE_CHANGES.md +0 -0
- {matchify-0.2.0 → matchify-0.3.1}/LICENSE +0 -0
- {matchify-0.2.0 → matchify-0.3.1}/changelog.d/.gitignore +0 -0
- {matchify-0.2.0 → matchify-0.3.1}/limitations.md +0 -0
- {matchify-0.2.0 → matchify-0.3.1}/src/matchify/__init__.py +0 -0
- {matchify-0.2.0 → matchify-0.3.1}/src/matchify/__main__.py +0 -0
- {matchify-0.2.0 → matchify-0.3.1}/src/matchify/capture_patterns.py +0 -0
- {matchify-0.2.0 → matchify-0.3.1}/test-repos.json +0 -0
- {matchify-0.2.0 → matchify-0.3.1}/test-repos.py +0 -0
- {matchify-0.2.0 → matchify-0.3.1}/tests/test_access_path.py +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Changes here will be overwritten by Copier
|
|
2
|
-
_commit: v0.
|
|
2
|
+
_commit: v0.5.0
|
|
3
3
|
_src_path: https://github.com/15r10nk/project-template.git
|
|
4
4
|
author_email: 15r10nk@polarbit.de
|
|
5
5
|
author_name: Frank Hoffmann
|
|
@@ -15,10 +15,10 @@ project_name: matchify
|
|
|
15
15
|
pypy_versions:
|
|
16
16
|
- pypy3.11
|
|
17
17
|
python_versions:
|
|
18
|
-
- '3.10'
|
|
19
18
|
- '3.11'
|
|
20
19
|
- '3.12'
|
|
21
20
|
- '3.13'
|
|
22
21
|
- '3.14'
|
|
23
22
|
show_project_logo: false
|
|
24
|
-
|
|
23
|
+
test_lowest_deps: true
|
|
24
|
+
use_mkdocs: true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
tests/code_samples/*.py text eol=lf
|
|
@@ -11,12 +11,12 @@ runs:
|
|
|
11
11
|
using: composite
|
|
12
12
|
steps:
|
|
13
13
|
- name: Install uv
|
|
14
|
-
uses: astral-sh/setup-uv@
|
|
14
|
+
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
|
15
15
|
with:
|
|
16
16
|
python-version: ${{inputs.python-version}}
|
|
17
17
|
|
|
18
18
|
- name: Set up Python
|
|
19
|
-
uses: actions/setup-python@
|
|
19
|
+
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
20
20
|
with:
|
|
21
21
|
python-version: ${{inputs.python-version}}
|
|
22
22
|
allow-prereleases: true
|
|
@@ -19,7 +19,7 @@ jobs:
|
|
|
19
19
|
tag: ${{steps.release.outputs.tag}}
|
|
20
20
|
|
|
21
21
|
steps:
|
|
22
|
-
- uses: actions/checkout@
|
|
22
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
23
23
|
|
|
24
24
|
- name: Detect merged release pull request
|
|
25
25
|
id: release
|
|
@@ -45,7 +45,7 @@ jobs:
|
|
|
45
45
|
|
|
46
46
|
strategy:
|
|
47
47
|
matrix:
|
|
48
|
-
python-version: ['3.
|
|
48
|
+
python-version: ['3.11', '3.12', '3.13', '3.14', pypy3.11]
|
|
49
49
|
|
|
50
50
|
os: [ubuntu-latest, windows-latest, macos-15]
|
|
51
51
|
lowest_resolution: [false]
|
|
@@ -59,11 +59,6 @@ jobs:
|
|
|
59
59
|
os: macos-15
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
- os: macos-15
|
|
63
|
-
python-version: '3.11'
|
|
64
|
-
- os: windows-latest
|
|
65
|
-
python-version: '3.11'
|
|
66
|
-
|
|
67
62
|
- os: macos-15
|
|
68
63
|
python-version: '3.12'
|
|
69
64
|
- os: windows-latest
|
|
@@ -81,7 +76,7 @@ jobs:
|
|
|
81
76
|
|
|
82
77
|
include:
|
|
83
78
|
- os: ubuntu-latest
|
|
84
|
-
python-version: '3.
|
|
79
|
+
python-version: '3.11'
|
|
85
80
|
lowest_resolution: true
|
|
86
81
|
- os: ubuntu-latest
|
|
87
82
|
python-version: '3.14'
|
|
@@ -92,7 +87,7 @@ jobs:
|
|
|
92
87
|
TOP: ${{github.workspace}}
|
|
93
88
|
COVERAGE_PROCESS_START: ${{github.workspace}}/pyproject.toml
|
|
94
89
|
steps:
|
|
95
|
-
- uses: actions/checkout@
|
|
90
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
96
91
|
- uses: ./.github/actions/setup
|
|
97
92
|
with:
|
|
98
93
|
python-version: ${{matrix.python-version}}
|
|
@@ -102,23 +97,23 @@ jobs:
|
|
|
102
97
|
run: |
|
|
103
98
|
uv lock --upgrade --resolution lowest-direct
|
|
104
99
|
uv sync --locked --resolution lowest-direct
|
|
105
|
-
uv pip install coverage coverage-enable-subprocess pytest pytest-xdist
|
|
100
|
+
uv pip install "coverage[toml]" coverage-enable-subprocess pytest pytest-xdist
|
|
106
101
|
|
|
107
102
|
- name: Test locked dependencies
|
|
108
103
|
if: ${{ !matrix.lowest_resolution }}
|
|
109
|
-
run: uv run --locked --with coverage --with coverage-enable-subprocess --with pytest --with pytest-xdist -m ${{ matrix.os == 'ubuntu-latest' && 'coverage run -m' || '' }} pytest -n=auto -vv
|
|
104
|
+
run: uv run --locked --with "coverage[toml]" --with coverage-enable-subprocess --with pytest --with pytest-xdist -m ${{ matrix.os == 'ubuntu-latest' && 'coverage run -m' || '' }} pytest -n=auto -vv
|
|
110
105
|
|
|
111
106
|
- name: Test lowest direct dependencies
|
|
112
107
|
if: matrix.lowest_resolution
|
|
113
108
|
run: uv run --no-sync -m coverage run -m pytest -n=auto -vv
|
|
114
109
|
|
|
115
110
|
- run: |
|
|
116
|
-
uv run ${{ matrix.lowest_resolution && '--no-sync' || '--with coverage' }} -m coverage combine
|
|
111
|
+
uv run ${{ matrix.lowest_resolution && '--no-sync' || '--with "coverage[toml]"' }} -m coverage combine
|
|
117
112
|
mv .coverage .coverage.${{ matrix.python-version }}-${{matrix.os}}-${{strategy.job-index}}
|
|
118
113
|
if: matrix.os == 'ubuntu-latest'
|
|
119
114
|
|
|
120
115
|
- name: Upload coverage data
|
|
121
|
-
uses: actions/upload-artifact@
|
|
116
|
+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
122
117
|
if: matrix.os == 'ubuntu-latest'
|
|
123
118
|
with:
|
|
124
119
|
name: coverage-data-${{github.run_id}}-${{ matrix.python-version }}-${{matrix.os}}-${{strategy.job-index}}
|
|
@@ -126,6 +121,21 @@ jobs:
|
|
|
126
121
|
include-hidden-files: true
|
|
127
122
|
if-no-files-found: ignore
|
|
128
123
|
|
|
124
|
+
mypy:
|
|
125
|
+
name: Type check (${{matrix.python-version}})
|
|
126
|
+
runs-on: ubuntu-latest
|
|
127
|
+
strategy:
|
|
128
|
+
matrix:
|
|
129
|
+
python-version: ['3.11', '3.12', '3.13', '3.14']
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
steps:
|
|
133
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
134
|
+
- uses: ./.github/actions/setup
|
|
135
|
+
with:
|
|
136
|
+
python-version: ${{matrix.python-version}}
|
|
137
|
+
- run: uv run --locked --with mypy mypy src tests
|
|
138
|
+
|
|
129
139
|
coverage:
|
|
130
140
|
name: Combine & check coverage
|
|
131
141
|
env:
|
|
@@ -135,28 +145,28 @@ jobs:
|
|
|
135
145
|
runs-on: ubuntu-latest
|
|
136
146
|
|
|
137
147
|
steps:
|
|
138
|
-
- uses: actions/checkout@
|
|
148
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
139
149
|
- uses: ./.github/actions/setup
|
|
140
150
|
|
|
141
|
-
- uses: actions/download-artifact@
|
|
151
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
142
152
|
with:
|
|
143
153
|
pattern: coverage-data-${{github.run_id}}-*
|
|
144
154
|
merge-multiple: true
|
|
145
155
|
|
|
146
156
|
- name: Combine coverage & fail if it's <100%
|
|
147
157
|
run: |
|
|
148
|
-
uv run --with coverage coverage combine
|
|
149
|
-
uv run --with coverage coverage html --skip-covered --skip-empty
|
|
158
|
+
uv run --with "coverage[toml]" coverage combine
|
|
159
|
+
uv run --with "coverage[toml]" coverage html --skip-covered --skip-empty
|
|
150
160
|
|
|
151
161
|
# Report and write to summary.
|
|
152
|
-
uv run --with coverage coverage report --format=markdown >> "$GITHUB_STEP_SUMMARY"
|
|
162
|
+
uv run --with "coverage[toml]" coverage report --format=markdown >> "$GITHUB_STEP_SUMMARY"
|
|
153
163
|
|
|
154
164
|
# Report again and fail if under 100%.
|
|
155
|
-
uv run --with coverage coverage report
|
|
165
|
+
uv run --with "coverage[toml]" coverage report
|
|
156
166
|
|
|
157
167
|
|
|
158
168
|
- name: Upload HTML report if check failed
|
|
159
|
-
uses: actions/upload-artifact@
|
|
169
|
+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
160
170
|
with:
|
|
161
171
|
name: html-report
|
|
162
172
|
path: htmlcov
|
|
@@ -165,7 +175,7 @@ jobs:
|
|
|
165
175
|
|
|
166
176
|
publish:
|
|
167
177
|
name: Publish new release
|
|
168
|
-
needs: [detect_release, test, coverage]
|
|
178
|
+
needs: [detect_release, test, mypy, coverage]
|
|
169
179
|
if: needs.detect_release.outputs.is_release == 'true' && !contains(github.repository, '-insiders/')
|
|
170
180
|
runs-on: ubuntu-latest
|
|
171
181
|
environment: pypi
|
|
@@ -174,11 +184,28 @@ jobs:
|
|
|
174
184
|
id-token: write
|
|
175
185
|
|
|
176
186
|
steps:
|
|
187
|
+
- name: Create GitHub App token
|
|
188
|
+
id: app-token
|
|
189
|
+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
|
190
|
+
with:
|
|
191
|
+
client-id: ${{vars.RELEASE_APP_CLIENT_ID}}
|
|
192
|
+
private-key: ${{secrets.RELEASE_APP_PRIVATE_KEY}}
|
|
193
|
+
permission-contents: write
|
|
194
|
+
|
|
177
195
|
- name: Checkout tested commit
|
|
178
|
-
uses: actions/checkout@
|
|
196
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
179
197
|
with:
|
|
180
198
|
fetch-depth: 0
|
|
181
|
-
token: ${{
|
|
199
|
+
token: ${{steps.app-token.outputs.token}}
|
|
200
|
+
|
|
201
|
+
- name: Check release tag does not exist
|
|
202
|
+
env:
|
|
203
|
+
TAG: ${{needs.detect_release.outputs.tag}}
|
|
204
|
+
run: |
|
|
205
|
+
if git ls-remote --exit-code --tags origin "refs/tags/$TAG" >/dev/null 2>&1; then
|
|
206
|
+
echo "::error::Release tag $TAG already exists"
|
|
207
|
+
exit 1
|
|
208
|
+
fi
|
|
182
209
|
|
|
183
210
|
- uses: ./.github/actions/setup
|
|
184
211
|
with:
|
|
@@ -187,23 +214,17 @@ jobs:
|
|
|
187
214
|
- name: Build distributions
|
|
188
215
|
run: uvx hatch build
|
|
189
216
|
|
|
190
|
-
- name:
|
|
217
|
+
- name: Publish package distributions to PyPI
|
|
218
|
+
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
|
|
219
|
+
|
|
220
|
+
- name: Tag and push tested commit
|
|
191
221
|
env:
|
|
192
222
|
TAG: ${{needs.detect_release.outputs.tag}}
|
|
193
223
|
run: |
|
|
194
224
|
git config user.name github-actions[bot]
|
|
195
225
|
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
else
|
|
199
|
-
git tag --annotate "$TAG" --message "Release $TAG"
|
|
200
|
-
git push origin "$TAG"
|
|
201
|
-
fi
|
|
202
|
-
|
|
203
|
-
- name: Publish package distributions to PyPI
|
|
204
|
-
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
|
|
205
|
-
with:
|
|
206
|
-
skip-existing: true
|
|
226
|
+
git tag --annotate "$TAG" --message "Release $TAG"
|
|
227
|
+
git push origin "$TAG"
|
|
207
228
|
|
|
208
229
|
- name: Create GitHub release
|
|
209
230
|
env:
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: deploy development docs
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [main]
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
build:
|
|
8
|
+
name: Deploy development docs
|
|
9
|
+
if: "!contains(github.repository, '-insiders/')"
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout main
|
|
15
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
16
|
+
|
|
17
|
+
- name: Set up documentation mutex
|
|
18
|
+
uses: suzuki-shunsuke/lock-action@4a69996f86294a4eacc7450392eb70804b6543c4 # v0.2.0
|
|
19
|
+
with:
|
|
20
|
+
mode: lock
|
|
21
|
+
key: docs-lock
|
|
22
|
+
post_unlock: 'true'
|
|
23
|
+
remove_key_when_unlock: 'true'
|
|
24
|
+
max_wait_seconds: '500'
|
|
25
|
+
wait_interval_seconds: '50'
|
|
26
|
+
|
|
27
|
+
- run: pip install hatch
|
|
28
|
+
- name: publish docs
|
|
29
|
+
env:
|
|
30
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
31
|
+
run: |
|
|
32
|
+
git config user.name "Frank Hoffmann"
|
|
33
|
+
git config user.email "15r10nk@users.noreply.github.com"
|
|
34
|
+
git fetch origin '+refs/heads/*:refs/remotes/origin/*' --depth=1
|
|
35
|
+
hatch run docs:deploy deploy --push development
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Publish docs via GitHub Pages
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
tags:
|
|
5
|
+
- v[0-9]+.[0-9]+.[0-9]+
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
name: Deploy docs for new version
|
|
10
|
+
if: "!contains(github.repository, '-insiders/')"
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
contents: write
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout main
|
|
16
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
17
|
+
|
|
18
|
+
- name: Set up documentation mutex
|
|
19
|
+
uses: suzuki-shunsuke/lock-action@4a69996f86294a4eacc7450392eb70804b6543c4 # v0.2.0
|
|
20
|
+
with:
|
|
21
|
+
mode: lock
|
|
22
|
+
key: docs-lock
|
|
23
|
+
post_unlock: 'true'
|
|
24
|
+
remove_key_when_unlock: 'true'
|
|
25
|
+
max_wait_seconds: '500'
|
|
26
|
+
wait_interval_seconds: '50'
|
|
27
|
+
|
|
28
|
+
- run: pip install hatch
|
|
29
|
+
- run: hatch version | sed -rne "s:([0-9]*)\.([0-9]*)\..*:PROJECT_VERSION=\1.\2:p" >> "${GITHUB_ENV}"
|
|
30
|
+
- name: publish docs
|
|
31
|
+
env:
|
|
32
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
33
|
+
run: |
|
|
34
|
+
git config user.name "Frank Hoffmann"
|
|
35
|
+
git config user.email "15r10nk@users.noreply.github.com"
|
|
36
|
+
git fetch origin '+refs/heads/*:refs/remotes/origin/*' --depth=1
|
|
37
|
+
hatch run docs:deploy deploy -u --push "${PROJECT_VERSION}" latest
|
|
@@ -22,7 +22,7 @@ jobs:
|
|
|
22
22
|
fetch-depth: 0
|
|
23
23
|
|
|
24
24
|
- name: Set up uv
|
|
25
|
-
uses: astral-sh/setup-uv@
|
|
25
|
+
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
|
26
26
|
with:
|
|
27
27
|
python-version: '3.13'
|
|
28
28
|
|
|
@@ -38,10 +38,19 @@ jobs:
|
|
|
38
38
|
- name: Run pre-commit
|
|
39
39
|
run: uvx pre-commit run --all-files || uvx pre-commit run --all-files
|
|
40
40
|
|
|
41
|
+
- name: Create GitHub App token
|
|
42
|
+
id: app-token
|
|
43
|
+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
|
44
|
+
with:
|
|
45
|
+
client-id: ${{vars.RELEASE_APP_CLIENT_ID}}
|
|
46
|
+
private-key: ${{secrets.RELEASE_APP_PRIVATE_KEY}}
|
|
47
|
+
permission-contents: write
|
|
48
|
+
permission-pull-requests: write
|
|
49
|
+
|
|
41
50
|
- name: Create pull request
|
|
42
51
|
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
|
|
43
52
|
with:
|
|
44
|
-
token: ${{
|
|
53
|
+
token: ${{steps.app-token.outputs.token}}
|
|
45
54
|
branch: release/v${{steps.release.outputs.version}}
|
|
46
55
|
commit-message: 'chore: release v${{steps.release.outputs.version}}'
|
|
47
56
|
title: 'chore: release v${{steps.release.outputs.version}}'
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
name: Test release on TestPyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- release/v*
|
|
7
|
+
|
|
8
|
+
concurrency:
|
|
9
|
+
group: test-release-${{ github.ref }}
|
|
10
|
+
cancel-in-progress: false
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test-release:
|
|
14
|
+
name: Publish and test release candidate
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
environment: testpypi
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
id-token: write
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- name: Checkout release branch
|
|
23
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
24
|
+
|
|
25
|
+
- name: Set up uv
|
|
26
|
+
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
|
|
27
|
+
with:
|
|
28
|
+
python-version: '3.13'
|
|
29
|
+
|
|
30
|
+
- name: Install test environment without the local project
|
|
31
|
+
run: |
|
|
32
|
+
uv sync --locked --no-install-project
|
|
33
|
+
uv pip install pytest pytest-xdist
|
|
34
|
+
|
|
35
|
+
- name: Set unique TestPyPI version
|
|
36
|
+
id: package
|
|
37
|
+
run: |
|
|
38
|
+
project_name="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["name"])')"
|
|
39
|
+
base_version="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
|
|
40
|
+
test_version="${base_version}.dev${GITHUB_RUN_ID}${GITHUB_RUN_ATTEMPT}"
|
|
41
|
+
uvx hatch version --force "$test_version"
|
|
42
|
+
echo "name=$project_name" >> "$GITHUB_OUTPUT"
|
|
43
|
+
echo "version=$test_version" >> "$GITHUB_OUTPUT"
|
|
44
|
+
|
|
45
|
+
- name: Build distributions
|
|
46
|
+
run: uvx hatch build
|
|
47
|
+
|
|
48
|
+
- name: Publish distributions to TestPyPI
|
|
49
|
+
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
|
|
50
|
+
with:
|
|
51
|
+
repository-url: https://test.pypi.org/legacy/
|
|
52
|
+
attestations: false
|
|
53
|
+
|
|
54
|
+
- name: Install published distribution from TestPyPI
|
|
55
|
+
env:
|
|
56
|
+
PROJECT_NAME: ${{ steps.package.outputs.name }}
|
|
57
|
+
TEST_VERSION: ${{ steps.package.outputs.version }}
|
|
58
|
+
run: |
|
|
59
|
+
for attempt in {1..10}; do
|
|
60
|
+
if uv pip install \
|
|
61
|
+
--no-deps \
|
|
62
|
+
--index-url https://test.pypi.org/simple/ \
|
|
63
|
+
"$PROJECT_NAME==$TEST_VERSION"; then
|
|
64
|
+
exit 0
|
|
65
|
+
fi
|
|
66
|
+
if test "$attempt" -eq 10; then
|
|
67
|
+
exit 1
|
|
68
|
+
fi
|
|
69
|
+
sleep 10
|
|
70
|
+
done
|
|
71
|
+
|
|
72
|
+
- name: Verify installed version
|
|
73
|
+
env:
|
|
74
|
+
PROJECT_NAME: ${{ steps.package.outputs.name }}
|
|
75
|
+
TEST_VERSION: ${{ steps.package.outputs.version }}
|
|
76
|
+
run: |
|
|
77
|
+
uv run --no-sync python -c \
|
|
78
|
+
'import importlib.metadata, os; assert importlib.metadata.version(os.environ["PROJECT_NAME"]) == os.environ["TEST_VERSION"]'
|
|
79
|
+
|
|
80
|
+
- name: Test installed distribution
|
|
81
|
+
run: uv run --no-sync python -m pytest -n=auto -vv
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: test docs
|
|
2
|
+
on:
|
|
3
|
+
pull_request:
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
name: Deploy development docs
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
steps:
|
|
10
|
+
- name: Checkout main
|
|
11
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
12
|
+
|
|
13
|
+
- run: pip install hatch
|
|
14
|
+
- name: test docs
|
|
15
|
+
run: |
|
|
16
|
+
hatch run docs:build --strict
|
|
@@ -19,12 +19,12 @@ jobs:
|
|
|
19
19
|
fetch-depth: 0
|
|
20
20
|
|
|
21
21
|
- name: Set up Python
|
|
22
|
-
uses: actions/setup-python@
|
|
22
|
+
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
23
23
|
with:
|
|
24
24
|
python-version: '3.12'
|
|
25
25
|
|
|
26
26
|
- name: Set up uv
|
|
27
|
-
uses: astral-sh/setup-uv@
|
|
27
|
+
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
|
28
28
|
|
|
29
29
|
- name: Run cog update
|
|
30
30
|
run: |
|
|
@@ -32,11 +32,20 @@ jobs:
|
|
|
32
32
|
uvx gha-update
|
|
33
33
|
uvx pre-commit run --all-files || uvx pre-commit run --all-files
|
|
34
34
|
|
|
35
|
+
- name: Create GitHub App token
|
|
36
|
+
id: app-token
|
|
37
|
+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
|
38
|
+
with:
|
|
39
|
+
client-id: ${{vars.RELEASE_APP_CLIENT_ID}}
|
|
40
|
+
private-key: ${{secrets.RELEASE_APP_PRIVATE_KEY}}
|
|
41
|
+
permission-contents: write
|
|
42
|
+
permission-pull-requests: write
|
|
43
|
+
permission-workflows: write
|
|
44
|
+
|
|
35
45
|
- name: Create Pull Request
|
|
36
46
|
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
|
|
37
47
|
with:
|
|
38
|
-
token: ${{
|
|
39
|
-
branch-token: ${{secrets.PAT_WEEKLY_UPDATE}}
|
|
48
|
+
token: ${{steps.app-token.outputs.token}}
|
|
40
49
|
commit-message: 'chore: weekly cog update'
|
|
41
50
|
title: 'chore: weekly update'
|
|
42
51
|
body: Automated weekly update via scheduled workflow.
|
|
@@ -5,13 +5,6 @@ ci:
|
|
|
5
5
|
autoupdate_schedule: monthly
|
|
6
6
|
|
|
7
7
|
repos:
|
|
8
|
-
|
|
9
|
-
- repo: https://github.com/15r10nk/project-template
|
|
10
|
-
rev: v0.3.2
|
|
11
|
-
hooks:
|
|
12
|
-
- id: copier-enforce
|
|
13
|
-
|
|
14
|
-
|
|
15
8
|
- hooks:
|
|
16
9
|
- id: check-ast
|
|
17
10
|
- id: check-merge-conflict
|
|
@@ -22,48 +15,52 @@ repos:
|
|
|
22
15
|
- id: check-json
|
|
23
16
|
- id: end-of-file-fixer
|
|
24
17
|
repo: https://github.com/pre-commit/pre-commit-hooks
|
|
25
|
-
rev:
|
|
18
|
+
rev: v6.0.0
|
|
26
19
|
- hooks:
|
|
27
20
|
- args:
|
|
28
21
|
- --in-place
|
|
29
22
|
- --expand-star-imports
|
|
30
23
|
- --remove-all-unused-imports
|
|
31
24
|
- --ignore-init-module-imports
|
|
25
|
+
exclude: ^tests/code_samples/
|
|
32
26
|
id: autoflake
|
|
33
27
|
repo: https://github.com/myint/autoflake
|
|
34
|
-
rev: v2.
|
|
28
|
+
rev: v2.4.0
|
|
35
29
|
|
|
36
30
|
- repo: https://github.com/asottile/setup-cfg-fmt
|
|
37
|
-
rev:
|
|
31
|
+
rev: v3.2.0
|
|
38
32
|
hooks:
|
|
39
33
|
- id: setup-cfg-fmt
|
|
40
34
|
|
|
41
35
|
- repo: https://github.com/pycqa/isort
|
|
42
|
-
rev:
|
|
36
|
+
rev: 9.0.1
|
|
43
37
|
hooks:
|
|
44
38
|
- id: isort
|
|
39
|
+
exclude: ^tests/code_samples/
|
|
45
40
|
name: isort (python)
|
|
46
41
|
|
|
47
42
|
- hooks:
|
|
48
43
|
- args:
|
|
49
44
|
- --py310-plus
|
|
45
|
+
exclude: ^tests/code_samples/
|
|
50
46
|
id: pyupgrade
|
|
51
47
|
language_version: python3.13
|
|
52
48
|
repo: https://github.com/asottile/pyupgrade
|
|
53
|
-
rev: v3.
|
|
49
|
+
rev: v3.21.2
|
|
54
50
|
- hooks:
|
|
55
51
|
- id: black
|
|
52
|
+
exclude: ^tests/code_samples/
|
|
56
53
|
repo: https://github.com/psf/black
|
|
57
|
-
rev:
|
|
54
|
+
rev: 26.5.1
|
|
58
55
|
- hooks:
|
|
59
56
|
- id: blacken-docs
|
|
60
57
|
args: [-l80]
|
|
61
58
|
repo: https://github.com/adamchainz/blacken-docs
|
|
62
|
-
rev: 1.
|
|
59
|
+
rev: 1.20.0
|
|
63
60
|
|
|
64
61
|
|
|
65
62
|
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
|
|
66
|
-
rev: v2.
|
|
63
|
+
rev: v2.16.0
|
|
67
64
|
hooks:
|
|
68
65
|
- id: pretty-format-yaml
|
|
69
66
|
args: [--autofix, --indent, '2']
|
|
@@ -73,26 +70,26 @@ repos:
|
|
|
73
70
|
stages:
|
|
74
71
|
- commit-msg
|
|
75
72
|
repo: https://github.com/commitizen-tools/commitizen
|
|
76
|
-
rev: v4.
|
|
73
|
+
rev: v4.19.0
|
|
77
74
|
|
|
78
75
|
- repo: https://github.com/abravalheri/validate-pyproject
|
|
79
|
-
rev:
|
|
76
|
+
rev: '0.26'
|
|
80
77
|
hooks:
|
|
81
78
|
- id: validate-pyproject
|
|
82
79
|
|
|
83
80
|
- repo: https://github.com/henryiii/validate-pyproject-schema-store
|
|
84
|
-
rev:
|
|
81
|
+
rev: 2026.09.19
|
|
85
82
|
hooks:
|
|
86
83
|
- id: validate-pyproject
|
|
87
84
|
|
|
88
85
|
|
|
89
86
|
- repo: https://github.com/rhysd/actionlint
|
|
90
|
-
rev: v1.7.
|
|
87
|
+
rev: v1.7.12
|
|
91
88
|
hooks:
|
|
92
89
|
- id: actionlint
|
|
93
90
|
|
|
94
91
|
- repo: https://github.com/crate-ci/typos
|
|
95
|
-
rev: v1.
|
|
92
|
+
rev: v1.50.2
|
|
96
93
|
hooks:
|
|
97
94
|
- id: typos
|
|
98
95
|
exclude: ^COPIER_TEMPLATE_CHANGES\.md$
|
|
@@ -20,6 +20,7 @@ Matchify converts eligible `if`/`elif`/`else` chains into Python 3.10+
|
|
|
20
20
|
patterns.
|
|
21
21
|
- `src/matchify/cli.py` implements file processing and the CLI;
|
|
22
22
|
`src/matchify/__main__.py` is the `python -m matchify` entry point.
|
|
23
|
+
- `src/matchify/diff.py` renders conversion diffs for `--show`.
|
|
23
24
|
|
|
24
25
|
## Transformation principles
|
|
25
26
|
|
|
@@ -54,17 +55,27 @@ Matchify converts eligible `if`/`elif`/`else` chains into Python 3.10+
|
|
|
54
55
|
4. Run the focused test, then the full suite:
|
|
55
56
|
|
|
56
57
|
```bash
|
|
57
|
-
uv run pytest tests/
|
|
58
|
+
uv run pytest tests/test_code_samples.py -k <case>
|
|
58
59
|
uv run pytest
|
|
59
60
|
```
|
|
60
61
|
|
|
61
62
|
The test suite is organized as follows:
|
|
62
63
|
|
|
63
|
-
- `tests/
|
|
64
|
-
|
|
64
|
+
- `tests/code_samples/`: source-to-source behavior and rejection cases, including
|
|
65
|
+
assumption and conversion-filter variants. The generic `tests/test_code_samples.py`
|
|
66
|
+
test checks expected output, runtime traces, and idempotence.
|
|
65
67
|
- `tests/test_cli.py`: file processing and CLI behavior.
|
|
66
|
-
-
|
|
67
|
-
|
|
68
|
+
- The remaining API and internal tests cover diagnostics, previews, planning,
|
|
69
|
+
data structures, documentation, and the code-sample infrastructure.
|
|
70
|
+
|
|
71
|
+
Code samples contain `# before:`, `# after:`, `# assume:`, and `# trace:` sections.
|
|
72
|
+
Use optional `# ignore-types:` and `# convert-if:` lines for transformation options.
|
|
73
|
+
Generated samples may also contain a `# reference:` code section between `# after:`
|
|
74
|
+
and `# assume:`. The generic test compares its runtime trace with the original
|
|
75
|
+
program, preserving the independent oracle for generator failures.
|
|
76
|
+
Supply executable setup and print observed results; use separate samples for
|
|
77
|
+
different option combinations. Keep API assertions that cannot be expressed by
|
|
78
|
+
source snapshots and runtime traces in ordinary tests.
|
|
68
79
|
|
|
69
80
|
Use `textwrap.dedent()` for multiline source fixtures and temporary directories
|
|
70
81
|
for filesystem tests. Test both successful conversions and nearby cases that
|