liveBook · Manning

Keyring

As explained in Software Engineering for Data Scientists

keyring is a Python package that stores and retrieves passwords through the operating system's credential store.

keyring protects application credentials by storing passwords in the operating system’s credential store instead of placing them directly in code. It supports Windows, Linux, and macOS. section 9.2.4

Use keyring in a small, repeatable workflow:

  • Store a username and password with set_password(service_name, username, password). section 9.2.4
  • Retrieve the password later with get_password(service_name, username), including from a new Python session. section 9.2.4

Supplying a database password

Store credentials under a name such as database_credentials, retrieve the password when needed, and insert it into a SQL Server connection string used by pyodbc.

How Software Engineering for Data Scientists covers it

How deep it goes
Explains installation, credential storage, retrieval, and database use without detailing alternative credential-security libraries.
Examples
Uses database_credentials, secret_username, and a SQL Server connection string as concrete examples.
What it assumes
Assumes basic Python and pip familiarity while teaching credential storage and retrieval through short examples.
What you can do after
Operate keyring to store and retrieve passwords, then pass a retrieved password to a pyodbc database connection.
How it connects
Connects operating-system credential stores with Python packages, usernames, passwords, SQL Server, and pyodbc.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Engineering for Data Scientists. The section links point to the parts of the book it draws on.