Skip to content

New 'auto_command_starting' signal when 'nikola auto' is starting.#3513

Merged
Kwpolska merged 4 commits into
getnikola:masterfrom
matthew16550:signal_auto_command_starting
Feb 18, 2021
Merged

New 'auto_command_starting' signal when 'nikola auto' is starting.#3513
Kwpolska merged 4 commits into
getnikola:masterfrom
matthew16550:signal_auto_command_starting

Conversation

@matthew16550
Copy link
Copy Markdown
Contributor

Pull Request Checklist

  • I’ve read the guidelines for contributing.
  • I updated AUTHORS.txt and CHANGES.txt (if the change is non-trivial) and documentation (if applicable).
  • I tested my changes.

Description

When adding support for the PlantUML PicoWeb server (getnikola/plugins#378) I would like nikola auto to start one PicoWeb server and share it with all child build processes. So the plantuml plugin needs to know when nikola auto is happening.

The simplest solution I've thought of is a new auto_command_starting signal but perhaps something like these more generic solutions would be preferred?

  • A new command_starting signal including command name as a param
  • BasePlugin.get_command_name()

(Haven't looked closely if either of those is actually possible)

@matthew16550
Copy link
Copy Markdown
Contributor Author

The build is failing on an unrelated test and I haven't been able to reproduce it locally as yet. 😢

    def test_compiling_markdown(
        compiler, input_path, output_path, input_str, expected_output
    ):
        output = markdown_compile(compiler, input_path, output_path, input_str)
>       assert output.strip() == expected_output.strip()
E       assert '<table class...</tr></table>' == '<table class...</tr></table>'
E         Skipping 73 identical leading characters in diff, use -v to show
E         - div"><pre>1</pre></div></td><td class="code"><pre class="code literal-block"><span></span><code><span class="kn">from</span> <span class="nn">this</span>
E         + div"><pre><span class="normal">1</span></pre></div></td><td class="code"><pre class="code literal-block"><span></span><code><span class="kn">from</span> <span class="nn">this</span>
E         ?           +++++++++++++++++++++ +++++++
E           </code></pre>
E           </td></tr></table>

@matthew16550
Copy link
Copy Markdown
Contributor Author

Made #3514 for why the build is failiing.

@Kwpolska
Copy link
Copy Markdown
Member

A new command_starting signal including command name as a param

What commands, other than auto (and perhaps build) could make use of that?

(Although build could end up allowing people to do fairly ugly things; it does make sense to use this in auto to launch PlantUML, or perhaps some JS/CSS live compiler.)

Comment thread nikola/plugins/command/auto/__init__.py Outdated
@Kwpolska Kwpolska merged commit f86046f into getnikola:master Feb 18, 2021
@Kwpolska
Copy link
Copy Markdown
Member

I merged the auto_command_starting version, if there are any other commands which could use a signal (I don’t really think we need more), you can open further PRs. A signal for any command seems unnecessary to me (it also becomes harder to catch).

@matthew16550 matthew16550 deleted the signal_auto_command_starting branch February 18, 2021 23:01
@matthew16550
Copy link
Copy Markdown
Contributor Author

matthew16550 commented Feb 18, 2021

What commands, other than auto (and perhaps build) could make use of that?

Hadn't thought of any other use cases, just thinking out loud.

Thanks for finishing this one.

devilgate pushed a commit to devilgate/nikola that referenced this pull request Jul 14, 2021
…etnikola#3513)

* New 'auto_command_starting' signal when 'nikola auto' is starting.

* Move auto_command_starting to a better place

Co-authored-by: Chris Warrick <kwpolska@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants