"Keeping credentials safe in Jupyter Notebooks" (https://towardsdatascience.com/keeping-credentials-safe-in-jupyter-notebooks-fbd215a8e311) says that "Keyring integrates with your OS keychain manager... You would use it as"
import keyring
keyring.get_keyring()
keyring.get_password("system", "username")
On Mac Ventura 13.2.1, I open Keychain Access, click "Create a new Keychain item.", enter Keychain Item Name "PostgreSQL_Password", account name "tslever", and password "my_password". I restart Anaconda Navigator, JupyterLab, and a Jupyter Notebook. I enter
import keyring
keyring.get_keyring()
print(keyring.get_password("PostgreSQL_Password", "tslever"))
None is printed.