getnikola / nikola

A static website and blog generator
https://getnikola.com/
MIT License
2.58k stars 443 forks source link

nikola plugin --upgrade broken #3737

Closed msghens closed 2 months ago

msghens commented 6 months ago

Environment

Python Version: Python 3.8.10

Nikola Version: Nikola v8.3.0

Operating System: Windows Subsystem for Linux

NAME="Ubuntu" VERSION="20.04.6 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.6 LTS" VERSION_ID="20.04"

Description:

When command nikola plugin --upgrade is run in a site directory, I get:

 nikola plugin --upgrade
[2024-01-12 06:32:54] WARNING: plugin: This is not very smart, it just reinstalls some plugins and hopes for the best
Traceback (most recent call last):
  File "/home/msghens/nik/lib/python3.8/site-packages/doit/doit_cmd.py", line 294, in run
    return command.parse_execute(args)
  File "/home/msghens/nik/lib/python3.8/site-packages/doit/cmd_base.py", line 150, in parse_execute
    return self.execute(params, args)
  File "/home/msghens/nik/lib/python3.8/site-packages/nikola/plugin_categories.py", line 131, in execute
    return self._execute(options, args)
  File "/home/msghens/nik/lib/python3.8/site-packages/nikola/plugins/command/plugin.py", line 152, in _execute
    return self.do_upgrade(url)
  File "/home/msghens/nik/lib/python3.8/site-packages/nikola/plugins/command/plugin.py", line 200, in do_upgrade
    for plugin in self.site.plugin_manager.getAllPlugins():
AttributeError: 'PluginManager' object has no attribute 'getAllPlugins'
Kwpolska commented 6 months ago

Gotta love dynamic languages that let you have obviously broken code. (Fix in PR #3738)

felixfontein commented 6 months ago

Gotta love dynamic languages that let you have obviously broken code. (Fix in PR #3738)

I guess we should add a type checker like mypy to CI.

Kwpolska commented 6 months ago

I agree mypy would be a great addition, but very few places in Nikola have types, and we probably have a bunch of hacks that were considered Pythonic back in the day, but don’t really work in a fully-typed environment; or who-cares-about-structure things like tuples or dicts instead of classes. mypy currently produces a ton of warnings even without --strict. I opened #3739 for future work on type annotations.

Mte90 commented 5 months ago

This will fix also this error?

 mte90    nikola plugin
[2024-02-13 10:10:54] ERROR: Nikola: Unknown command plugin
[2024-02-13 10:10:54] INFO: Nikola: Did you mean "clean"?

With the latest 8.3.0

Mte90 commented 3 months ago

just a ping

Kwpolska commented 2 months ago

Released v8.3.1 with a fix.