initial Python support #44
No reviewers
Labels
No labels
Compat/Breaking
Kind
Bad merge
Kind
Bug
Kind
Documentation
Kind
Enhancement
Kind
Feature
Kind
New language
Kind
Security
Kind
Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: mergiraf/mergiraf#44
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "rvalyi/mergiraf:add-python"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
initial Python support. Please consider this might be incomplete or contain mistakes. However I could test it successfully in an Odoo (actually OCA/l10n-brazil) repo as shown in the screenshot. I could later test that the conflict resolutions are correct, which is great.
Thank you so much for Mergiraf, it seems it has a huge potential for us in the OCA Odoo open source community!
Thank you very much for having a go at it :)
@ -307,0 +310,4 @@
language: tree_sitter_python::LANGUAGE.into(),
atomic_nodes: vec![],
commutative_parents: vec![
CommutativeParent::without_delimiters("module", "\n"),
Given that Python can have top-level instructions in a module (for instance in a simple Python script, meant to be executed on its own), this is dangerous because it lets the tool reorder instructions whose order matters, no?
I have recently added support for restricting commutativity and I think it would be a good use case here, for instance to only let import statements commute. See the docs here: https://mergiraf.org/adding-a-language.html#adding-children-groups
Hello I have seen this and I thought exactly the same. I'm not too sure what the exact expression should be though.
I use import sorting in all my python project (via ruff format), which would also run via a precommit hock after the merge succeeds...
In my book it's a bug if you rely on module level code, but I guess from a conservative standpoint, order does matter...
@ -307,0 +318,4 @@
signature("class_definition", vec![vec![Field("name")]]),
signature("function_definition", vec![
vec![Field("name")],
vec![Field("parameters")]
I was under the impression that Python doesn't make it possible to declare two different functions with the same name and different parameter lists, so I would expect that the parameters are not part of the signature. Do you see it differently?
you are correct, this is a mistake, I'll fix it in a few hours.
It's not impossible to do, e.g. I've seen this pattern:
This is valid python code
(it's valid even without the monkey patching: func is simply a variable which got the functon assigned, doesn't matter if the func has a different signature. It's for sure not wise python code and probably all linter will flag that duplication...)
I've proposed some improvements here: rvalyi/mergiraf#1
Great, this looks good to merge once the conflicts are resolved (which I can do if you want)
I've merged it manually in
d57720185b
.Pull request closed