Closed cnstt closed 2 years ago
this is a bug in cookiecutter fixed in #119 (not merged yet). This is problem of lack of __all__
in __init__
Thanks a lot! Will there be a way to "update" a plugin afterwards with this change or is a manual intervention needed?
Thanks a lot! Will there be a way to "update" a plugin afterwards with this change or is a manual intervention needed?
Based on my knowledge there is a need for manually fixing.
You need to add this line to __init__.py
__all__ = ("napari_get_reader", "write_annotations_xml", "denoise_widget", "reorder_widget", "AddPointsWidget", "Orthoslice")
Note on updating, we don’t have this in our docs, but if you use cruft instead of cookiecutter when starting the project, you can use it’s update feature
(I also have this issue with pre-commit https://github.com/pre-commit/pre-commit/issues/2411, but this is probably not related to #119)
pre-commit is also changing package name from package-name to package_name, although I was fine with the current name...
You can remove setup-cfg precommit if you’d like
You can remove setup-cfg precommit if you’d like
For the moment I just totally removed setup-cfg as it was creating too much trouble for me ^^
Yep; you should feel free to add/remove anything you want to tune it to your liking
pre-commit is also changing package name from package-name to package_name, although I was fine with the current name...
First, it is strongly suggested to use an underscore in the package name https://peps.python.org/pep-0008/#package-and-module-names
At second, because of the naming convention of files in pypi warehouse the distributable files (sdist, wheel) will have underscore, nod dash in name, so using dash will introduce a little inconsistency.
What led me to choose the package name with the dash is:
- the setup process of cookiecutter "napari-foobar"
Maybe we should fix this
First, it is strongly suggested to use an underscore in the package name https://peps.python.org/pep-0008/#package-and-module-names
I disagree... from the pep you linked @Czaki:
Modules should have short, all-lowercase names. Underscores can be used in the module name if it improves readability. Python packages should also have short, all-lowercase names, although the use of underscores is discouraged.
That actually doesn't state that a package named napari-foobar
is incorrect. In fact, there's plenty of info to suggest that pypi itself will convert underscores to dashes for the package name. (In any case, when you pip install, it will work either way). So, in my opinion, setup-cfg format is wrong in this particular case.
in fact, we actually prohibit underscores in package names during the cookiecutter process:
This has been discussed before on zulip... so let's stick with our current behavior. if you want to disable setup-cfg format, that's fine
When running pre-commit, it deletes some imports in the init (of this package https://github.com/deep-finder/napari-deepfinder ) that are necessary for the testing to work properly:
Is this the wanted behaviour for pre-commit? Because maybe I using it the wrong way, but it is causing more damage than improvements for me currently ...