Skip to main content

A solution for persistent environment variables.

Project description

Keyway

Persistent environment variables!

A simple solution to prevent accidentally uploading your API keys to GitHub. Functions similarly to normal environment variables, except the keys and values persist through restarts.

pip install keyway 

Import with

import keyway
kw = keyway.Keyway()

Set, access, and delete keys like a dictionary.

kw["alpha"] = "an api key"
kw["bravo"] = "a setting"
kw["charlie"] = 42

kw["alpha"]
#>> "an api key"

del kw["alpha"]

Missing keys return None.

kw["alpha"]
#>> None

Keys are not stored in memory.

kw.keys()
#>> dict_keys([])

To retrieve a dictionary of all of a user's keys, use the "all" keyword. All keys are stored as text for simplicity.

kw[all]
#>> {'bravo': 'a variable', 'charlie': '42'}

To delete all of a user's keys, use the "all" keyword.

del kw[all]
kw[all]
#>> {}
  • By default, keys are stored in the active environment folder
    • Never upload your virtual environment to github.
    • Optionally set a custom path and/or database name like:
      • kw = keyway.Keyway(path = "your/custom/path", db_name = "custom_name")
        
    • You can also optionally set a user for the keyway instance:
      • kw = keyway.Keyway(user = "username")
        
  • Keyway has no dependencies outside of the standard library.
  • License: MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keyway-1.0.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

keyway-1.0.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file keyway-1.0.1.tar.gz.

File metadata

  • Download URL: keyway-1.0.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for keyway-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ae7bdfcd4de8046748d5a6633b53ccdc9ba1e23184f0d1bda1f62413152491e2
MD5 809864e6007a4120875fd148140dbc4e
BLAKE2b-256 099990ab09b1bd1bc7e7a765299ce236d8b3333eefaa675561b3ab83598af3a1

See more details on using hashes here.

File details

Details for the file keyway-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: keyway-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for keyway-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 605b958c734a4faf0a1a6f9eedcc279c13ee782721fd90a03ee8e15d335ffa00
MD5 aa7fe75e3c8318c56a1e9071bfec90f8
BLAKE2b-256 1a4c346a05b383577c69dc85dfc3cbb8540fee4fd29d8d9d31c9464976f9fb87

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page