[GH-ISSUE #501] Remove dependency mptt library #387

Closed
opened 2026-02-25 21:31:49 +03:00 by kerem · 2 comments
Owner

Originally created by @ciur on GitHub (Dec 31, 2022).
Original GitHub issue: https://github.com/ciur/papermerge/issues/501

Originally assigned to: @ciur on GitHub.

Remove the dependency on the following packages:

There are couple of reasons why above dependencies should be removed:

  1. libraries are buggy and are not well maintained.
  2. standard SQL now support with recursive statement i.e. common table expressions = cte which are useful when searching through hierarchies.

mptt is especially problematic as the tree structure is maintained in application level using extra attributes (left and right) and

  1. there is a full "tree rebuild" on every insert (very dubious practice) - left/right attributes need to be updated for all nodes!
  2. If there is a bug/error while "rebuilding tree" - the whole tree may become corrupt which is to say that some folder and documents just vanish from the radar - which is to say "not good"!

The funny part is that mptt/polymorphic/polymorphic tree is very easy to replace with own code.

Originally created by @ciur on GitHub (Dec 31, 2022). Original GitHub issue: https://github.com/ciur/papermerge/issues/501 Originally assigned to: @ciur on GitHub. Remove the dependency on the following packages: - [polymorphic_tree](https://github.com/django-polymorphic/django-polymorphic-tree) - [polymorphic](https://github.com/django-polymorphic/django-polymorphic) - [django-mptt](https://github.com/django-mptt/django-mptt) There are couple of reasons why above dependencies should be removed: 1. libraries are buggy and are not well maintained. 2. standard SQL now support `with recursive` statement i.e. `common table expressions = cte` which are useful when searching through hierarchies. mptt is especially problematic as the tree structure is maintained in application level using extra attributes (left and right) and 1. there is a full "tree rebuild" on every insert (very dubious practice) - left/right attributes need to be updated for all nodes! 2. If there is a bug/error while "rebuilding tree" - the whole tree may become corrupt which is to say that some folder and documents just vanish from the radar - which is to say "not good"! The funny part is that mptt/polymorphic/polymorphic tree is very easy to replace with own code.
kerem 2026-02-25 21:31:49 +03:00
Author
Owner

@ciur commented on GitHub (Dec 31, 2022):

Work in progress...

<!-- gh-comment-id:1368186780 --> @ciur commented on GitHub (Dec 31, 2022): Work in progress...
Author
Owner

@ciur commented on GitHub (Jan 1, 2023):

PR papermerge/papermerge-core#107
PR papermerge/papermerge.js#37

<!-- gh-comment-id:1368384999 --> @ciur commented on GitHub (Jan 1, 2023): [PR papermerge/papermerge-core#107](https://github.com/papermerge/papermerge-core/pull/107) [PR papermerge/papermerge.js#37](https://github.com/papermerge/papermerge.js/pull/37)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/papermerge#387
No description provided.