You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The QGIS plugin manager currently allows the addition of plugins with folder names containing characters that do not comply with Python package naming conventions, such as hyphens (-). Since these plugins are intended to be imported as Python modules within PyQGIS, this can lead to import issues.
According to Python's official guidelines for package naming (PEP 8), module names should use only lowercase letters, digits, and underscores (_). Hyphens and other invalid characters may cause problems when attempting to import the plugin as a Python module.
Proposed solution
Add stricter validation in the QGIS plugin uploader to ensure that plugin folder names comply with Python's package naming rules. Specifically, ensure that:
Only lowercase letters, digits, and underscores (_) are allowed.
Hyphens (-) and other non-valid characters are disallowed.
Additionally, in the meanwhile, the QGIS plugin's uploader should be handle equivalent names by considering underscores as hyphens, like many Python projects which have to deal with those situations (typer, argparse...): profile-manager = profile_manager
Impact
Enforcing this rule would prevent plugins from being unusable or causing errors during importation in PyQGIS scripts.
For reference:
Python's official PEP 8 outlines the naming conventions for packages and modules.
The Python Packaging Authority guide provides additional insights into the importance of proper naming conventions for importable packages.
The text was updated successfully, but these errors were encountered:
Enforcing this name validation is a good idea if I prevent potential import errors, but before deploying it, I think that it would be wise to check how many plugins currently available doesn't comply with this convention. There is certaintly quite a lot of plugins containing uppercase letter in there root folder name. If this affect a lot of plugins, a community wide annoucement might be in order to avoid taking developers by surprise.
The QGIS plugin manager currently allows the addition of plugins with folder names containing characters that do not comply with Python package naming conventions, such as hyphens (
-
). Since these plugins are intended to be imported as Python modules within PyQGIS, this can lead to import issues.According to Python's official guidelines for package naming (PEP 8), module names should use only lowercase letters, digits, and underscores (
_
). Hyphens and other invalid characters may cause problems when attempting to import the plugin as a Python module.Proposed solution
Add stricter validation in the QGIS plugin uploader to ensure that plugin folder names comply with Python's package naming rules. Specifically, ensure that:
_
) are allowed.-
) and other non-valid characters are disallowed.Additionally, in the meanwhile, the QGIS plugin's uploader should be handle equivalent names by considering underscores as hyphens, like many Python projects which have to deal with those situations (typer, argparse...):
profile-manager
=profile_manager
Impact
Enforcing this rule would prevent plugins from being unusable or causing errors during importation in PyQGIS scripts.
For reference:
The text was updated successfully, but these errors were encountered: