Skip to content

[WIP] CLI options refactoring#1079

Closed
fjarri wants to merge 11 commits intonucypher:masterfrom
fjarri:cli-options-refactoring
Closed

[WIP] CLI options refactoring#1079
fjarri wants to merge 11 commits intonucypher:masterfrom
fjarri:cli-options-refactoring

Conversation

@fjarri
Copy link
Contributor

@fjarri fjarri commented Jun 15, 2019

This PR intends to simplify CLI option processing (mostly the ones related to logging) and remove duplicate options, which will in turn pave way for fixing issue #1018

Note: this branch started as a fix for issue #1018, but got transformed into CLI option rearrangement. Perhaps the last commit should be a separate PR

Public API changes:

  1. All options are now specified after commands. That is, if before one would call

     $ nucypher alice --debug init --federated-only
    

    after the PR the syntax would be

     $ nucypher alice init --debug --federated-only
    

    Cons:

    • this goes somewhat against click philosophy (see this click issue).
    • there is some amount of "magic" in config.py required for this to work.

    Pros:

    • this helps avoid code duplication (for option definition and processing).
    • this helps user discover these options in --help. That is, if before, in order to find out about --debug, one would have to call nucypher --help in addition to nucypher alice --help, now just nucypher alice --help will be enough - all the options will be there.
  2. Added --no-sentry option to turn off Sentry logging.

  3. --debug now just sets/unsets certain otherwise available CLI options (TODO: to be determined which ones exactly), acting as a shortcut.

  4. NUCYPHER_SENTRY_LOGS and NUCYPHER_FILE_LOGS have stricter requirements for their contents (whatever strtobool can recognize)

  5. TODO: --verbose sets the logging level

  6. TODO: add an option to turn off banners

Internal changes:

  1. GlobalLogger class manages all logging and observers.

  2. TODO: get rid of emit methods in random classes and use standard existing logging facilities?

@fjarri fjarri requested a review from KPrasch June 15, 2019 06:54
@KPrasch KPrasch added CLI This effects the nucypher CLI Enhancement New or improved features labels Jun 15, 2019
@codecov
Copy link

codecov bot commented Jun 19, 2019

Codecov Report

Merging #1079 into master will increase coverage by 0.09%.
The diff coverage is 91.97%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1079      +/-   ##
==========================================
+ Coverage   83.38%   83.47%   +0.09%     
==========================================
  Files          67       67              
  Lines        8770     8801      +31     
==========================================
+ Hits         7313     7347      +34     
+ Misses       1457     1454       -3
Impacted Files Coverage Δ
nucypher/cli/characters/moe.py 66.66% <0%> (ø) ⬆️
nucypher/cli/characters/ursula.py 67.67% <100%> (-3.12%) ⬇️
nucypher/cli/characters/bob.py 72.85% <100%> (-1.8%) ⬇️
nucypher/cli/characters/enrico.py 79.41% <100%> (ø) ⬆️
nucypher/cli/characters/alice.py 77.88% <100%> (-1.17%) ⬇️
nucypher/cli/main.py 100% <100%> (+8.06%) ⬆️
nucypher/cli/characters/felix.py 68.68% <100%> (-0.32%) ⬇️
nucypher/cli/actions.py 78.07% <100%> (ø) ⬆️
nucypher/utilities/logging.py 82.95% <88%> (+17.32%) ⬆️
nucypher/cli/config.py 91.27% <94.59%> (+3.36%) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4ccbb64...967ef99. Read the comment docs.

@fjarri fjarri added the Logging Related to console or file logging label Jun 19, 2019
@fjarri
Copy link
Contributor Author

fjarri commented Jun 26, 2019

Closing in favor of reworked and rebased PR #1103

@fjarri fjarri closed this Jun 26, 2019
@fjarri fjarri deleted the cli-options-refactoring branch August 1, 2019 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI This effects the nucypher CLI Enhancement New or improved features Logging Related to console or file logging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants