Skip to content

Commit

Permalink
Merge pull request #7 from JimFawkes/upgrade-versions
Browse files Browse the repository at this point in the history
Upgrade versions
  • Loading branch information
JimFawkes authored Dec 22, 2022
2 parents 48f13fe + e249494 commit de5a637
Show file tree
Hide file tree
Showing 13 changed files with 97 additions and 79 deletions.
37 changes: 12 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,31 @@ on: [push]
jobs:
build:

runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@master
- name: Set up Python 3.8
uses: actions/setup-python@master
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python --version
python -m pip install --upgrade pip
pip install -r requirements/test.txt
pip install -r requirements-dev.txt
- name: Test with pytest
run: |
pip install pytest
pip install pytest-cov
pytest --cov=./ --cov-report=xml
- name: Codecov
uses: codecov/codecov-action@v1.0.5
uses: codecov/codecov-action@v3.1.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml

- name: Set up Python 3.7
uses: actions/setup-python@master
with:
python-version: 3.7
- name: Install dependencies
run: |
python --version
python -m pip install --upgrade pip
pip install -r requirements/test.txt
- name: Test with pytest
run: |
pip install pytest
pip install pytest-cov
pytest
34 changes: 32 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
default_language_version:
python: python3

repos:
- repo: https://github.com/psf/black
rev: stable
rev: "22.12.0"
hooks:
- id: black
language_version: python3.8

- repo: https://github.com/pycqa/isort
rev: "5.11.4"
hooks:
- id: isort

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v0.991"
hooks:
- id: mypy

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.3.0"
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/pre-commit/pygrep-hooks
rev: "v1.9.0"
hooks:
- id: python-no-log-warn
- id: python-no-eval
- id: python-use-type-annotations
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![test-action](https://github.com/JimFawkes/utils/workflows/run-tests/badge.svg)](https://github.com/JimFawkes/secret-loader/actions)
[![codecov](https://codecov.io/gh/JimFawkes/utils/branch/master/graph/badge.svg)](https://codecov.io/gh/JimFawkes/secret-loader)
![python](https://img.shields.io/badge/python-3.7%20|%203.8-blue)
![python](https://img.shields.io/badge/python-3.9%20|%203.10%20|%203.11-blue)
[![black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](COPYING)
[![Latest Tag](https://img.shields.io/github/v/tag/jimfawkes/secret-loader)](https://github.com/JimFawkes/secret-loader/releases)
Expand Down
26 changes: 15 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

[tool.black]
line-length = 100
target-version = ["py38"]
target-version = ["py310"]
include = '\.pyi?$'
exclude = '''
/(
Expand All @@ -23,6 +23,9 @@ exclude = '''
)/
'''

[tool.mypy]
ignore_missing_imports=true

[build-system]
requires = ["flit_core >=2,<4"]
build-backend = "flit_core.buildapi"
Expand All @@ -32,26 +35,27 @@ module="secret_loader"
author="Moritz Eilfort"
author-email="[email protected]"
home-page="https://github.com/JimFawkes/secret-loader"
requires=[
"boto3==1.13.16",
"botocore==1.16.16",
"python-dotenv==0.13.0",
requires= [
"boto3 <1.27, >1.13",
"python-dotenv <0.22, >0.13",
]
requires-python=">=3.7"
requires-python=">=3.9"
description-file="README.md"
classifiers=[
"Intended Audience :: Developers",
'Natural Language :: English',
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Software Development :: Libraries :: Python Modules",
]

[tool.flit.metadata.requires-extra]
test=[
"pytest==5.4.2",
"pytest-cov",
test= [
"pytest==7.2.0",
"pytest-cov==4.0.0"

]

[tool.flit.entrypoints.console_scripts]
Expand Down
17 changes: 17 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Development Requirements

# Base
boto3==1.26.35
python-dotenv==0.21.0

# Testing
pytest==7.2.0
pytest-cov==4.0.0

# Formatting, Liniting, etc.
black==22.12
bandit==1.7.4
mypy==0.991
pre-commit==2.20.0
pyflakes==3.0.1
pylama==8.4.1
3 changes: 0 additions & 3 deletions requirements/base.txt

This file was deleted.

11 changes: 0 additions & 11 deletions requirements/local.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements/prod.txt

This file was deleted.

5 changes: 0 additions & 5 deletions requirements/test.txt

This file was deleted.

7 changes: 2 additions & 5 deletions secret_loader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@
GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""

__version__ = "0.5"
__version__ = "0.6"
__author__ = "Moritz Eilfort"
__author_email__ = "[email protected]"
__url__ = "github.com/JimFawkes/secret-loader"
__license__ = "GPLv3+"
__copyright__ = f"Copyright 2020 {__author__}"

from . import loaders
from . import base
from . import exceptions
from . import secrets
from . import base, exceptions, loaders, secrets

secret = secrets.secret

Expand Down
20 changes: 14 additions & 6 deletions secret_loader/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
"""

import argparse
import logging
import importlib
import logging
import sys

from secret_loader.secrets import secret, SecretLoader
from secret_loader import __author__, __copyright__, __license__, __url__, __version__
from secret_loader.exceptions import SecretNotFoundError
from secret_loader import __version__, __author__, __url__, __license__, __copyright__
from secret_loader.secrets import SecretLoader, secret

epilog = f"""
Version {__version__} - June 2020 - {__author__} - src: {__url__}
Expand All @@ -46,7 +46,10 @@
)

parser.add_argument(
"--name", "-n", help="Name of Secret to Load", type=str,
"--name",
"-n",
help="Name of Secret to Load",
type=str,
)

parser.add_argument("--fail", help="Fail if Secret is not Found", action="store_true")
Expand All @@ -72,11 +75,16 @@
)

parser.add_argument(
"--remove_loaders", help="Remove pre-registered Loaders", action="store_true",
"--remove_loaders",
help="Remove pre-registered Loaders",
action="store_true",
)

parser.add_argument(
"--list_loaders", "-l", help="List all currently available loaders", action="store_true",
"--list_loaders",
"-l",
help="List all currently available loaders",
action="store_true",
)


Expand Down
2 changes: 1 addition & 1 deletion secret_loader/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import os

import boto3.session
from botocore.exceptions import ClientError
import dotenv
from botocore.exceptions import ClientError

from .base import BaseLoader, pretty_print_function
from .exceptions import SecretNotFoundError
Expand Down
10 changes: 3 additions & 7 deletions secret_loader/secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@
GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""

from collections import namedtuple
import logging
from collections import namedtuple

from .base import BaseClass, pretty_print_function
from .exceptions import (
SecretNotFoundError,
NoLoaderConfiguredError,
ConstructLoaderError,
)
from .loaders import EnvLoader, EnvFileLoader, AWSSecretsLoader
from .exceptions import ConstructLoaderError, NoLoaderConfiguredError, SecretNotFoundError
from .loaders import AWSSecretsLoader, EnvFileLoader, EnvLoader

logger = logging.getLogger("secret_loader.secrets")

Expand Down

0 comments on commit de5a637

Please sign in to comment.