NiklasRosenstein / slap

Slap is a CLI to assist in the process for developing and releasing Python packages.
https://niklasrosenstein.github.io/slap/
Other
21 stars 12 forks source link

Honoring TWINE_ environment variables #154

Open ndejong opened 4 weeks ago

ndejong commented 4 weeks ago

Currently the slap-cli publish sub-command does not honor the TWINE_* environment variables where-as twine-cli utility does - https://twine.readthedocs.io/en/stable/index.html#configuration

Twine supports the following - TWINE_USERNAME, TWINE_PASSWORD, TWINE_REPOSITORY, TWINE_REPOSITORY_URL, TWINE_CERT, TWINE_NON_INTERACTIVE

These all map to options that are set with Cleo based options in src/slap/ext/application/publish.py that currently get passed through to Twine from slap-cli.

I'd propose simply recrafting all the respective options with something like below as appropriate for each -

option("username", "u", flag=False, default=os.getenv("TWINE_USERNAME", None))

For reference Cleo option.py looks like it should be okay with this.

Seems like a pretty simple thing, but before I charge right in and submit a PR, is this something that sounds about right to you?

ndejong commented 3 weeks ago

Adding comment -

This matters because it enables the ability to use slap publish without needing to keep a ~/.pypirc file laying around with credentials in it.

It would enable the ability to just load the TWINE_ env-vars when a publish action is desired.