From b3b5170d242143b22a906d5d4d31f75fc093e69f Mon Sep 17 00:00:00 2001 From: takunomi-build-bot Date: Mon, 8 Jul 2024 20:22:14 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Repository=20layout=20updated=20?= =?UTF-8?q?to=20latest=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit was automatically generated by a script: https://gitfub.space/Jmaa/python-omni --- setup.py | 66 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 16 deletions(-) diff --git a/setup.py b/setup.py index 1ec7bae..ce27b5e 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python -# # WARNING # # THIS IS AN AUTOGENERATED FILE. @@ -12,9 +10,55 @@ from setuptools import setup PACKAGE_NAME = 'secret_loader' -with open('README.md') as f: - readme = f.read() +PACKAGE_DESCRIPTION = """ +# Secret Loader System. +System for loading secrets from a variety of sources. + +Usage: + +```python +import secret_loader +secrets = secret_loader.SecretLoader(env_key_prefix = 'MYAPP') + +db_username = secrets.load_or_fail('DATABASE_USERNAME') +db_password = secrets.load_or_fail('DATABASE_PASSWORD') +``` + +Secret loading order: + +0. Hardcoded values. **This is purely for debugging, prototyping, and for + configuring below options.** +1. Files pointed to by environment variables. Docker friendly. +2. Secrets folder. Also Docker friendly. +3. [Pass: the standard unix password + manager](https://www.passwordstore.org/). Most suited for personal + usage; very unsuited for server environments. Requires `pass` installed + locally, and configuration of the `PASS_STORE_SUBFOLDER` through one of the above + methods. +4. Vault instance if configured. Suited for production environments. + +## TODO + +- [ ] Avoid leakage to swap files. + * Possibly Mlock? [Does not seem to work](https://stackoverflow.com/questions/29524020/prevent-ram-from-paging-to-swap-area-mlock) + * Alternatively use [mmap](https://docs.python.org/3/library/mmap.html) and [memoryview](https://stackoverflow.com/questions/18655648/what-exactly-is-the-point-of-memoryview-in-python)?ยง +- [ ] Wrap secrets in intelligent strings: + * Instead of returning None on unloaded, return UnknownSecret, that produce + error when formatted. + * `repr(secret)` should not include contents, but only the secret and how + it was loaded. + * Methods on `Secret` should be kept minimal. +- [ ] Vault: + * [ ] Ensure vault code path works. + * [ ] Document usage and requirements. + +## License + +Copyright 2024 Jon Michael Aanes. +All rights reserved.""" + +PACKAGE_DESCRIPTION_SHORT='System for loading secrets from a variety of sources.' def parse_version_file(text: str) -> str: match = re.match(r'^__version__\s*=\s*(["\'])([\d\.]+)\1$', text) @@ -37,16 +81,6 @@ def read_requirements(path: str) -> list[str]: return parse_requirements(f.read()) -def determine_short_description(readme: str) -> str: - readme = re.sub(r'#+[^\n]*\n+', '', readme) - m = re.search(r'^\s*(\w+[\w\s,`+-]+\.)', readme) - try: - return m.group(1) - except AttributeError as err: - msg = f'Could not determine short description: {readme}' - raise Exception(msg) from err - - REQUIREMENTS_MAIN = """ frozendict """ @@ -59,8 +93,8 @@ pytest setup( name=PACKAGE_NAME, version=version, - description=determine_short_description(readme), - long_description=readme, + description=PACKAGE_DESCRIPTION_SHORT, + long_description=PACKAGE_DESCRIPTION, long_description_content_type='text/markdown', author='Jmaa', author_email='jonjmaa@gmail.com',