Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: move sopel.run_script to sopel.cli.run #1493

Merged
merged 21 commits into from
Mar 20, 2019
Merged

Conversation

Exirel
Copy link
Contributor

@Exirel Exirel commented Feb 28, 2019

Related to #1471

This move the sopel/run_script.py file to sopel/cli/run.py, and updates the sopel command line tool's interface:

  • sopel start replaces the default behavior (run the bot)
  • sopel stop replaces the --quit/--kill options
  • sopel restart replaces the --restart option
  • sopel configure replaces the -w/--configure-all/--configure-modules options

The -v option for "version" is deprecated, -V/--version should be used instead.

By default, sopel works as before (100% backward compatible), but adds some warning here and there when needed (when using --restart/--quit/--kill for example).

This is all thanks to #1472 being merged.

@Exirel Exirel force-pushed the sopel-cli-run branch 3 times, most recently from e597d36 to 09ebef7 Compare February 28, 2019 18:09
@Exirel Exirel marked this pull request as ready for review February 28, 2019 22:31
@dgw dgw added this to the 7.0.0 milestone Mar 1, 2019
@dgw dgw added the Feature label Mar 1, 2019
Copy link
Member

@dgw dgw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can check the Travis build logs for all the gory details, but to summarize:

  • There are unused imports left in sopel/__init__.py (linting error).
  • Some of the cli.run tests fail.

I'll wait until you have a chance to fix the tests to do a more in-depth review.

Copy link
Member

@dgw dgw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions, and a lot of docstring tweaks as usual. I put as many grammar/spelling changes in suggestions as I could, as promised on IRC. 😸

I don't love the duplication of control logic between the legacy parser and the newer subcommands, but it's also probably not worth refactoring out. The legacy mode will only be around for Sopel 7, I think, so the duplicated code will be removed in a year or so.

I do love that this adds the new CLI structure in a transitional state while still keeping the old syntax around. The release notes for Sopel 7 can warn about the upcoming CLI changes, and users can have time to update their service units/scripts/etc.

This makes me glad I merged #1472. 🙌

sopel/cli/run.py Show resolved Hide resolved
sopel/cli/run.py Outdated Show resolved Hide resolved
sopel/cli/run.py Outdated Show resolved Hide resolved
sopel/cli/run.py Outdated Show resolved Hide resolved
sopel/cli/run.py Outdated Show resolved Hide resolved
sopel/cli/run.py Outdated Show resolved Hide resolved
sopel/cli/run.py Outdated Show resolved Hide resolved
sopel/cli/run.py Show resolved Hide resolved
sopel/cli/run.py Outdated Show resolved Hide resolved
sopel/cli/run.py Show resolved Hide resolved
@Exirel
Copy link
Contributor Author

Exirel commented Mar 4, 2019

I do love that this adds the new CLI structure in a transitional state while still keeping the old syntax around. The release notes for Sopel 7 can warn about the upcoming CLI changes, and users can have time to update their service units/scripts/etc.

Thank you! I'm quite happy with how you manage the project, and how you review and comment the PR & issues we send you. It's a happy collaboration so far!

Copy link
Member

@dgw dgw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With all the bigger issues from my last review taken care of (that I can see—this is a big diff!), I moved on to some nagging questions about the future.

Some of the legacy options have no counterpart in the revamped CLI, but aren't marked as deprecated, which makes me wonder. And one of them (--migrate) has been broken for almost six years! 🤣 Let's weigh the decision on that one in its line note, where I already discussed some pros and cons.

Loved the new, detailed docstrings for stuff like get_configuration! My next questions will be about test coverage of the new CLI (since you updated several tests to just use the legacy parser), so if you want to get ahead of me… 😉 Both old and new should probably be tested, to be fair.

sopel/cli/run.py Outdated Show resolved Hide resolved
sopel/cli/run.py Show resolved Hide resolved
sopel/cli/run.py Show resolved Hide resolved
sopel/cli/run.py Show resolved Hide resolved
sopel/cli/run.py Show resolved Hide resolved
sopel/cli/run.py Outdated Show resolved Hide resolved
@dgw
Copy link
Member

dgw commented Mar 5, 2019

Leaving a note for @Exirel upon request: Amend stderr -> tools.stderr in import header, too. As we discussed on IRC, the version check up there might just get removed, but separately.

@Exirel
Copy link
Contributor Author

Exirel commented Mar 5, 2019

Some of the legacy options have no counterpart in the revamped CLI, but aren't marked as deprecated, which makes me wonder.

Indeed! I would like to mark them as deprecated once there is a proper replacement. For example the list-config option should be replaced when I'll redo PR #1465 (cli: sopel-config), using the work done in this PR. So it's work for later.

Loved the new, detailed docstrings for stuff like get_configuration!

Thanks!

My next questions will be about test coverage of the new CLI [...] Both old and new should probably be tested, to be fair.

Yeah. These tests were added when I reworked the run_script.py file, and I should probably write more.

sopel/cli/run.py Show resolved Hide resolved
@dgw
Copy link
Member

dgw commented Mar 5, 2019

OK, I kicked Travis to get the PR status reported correctly (for some reason it finished all builds and reported the commit status, but not the PR status).

Future work on remaining legacy options like --list is left for the future. I assume more tests will be a future thing too?

If that's correct, all that's left is for me to sit down and actually run this code on both py2 and py3, when I have time to do that. Assuming that all works, this will get ✔️ Approved and merged as-is. 🎉

@Exirel
Copy link
Contributor Author

Exirel commented Mar 11, 2019

Future work on remaining legacy options like --list is left for the future. I assume more tests will be a future thing too?

If that's correct, all that's left is for me to sit down and actually run this code on both py2 and py3, when I have time to do that. Assuming that all works, this will get ✔️ Approved and merged as-is. 🎉

Yes it is! Now glhf with your manual tests for these changes, it took me some times on my side!

@Exirel
Copy link
Contributor Author

Exirel commented Mar 19, 2019

Rebased upon master. Nothing broke, AFAICT, but it might be dangerous to keep this PR open for too long, given its scope.

@dgw dgw merged commit d2e7a16 into sopel-irc:master Mar 20, 2019
@dgw
Copy link
Member

dgw commented Mar 20, 2019

it might be dangerous to keep this PR open for too long, given its scope

You're right about that. I merged it without performing excessive amounts of testing, but we will have plenty of time to fix bugs between now and when Sopel 7 actually ships. 😎

@Exirel
Copy link
Contributor Author

Exirel commented Mar 20, 2019

BOLD MERGE ❤️

@dgw
Copy link
Member

dgw commented Mar 20, 2019

*sees 👀 what you did there*

@Exirel Exirel deleted the sopel-cli-run branch March 21, 2019 08:34
HumorBaby added a commit to HumorBaby/sopel that referenced this pull request Apr 16, 2019
Because of the `time.sleep` during the disconnect phase, the signal
handling is thrown off and a new bot is spawned before the `bot.hasquit`
flag can be checked. Add a check at the top of the loop to see if the
`hasquit` flag was set during a disconnect.

Fixes sopel-irc#1478. Reapplied because of changes from sopel-irc#1493.
dgw added a commit that referenced this pull request Apr 16, 2019
…dling

core: reapply part of interrupt fix after #1493 moved things
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants