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

API for accessing auxiliary files #65

Closed
Wuestengecko opened this issue Mar 2, 2022 · 3 comments
Closed

API for accessing auxiliary files #65

Wuestengecko opened this issue Mar 2, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@Wuestengecko
Copy link
Member

In addition to the model itself, there can also exist auxiliary files next to it. These files are defined by users of the model. This will be especially useful in conjunction with the GitFileHandler or similar, where such files would be downloaded automatically and transparently to the user.

In order to implement this functionality, we first need to define an appropriate API:

  1. How files can be accessed from a MelodyModel instance.
  2. How the MelodyLoader provides access to the underlying file handler.
  3. How to access directories and enumerate files in them.

The first two points can be solved in a very simple and effective manner by exposing the actual FileHandler object. This allows the FileHandler to implement any arbitrary API without having to worry about name collisions with attributes of the model object.

For the last point we can implement a PathLike API. This is both user friendly and allows code that works with pathlib.Path objects to also transparently handle files in the file handler.

@Wuestengecko Wuestengecko added the enhancement New feature or request label Mar 2, 2022
@henrik429
Copy link
Contributor

This issue is obsolete by using libaries properly, i.e. instantiation a RPL from REC, right?

@Wuestengecko
Copy link
Member Author

No, this has nothing to do with libraries. In fact, the original feature request actually was never about the MelodyModel at all, but came from someone who is using the GitFileHandler outside of a model context for accessing git repos with arbitrary (non-Capella-related) files. However, having this functionality implemented in a more generic way may also be useful for working with files that are closely related to a model, but not bound to it by the meta-model.

@Wuestengecko
Copy link
Member Author

This is now possible by using the FileHandler objects from the model.resources dictionary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants