From 3a6e49fe395dd17b635181da0ca1732df7942a74 Mon Sep 17 00:00:00 2001 From: ccp_zeulix Date: Mon, 4 Nov 2024 12:06:28 +0000 Subject: [PATCH] Version 2.0.0 - Vault Support ### Changed - Pip installation now requires you to specify optional dependencies with either `pip install fidelius[aws]` for AWS Parameter Store support, `pip install fidelius[vault]` for Hashicorp Vault support or `pip install fidelius[aws,vault]` for both. --- CHANGELOG.md | 11 ++++++++++ fidelius/__init__.py | 2 +- .../gateway/paramstore/_paramstorerepo.py | 21 ++++++++++++------- fidelius/gateway/vault/_client.py | 10 +++++++-- pyproject.toml | 7 +++++-- 5 files changed, 39 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df8fdb7..f78d481 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [2.0.0] - 2024-11-04 + +### Changed + +- Pip installation now requires you to specify optional dependencies with either + `pip install fidelius[aws]` for AWS Parameter Store support, + `pip install fidelius[vault]` for Hashicorp Vault support or + `pip install fidelius[aws,vault]` for both. + + ## [2.0.0-dev.1] - 2024-05-16 ### Added diff --git a/fidelius/__init__.py b/fidelius/__init__.py index 9777236..9818939 100644 --- a/fidelius/__init__.py +++ b/fidelius/__init__.py @@ -1,4 +1,4 @@ -__version__ = '2.0.0-dev.1' +__version__ = '2.0.0' __author__ = 'Thordur Matthiasson ' __license__ = 'MIT License' diff --git a/fidelius/gateway/paramstore/_paramstorerepo.py b/fidelius/gateway/paramstore/_paramstorerepo.py index 55556e1..5012f72 100644 --- a/fidelius/gateway/paramstore/_paramstorerepo.py +++ b/fidelius/gateway/paramstore/_paramstorerepo.py @@ -5,21 +5,27 @@ from fidelius.structs import * from fidelius.gateway._abstract import * - -import boto3 import os import logging log = logging.getLogger(__name__) +try: + import boto3 +except ImportError: + log.error('You are trying to use the AwsParamStoreRepo without boto3 installed.') + log.error('Please amend your pip install to `fidelius[aws]` to include boto3 dependencies.') + raise + class AwsParamStoreRepo(_BaseFideliusRepo): def __init__(self, app_props: FideliusAppProps, - aws_access_key_id: str = None, - aws_secret_access_key: str = None, - aws_key_arn: str = None, - aws_region_name: str = None, - aws_endpoint_url: str = None, + aws_access_key_id: Optional[str] = None, + aws_secret_access_key: Optional[str] = None, + aws_key_arn: Optional[str] = None, + aws_region_name: Optional[str] = None, + aws_endpoint_url: Optional[str] = None, + aws_profile_name: Optional[str] = None, flush_cache_every_time: bool = False, **kwargs): """Fidelius Admin Repo that uses AWS' Simple Systems Manager's Parameter Store as a back end. @@ -45,6 +51,7 @@ def __init__(self, app_props: FideliusAppProps, testing and development, e.g. by spinning up a LocalStack container and pointing to that instead of a live AWS environment. + :param aws_profile_name: ....add this @TODO :param flush_cache_every_time: Optional flat that'll flush the entire cache before every operation if set to True and is just intended for testing diff --git a/fidelius/gateway/vault/_client.py b/fidelius/gateway/vault/_client.py index e666f3e..14902c6 100644 --- a/fidelius/gateway/vault/_client.py +++ b/fidelius/gateway/vault/_client.py @@ -3,13 +3,19 @@ ] from fidelius.structs import * from ._structs import * -import hvac - import logging log = logging.getLogger(__file__) +try: + import hvac +except ImportError: + log.error('You are trying to use the VaultKeyValRepo without hvac installed.') + log.error('Please amend your pip install to `fidelius[vaulst]` to include hvac dependencies.') + raise + + class VaultGateway: def __init__(self, url: str, token: str, verify: bool = True, timeout: int = 30, namespace: Optional[str] = None): self._client = hvac.Client(url=url, token=token, verify=verify, timeout=timeout, namespace=namespace) diff --git a/pyproject.toml b/pyproject.toml index d2eb40e..dc3ccdb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,10 +35,13 @@ classifiers = [ ] dependencies = [ "ccptools >=1.1, <2", - "boto3 >=1.20, <2", - "havc >= 2.2, <3" ] +[project.optional-dependencies] +vault = ["havc >= 2.2, <3"] +aws = ["boto3 >=1.20, <2"] + + [project.urls] Homepage = "https://github.com/ccpgames/fidelius" Documentation = "https://github.com/ccpgames/fidelius/blob/main/README.md"