Environment:
- Python version: 3.8
- Click version: 8.1
The click.version_option uses the module name to get the package version :
|
if f_globals is not None: |
|
package_name = f_globals.get("__name__") |
|
|
|
if package_name == "__main__": |
|
package_name = f_globals.get("__package__") |
|
|
|
if package_name: |
|
package_name = package_name.partition(".")[0] |
But module name and package name are not always equivalent. This could be crash when the module name not the same as the package name, eg. open-mmlab/mim#152
Environment:
The click.version_option uses the module name to get the package version :
click/src/click/decorators.py
Lines 410 to 417 in 08f71b0
But module name and package name are not always equivalent. This could be crash when the module name not the same as the package name, eg. open-mmlab/mim#152