-
Notifications
You must be signed in to change notification settings - Fork 1
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
module and package names #17
Comments
Can you share the generated |
I am able to reproduce this for this repo you've created. I think my advice here would be to not set different names for the [1/12] full_name (John Doe):
[2/12] email ([email protected]):
[3/12] github_username (foo):
[4/12] plugin_name (foobar): my-plugin-name
[5/12] module_name (my_plugin_name): After entering the |
Hey Ahmed, thank you. What do you think about erasing completely the possibility to prompt a module name? It led me to this mistake so I guess also other people can do the same. Also, I did not realize that the name in parenthesis was the already filled name, I though it was just showing which package I was in while setting the module name |
Good point about the mistake there. I'll see if removing the option has any effects on the cruft update mechanism, if it does maybe we have to change the message so that it's clearer you don't have to enter anything as the module_name. |
@lauri-codes do we really assume the the package name has to be the same as the module name (with "-" replaced b "_"). I think this is a bit odd. What if someones package contains multiple top level modules? The python import works fine, I'm not sure where you make the assumption about the package name based on the module name but I guess it's on the lines Andrea mentioned above. Here is the error you get when trying to run the appworker and showing that it works in python for completeness: importlib.metadata.PackageNotFoundError: nomad_my_plugin
- thread_name: MainThread
- timestamp: 2024-05-23 14:21.44
(.pyenv) [hampusnasstrom@Fair-5430-01 nomad]$ python
Python 3.9.18 (main, Aug 28 2023, 00:00:00)
[GCC 12.3.1 20230508 (Red Hat 12.3.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from nomad_my_plugin.schema_packages import mypackage
>>> |
I believe it's something setuptools does, well more inside the What do you get when you run the following? from importlib.metadata import version, metadata
metadata('nomad_my_plugin') |
<email.message.Message object at 0x7f18756cb4c0> |
That's` a bit weird, cause in nomad we run the same code But you get a |
I changed back and forth between the working name in between and it seems like the appworker is running now. Could be something cached maybe... |
I don't really follow: I thought that the cookiecutter asks you about the repository name (by convention should be something like |
The template asks for two names - The But the python package is located in The two can be different but what I've noticed is that, if it's different sometimes setuptools doesn't build the package with the right metadata. So the |
I see. A few notes:
Examples:
To me the template should not be made overly complicated. If the user wants some kind of extra special naming or multiple top-level packages to be installed from a single |
Not necessarily. This template was forked from the pytest template, and there they had the used the same I'll keep this issue open until we find a satisfactory solution to this but in the mean time I'll update the question to let the user know that they don't have to answer it and just press continue. |
If I set the package name and the module name to be different, the plugin will not be loaded.
Indeed at line 1091 of the file nomad/config/models/config.py, the package_name variable is not the correct one
@hampusnasstrom @blueraft
The text was updated successfully, but these errors were encountered: