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

Allow loading of plugins via entry_points #185

Merged
merged 8 commits into from
Nov 29, 2023
Merged

Conversation

domna
Copy link
Collaborator

@domna domna commented Nov 28, 2023

The reader can basically refactored out as is, we just have to add a pyproject.toml with the following entrypoint specification:

[project.entry-points."pynxtools.reader"]
test = "test_reader:MyReaderClass"

where test is the name of the reader referred by --reader and MyReaderClass is the reader class in the file.

A working example can be found in https://github.com/FAIRmat-NFDI/pynxtools-stm for the sts/stm reader.

@domna domna requested a review from sherjeelshabih November 28, 2023 14:04
@coveralls
Copy link

coveralls commented Nov 28, 2023

Pull Request Test Coverage Report for Build 7021204778

  • 8 of 13 (61.54%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.6%) to 51.029%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pynxtools/dataconverter/convert.py 8 13 61.54%
Files with Coverage Reduction New Missed Lines %
pynxtools/dataconverter/helpers.py 1 96.28%
pynxtools/nexus/nxdl_utils.py 1 75.16%
Totals Coverage Status
Change from base Build 7017248188: -0.6%
Covered Lines: 5828
Relevant Lines: 11421

💛 - Coveralls

@sherjeelshabih
Copy link
Collaborator

This works really nicely. I have tested the stm reader and it gets loaded correctly.

As we discussed, the next thing would be to have a testing strategy.

Also, we will need a list of reader plugins in this repo to help users find them.

@domna
Copy link
Collaborator Author

domna commented Nov 28, 2023

We could build a cookiecutter template to get people started with developing their own readers

@domna domna changed the title Allow loading of plugins via entry_points plugins Allow loading of plugins via entry_points Nov 29, 2023
@domna domna merged commit b4516e9 into master Nov 29, 2023
4 checks passed
@domna domna deleted the entrypoints-plugins branch November 29, 2023 10:56
domna added a commit that referenced this pull request Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants