Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tree-like data structures and reorganization of dynamic import modules #25

Open
4 of 10 tasks
timbernat opened this issue Oct 18, 2024 · 0 comments
Open
4 of 10 tasks
Assignees
Labels
api breaking Will change how codes invoking a part of polymerist will be written deprecation Planned retirement of a module, class, or function enhancement New feature or request

Comments

@timbernat
Copy link
Owner

timbernat commented Oct 18, 2024

Many types of Python data structures lend themselves very naturally to being recast as trees; look no further than Python packages or pathlib Paths (where modules and file paths are the corresponding "leaf" objects, respectively). A unifying treatment of the correspondence to trees for abstract types would go a long way in eliminating boilerplate and increasing cohesiveness for may applications.

Further, the addition of a tree-like interface to Python packages (based on anytree) would make much of the current genutils.importutils obsolete, both in terms of dynamic imports and GNU tree emulation.

These two observations motivate several restructures to polymerist which would greatly simplify and systematize how tree and package
operations are handled

  • Implement a TypeToNodeCorrespondence abstract base class which allows one to define treelike behavior for arbitrary classes
    • Provide a concrete implementation for Path objects
    • Provide a concrete implementation for Python packages
    • Provide generic API for traversing and filtering through trees by arbitrary conditions
  • Convert the current importutils module into a subpackage
  • Reimplement genutils.fileutils.filetree with actual filetrees
  • Write unit tests for all of the above
@timbernat timbernat self-assigned this Oct 18, 2024
@timbernat timbernat added enhancement New feature or request api breaking Will change how codes invoking a part of polymerist will be written deprecation Planned retirement of a module, class, or function labels Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api breaking Will change how codes invoking a part of polymerist will be written deprecation Planned retirement of a module, class, or function enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant