Metadata-Version: 2.1
Name: hardcoded
Version: 0.14.19
Summary: For everything that you really should not be hardcoding.
Home-page: https://gitlab.com/zeroconfig/hardcoded
License: LGPL-3.0-or-later
Author: moizuo
Author-email: no_spam@example.com
Requires-Python: >=3.9,<4.0
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Provides-Extra: encryption-without-pgp
Requires-Dist: Click (>=8.0.1,<9.0.0)
Requires-Dist: cffi (>=1.15.1,<2.0.0) ; extra == "encryption-without-pgp"
Requires-Dist: cryptography (>=39.0.0,<40.0.0) ; extra == "encryption-without-pgp"
Requires-Dist: psutil (>=5.9.8,<6.0.0)
Requires-Dist: python-gnupg
Requires-Dist: pyyaml
Description-Content-Type: text/markdown

This package wants to replace your hardcoded.password, your hardcoded.api\_key, actually  hardcoded("Everything you really shouldn't be hardcoding").

To move a hardcoded value from your code to an external file, use hardcoded.foo as if it was holding your value already. On running the code, this will happen:
- if an environment variable exist with exactly the same name ("foo" in our example), the value of that environment variable is returned
- otherwise, hardcoded will find a file holding your data
    - if you initialised hardcoded as hardcoded.File(path='secrets.yml'), secrets.yml is used
    - if you are running code inside a git repository, .hardcoded.yml is used, at the root of the repository (next to .git/)
    - otherwise, ~/.config/hardcoded.yml is used
- if the file is encrypted:
    - with GPG, then hardcoded interfaces with your GPG installation (possibly using the gpg-agent)
    - if symmetric encryption was used:
        - if a password was cached, it is used to decrypt the data
        - if Apple Keychain is available, a password is requested to decrypt the data
        - if running interactively, you will be asked for a decryption password
- the (decrypted if needed) YAML data is loaded
- if "foo" is a key in the YAML, the value of that key is returned
- if "foo" does not exist in the YAML yet:
    - if not running interactively (stdin is not an open TTY), a KeyError is raised
    - if running interactively, you are asked to input the value
        - if encryption is requested with hardcoded.File(secret=True), the YAML is encrypted:
            - if GPG is available, the YAML is GPG encrypted with a key of your choosing
            - if Apple Keychain is available, a random password is generated and stored in the keychain
            - otherwise, you are asked for a new password
- the value of foo is returned to your code

