{"id":26892,"library":"decorative-secrets","title":"decorative-secrets","description":"A library providing decorators for multi-source secret retrieval, allowing secrets to be fetched from environment variables, files, AWS Secrets Manager, and other backends. Current version is 0.12.14. Release cadence is irregular with frequent minor version bumps.","status":"active","version":"0.12.14","language":"python","source_language":"en","source_url":"https://github.com/enorganic/decorative-secrets","tags":["decorators","secrets","configuration","environment-variables"],"install":[{"cmd":"pip install decorative-secrets","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for AWS Secrets Manager backend","package":"boto3","optional":true}],"imports":[{"note":"Using hyphens in import name causes SyntaxError","wrong":"from decorative-secrets import secret","symbol":"secret","correct":"from decorative_secrets import secret"},{"note":"Both 'secret' (decorator) and 'Secret' (class) exist; using wrong case changes behavior","wrong":"from decorative_secrets import secret","symbol":"Secret","correct":"from decorative_secrets import Secret"}],"quickstart":{"code":"import os\nos.environ['MY_SECRET_KEY'] = 'my-secret-value'\n\nfrom decorative_secrets import secret\n\n@secret('MY_SECRET_KEY')\ndef get_secret(val):\n    return val\n\nprint(get_secret())","lang":"python","description":"Retrieve a secret from an environment variable using the @secret decorator."},"warnings":[{"fix":"Define your function with a parameter to accept the secret, e.g., `def func(secret_value):`.","message":"The 'secret' decorator returns the secret value as the first argument to the decorated function. If you don't expect an argument, your function will receive an extra argument.","severity":"gotcha","affected_versions":">=0.10.0"},{"fix":"Remove the `from_env=True` argument; just pass the environment variable name directly.","message":"The 'from_env' backend (used with `@secret('KEY', from_env=True)`) is deprecated in favor of the default behavior where environment variable keys are automatically detected.","severity":"deprecated","affected_versions":">=0.12.0"},{"fix":"Use underscores or other characters instead of periods, or wrap the key in quotes and use explicit backend configuration.","message":"Using a period (.) in the key name may be misinterpreted as nesting. For example, 'my.secret' might be parsed as a path instead of a literal key.","severity":"gotcha","affected_versions":">=0.10.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `from decorative_secrets import secret` (underscore).","cause":"Trying to import with hyphens instead of underscores.","error":"ModuleNotFoundError: No module named 'decorative-secrets'"},{"fix":"Use either `@secret('KEY')` or `@secret(key='KEY')`, but not both.","cause":"Passing both a string and a keyword argument 'key' when the decorator expects only one.","error":"TypeError: secret() got multiple values for argument 'key'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}