diff --git a/twine/settings.py b/twine/settings.py index 73d4608c..d7128687 100644 --- a/twine/settings.py +++ b/twine/settings.py @@ -145,7 +145,10 @@ def username(self) -> Optional[str]: @property def password(self) -> Optional[str]: if self.client_cert: - return None + try: + return cast(Optional[str], self.auth.password) + except exceptions.NonInteractive: + return None # Workaround for https://github.com/python/mypy/issues/5858 return cast(Optional[str], self.auth.password)