Skip to content

Commit

Permalink
Add env var for --non-interactive flag
Browse files Browse the repository at this point in the history
Change --non-interactive action to utils.EnvironmentDefault to support specification as an env var
  • Loading branch information
sco1 committed Nov 20, 2019
1 parent 3de13c7 commit 02cca33
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 8 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ Uploads one or more distributions to a repository.
(package index) with. (Can also be set via
TWINE_PASSWORD environment variable.)
--non-interactive Do not interactively prompt for username/password
if the required credentials are missing.
if the required credentials are missing. (Can also
be set via TWINE_NON_INTERACTIVE environment
variable.)
-c COMMENT, --comment COMMENT
The comment to include with the distribution file.
--config-file CONFIG_FILE
Expand Down Expand Up @@ -288,7 +290,9 @@ For completeness, its usage:
(package index) with. (Can also be set via
TWINE_PASSWORD environment variable.)
--non-interactive Do not interactively prompt for username/password
if the required credentials are missing.
if the required credentials are missing. (Can also
be set via TWINE_NON_INTERACTIVE environment
variable.)
-c COMMENT, --comment COMMENT
The comment to include with the distribution file.
--config-file CONFIG_FILE
Expand All @@ -315,6 +319,8 @@ example.
* ``TWINE_REPOSITORY_URL`` - the repository URL to use.
* ``TWINE_CERT`` - custom CA certificate to use for repositories with
self-signed or untrusted certificates.
* ``TWINE_NON_INTERACTIVE`` - Do not interactively prompt for username/password
if the required credentials are missing.

Resources
---------
Expand Down
6 changes: 4 additions & 2 deletions twine/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,13 @@ def register_argparse_arguments(parser: argparse.ArgumentParser) -> None:
)
parser.add_argument(
"--non-interactive",
action="store_true",
action=utils.EnvironmentDefault,

This comment has been minimized.

Copy link
@joshringer

joshringer Nov 27, 2019

Hi there,
I doubt this was intentional: this change has caused the --non-interactive flag to accept an argument.
...got a bit confusing when one of my dist files wasn't uploaded ;)
I'm not certain how it'll affect the env var behaviour, but it's possible a simple const=True will do the trick?

This comment has been minimized.

Copy link
@sigmavirus24

sigmavirus24 Nov 27, 2019

Member

This comment has been minimized.

Copy link
@sco1

sco1 Nov 27, 2019

Author Contributor

I'm sorry, I didn't look closely enough at the util before I switched to it.

This comment has been minimized.

Copy link
@jaraco

jaraco Nov 27, 2019

Member

It was not intentional. Filed as #548.

This comment has been minimized.

Copy link
@jaraco

jaraco Nov 27, 2019

Member

Short-term workaround is to install twine!=3.1.0

This comment has been minimized.

Copy link
@joshringer

joshringer Nov 27, 2019

Awesome, thanks for the swift response!

env="TWINE_NON_INTERACTIVE",
default=False,
required=False,
help="Do not interactively prompt for username/password if the "
"required credentials are missing."
"required credentials are missing. (Can also be set via "
"%(env)s environment variable.)"
)
parser.add_argument(
"-c", "--comment",
Expand Down

0 comments on commit 02cca33

Please sign in to comment.