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

Pynxtools plugins don't get proper boolean flags #18

Open
lukaspie opened this issue Jan 30, 2025 · 2 comments
Open

Pynxtools plugins don't get proper boolean flags #18

lukaspie opened this issue Jan 30, 2025 · 2 comments

Comments

@lukaspie
Copy link

Hi @hampusnasstrom, thanks for creating this plugin, this is certainly something that's quite helpful the bigger the ecosystem grows.

During your presentation, I noticed that for some of the plugins we are devloping, the boolean flags don't seem to match my expectations.

Image

  • pynxtools is present on both central and test-oasis
  • pynxtools-igor is present on the test-oasis

See for comparison screenshots from the production deployment:

Image

and the test-oasis:

Image

May this be related to how we are installing the plugins in the pyproject.toml file? For some of the pynxtools-adjacent plugins, we are not explicitly stating them in the nomad-distro pyproject.toml, but rather we install them using the convert extra to the pynxtools installation, see e.g. https://gitlab.mpcdf.mpg.de/nomad-lab/nomad-distro/-/blob/test-oasis/pyproject.toml?ref_type=heads#L30. I guess the crawler does not resolve these right? In that case, it probably makes sense to omit the convert extra and just state all of the pynxtools-* plugins individually.

Thanks!

@hampusnasstrom
Copy link
Collaborator

Ah, this will definitely be the issue. This is basically how I find if it's on the given distribution:
https://github.com/FAIRmat-NFDI/nomad-plugins/blob/main/src/nomad_plugins/plugin_crawler.py#L173-L175

def in_distribution_toml(plugin_name: str, pyproject_data: dict) -> bool:
    """
    Checks if a given plugin name is listed in the plugin dependencies of a
    pyproject.toml file.
    Args:
        plugin_name (str): The name of the plugin to check for.
        toml_data (dict): An dictionary containing the pyproject toml data.
    Returns:
        bool: True if the plugin name is found in the optional dependencies, False
              otherwise.
    """
    name_pattern = re.compile(r'^[^;>=<\s]+')
    plugin_dependencies = pyproject_data['project']['optional-dependencies']['plugins']
    return plugin_name in [name_pattern.match(d).group() for d in plugin_dependencies]

plugins depending on other plugins would definitely be an issue. The quick fix is of course to change how they are listed but ideally the crawler could somehow figure this out. I'll have to think a bit on how this could be done.

@blueraft
Copy link
Collaborator

The nomad-distro/requirements.txt file should have all of the dependencies that were resolved. So matching based on that list would fix this issue.

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

No branches or pull requests

3 participants