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
Setup basic logging functionality(existing output) with 1 level of verbosity #670
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
import sys | ||
|
||
if sys.version_info[:2] >= (3, 8): | ||
import importlib.metadata as importlib_metadata | ||
from importlib import metadata as importlib_metadata | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What prompted this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Edit: It fails to pass the linting test if I change this back. Any advice on how to proceed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, right, isort just had a major version upgrade. I restored this in 8eabc53. I'll plan to followup up with some isort tweaking in a separate PR. |
||
else: | ||
import importlib_metadata | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -13,6 +13,8 @@ | |||||||||||||||
# See the License for the specific language governing permissions and | ||||||||||||||||
# limitations under the License. | ||||||||||||||||
import argparse | ||||||||||||||||
import logging | ||||||||||||||||
import sys | ||||||||||||||||
from typing import Any | ||||||||||||||||
from typing import Optional | ||||||||||||||||
from typing import cast | ||||||||||||||||
|
@@ -148,6 +150,18 @@ def password(self) -> Optional[str]: | |||||||||||||||
# Workaround for https://github.com/python/mypy/issues/5858 | ||||||||||||||||
return cast(Optional[str], self.auth.password) | ||||||||||||||||
|
||||||||||||||||
@property | ||||||||||||||||
def verbose(self) -> bool: | ||||||||||||||||
return self._verbose | ||||||||||||||||
|
||||||||||||||||
@verbose.setter | ||||||||||||||||
def verbose(self, verbose: bool) -> None: | ||||||||||||||||
"""Initialize a logger based on the --verbose option.""" | ||||||||||||||||
self._verbose = verbose | ||||||||||||||||
root_logger = logging.getLogger("twine") | ||||||||||||||||
root_logger.addHandler(logging.StreamHandler(sys.stdout)) | ||||||||||||||||
root_logger.setLevel(logging.INFO if verbose else logging.WARNING) | ||||||||||||||||
Comment on lines
+153
to
+163
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seeing the switch from Lines 79 to 81 in 27f029b
Furthermore, the tests were still setting Lines 71 to 74 in 27f029b
To keep the existing API, avoid rewriting all of the upload tests, and avoid similar gotchas in the future, I made |
||||||||||||||||
|
||||||||||||||||
@staticmethod | ||||||||||||||||
def register_argparse_arguments(parser: argparse.ArgumentParser) -> None: | ||||||||||||||||
"""Register the arguments for argparse.""" | ||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this test should have been parameterized when it was written.