Skip to content

Possibility of using hatch publish by telling Python's keyring library to use a "null" backend #23

@ncclementi

Description

@ncclementi

I was able to get hatch to ask me for the token without exposing it by doing,

export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring

and then you'll get hatch to work like twine, in the sense it prompts you to put the token but it is not visible.

hatch publish -r test
Username for 'https://test.pypi.org/legacy/' [__token__]: __token__
Password / Token: 
dist/wgxcpack-0.1.2.tar.gz ... success
dist/wgxcpack-0.1.2-py3-none-any.whl ... success

[wgxcpack]
https://test.pypi.org/project/wgxcpack/0.1.2/
(wgxc-package) @ncclementi ➜ /workspaces/pyopensci-workshop-create-python-package/wgxc-package (first-python-package) $ history
    1  history
    2  clear
    3  export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
    4  hatch publish -r test
    5  cd /workspaces/pyopensci-workshop-create-python-package/
    6  ls
    7  cd wgxc-package/
    8  hatch publish -r test
    9  history

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions