Skip to content

Commit

Permalink
Update config, bump versions, lock moto to 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
connelldave committed Dec 19, 2022
1 parent 326ed89 commit 2998813
Show file tree
Hide file tree
Showing 10 changed files with 672 additions and 366 deletions.
70 changes: 0 additions & 70 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ jobs:
- name: Checkout master
uses: actions/checkout@master

- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.9

- name: Setup Poetry
run: |
export POETRY_HOME=/opt/poetry
python3 install-poetry.py --version 1.2.0
python3 install-poetry.py --version 1.3.1
$POETRY_HOME/bin/poetry --version
- name: Install dev packages
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- name: Checkout master
uses: actions/checkout@master

- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.9

- name: Setup Poetry
run: |
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
rev: 22.3.0
hooks:
- id: black
language_version: python3.8
language_version: python3.9

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
Expand Down
2 changes: 1 addition & 1 deletion botocove/cove_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def cove(
thread_workers: int = 20,
regions: Optional[List[str]] = None,
**cove_kwargs: Any,
) -> Callable:
) -> Callable: # type: ignore
def decorator(func: Callable[..., Any]) -> Callable[..., CoveOutput]:
@functools.wraps(func)
def wrapper(*args: Any, **kwargs: Any) -> CoveOutput:
Expand Down
2 changes: 1 addition & 1 deletion botocove/cove_host_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def _resolve_target_accounts(self, target_ids: Optional[List[str]]) -> Set[str]:
accounts_to_ignore = self._gather_ignored_accounts()
logger.info(f"Ignoring account IDs: {accounts_to_ignore=}")
accounts_to_target = self._gather_target_accounts(target_ids)
final_accounts: Set = accounts_to_target - accounts_to_ignore
final_accounts: Set[str] = accounts_to_target - accounts_to_ignore
if len(final_accounts) < 1:
raise ValueError(
"There are no eligible account ids to run decorated func against"
Expand Down
34 changes: 0 additions & 34 deletions mypy.ini

This file was deleted.

871 changes: 620 additions & 251 deletions poetry.lock

Large diffs are not rendered by default.

43 changes: 40 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "botocove"
version = "1.6.4"
version = "1.7.0"
description = "A decorator to allow running a function against all AWS accounts in an organization"
authors = ["Dave Connell <daveconn41@gmail.com>"]
license = "LGPL-3.0-or-later"
Expand All @@ -9,10 +9,11 @@ repository = "https://github.com/connelldave/botocove"
keywords = ["AWS", "organizations", "AWS organizations", "boto3"]

[tool.poetry.dependencies]
python = "^3.8"
python = "^3.9"
boto3 = "*"
tqdm = "*"
boto3-stubs = {extras = ["sts", "organizations"], version = "*"}
types-tqdm = "^4.64.7"

[tool.poetry.dev-dependencies]
pytest = "*"
Expand All @@ -31,7 +32,8 @@ flake8-print = "*"
mypy = "*"
pre-commit = "*"
flakeheaven = "*"
moto = {extras = ["organizations", "sts"], version = "*"}
moto = {extras = ["organizations", "sts"], version = "3.0.4"}
pytest-randomly = "*"


[build-system]
Expand Down Expand Up @@ -72,6 +74,41 @@ flake8-bandit = ["+*", "-S322", "-S101"]
[tool.black]
line_length=88

[tool.mypy]
python_version = 3.9
pretty = true
cache_dir = ".mypy_cache/strict"
strict_optional = true
show_error_codes = true
show_column_numbers = true
warn_no_return = true
disallow_any_unimported = true
exclude = "install-poetry.py"

# Across versions of mypy, the flags toggled by --strict vary. To ensure
# we have reproducible type check, we instead manually specify the flags
warn_unused_configs = true
disallow_any_generics = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
warn_redundant_casts = true
warn_return_any = true
implicit_reexport = false
strict_equality = true
warn_unused_ignores = false

[[tool.mypy.overrides]]
module = [
'moto'
]
ignore_missing_imports = true


[tool.pytest.ini_options]
addopts = "-vv"
filterwarnings = [
Expand Down
4 changes: 4 additions & 0 deletions tests/test_regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ def do_nothing(session: Session) -> None:
pass

output = do_nothing()
print(output["Results"])
print(len(output["Results"]))
print(_count_member_accounts(mock_session))
print(mock_small_org.all_accounts)
assert len(output["Results"]) == _count_member_accounts(mock_session)


Expand Down

0 comments on commit 2998813

Please sign in to comment.