fogies 0.0.0.dev13__tar.gz → 0.0.0.dev14__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fogies-0.0.0.dev14/PKG-INFO +22 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/pyproject.toml +23 -21
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/aws_access_key.py +0 -2
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/boto_clients.py +1 -3
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/config.py +1 -4
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/pyfogies.py +2 -2
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/retry.py +2 -5
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tasks/access_key.py +0 -2
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tasks/claude_desktop.py +1 -1
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tasks/claude_sync.py +3 -3
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tasks/format.py +2 -1
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tasks/lint.py +2 -1
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tasks/poetry.py +6 -5
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tasks/terminal.py +18 -1
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tasks/terraform.py +2 -1
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tasks/test.py +2 -1
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/terraform/backend.py +1 -1
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tools/aws_environ.py +7 -9
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tools/boto.py +0 -2
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tools/claude_code.py +1 -1
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tools/claude_sessions.py +1 -1
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tools/claude_sync.py +5 -11
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tools/claude_sync_deletions.py +1 -1
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tools/command.py +2 -4
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tools/environ.py +0 -2
- fogies-0.0.0.dev13/PKG-INFO +0 -22
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/README.md +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/__init__.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/age_key.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/download_verified.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/includes/templates/aws.toml.template +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/includes/templates/backend_status.toml.template +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/includes/templates/claude_sync.toml.template +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/includes/templates/poetry.toml.template +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/py.typed +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/ready_poll.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tasks/__init__.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tasks/claude_code.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tasks/terraform_backend.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/templates.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/terraform/__init__.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/terraform/alb.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/terraform/cloudwatch.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/terraform/ecr.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/terraform/ecs.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/terraform/hosted_zone.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/terraform/network.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tools/__init__.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tools/claude_desktop.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tools/claude_sync_watch.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tools/go.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tools/ollama.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tools/terraform.py +0 -0
- {fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/tools/terraform_backend.py +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fogies
|
|
3
|
+
Version: 0.0.0.dev14
|
|
4
|
+
Summary:
|
|
5
|
+
Author: James Fogarty
|
|
6
|
+
Author-email: jayfo@users.noreply.github.com
|
|
7
|
+
Requires-Python: >=3.15,<4.0
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
10
|
+
Requires-Dist: boto3 (>=1.44.13,<2.0.0)
|
|
11
|
+
Requires-Dist: claude-agent-sdk (>=0.2.189,<0.3.0)
|
|
12
|
+
Requires-Dist: filelock (>=4.3.2,<5.0.0)
|
|
13
|
+
Requires-Dist: ollama (>=0.6.3,<0.7.0)
|
|
14
|
+
Requires-Dist: psutil (>=7.2.2,<8.0.0)
|
|
15
|
+
Requires-Dist: pydantic (>=2.14.4,<3.0.0)
|
|
16
|
+
Requires-Dist: pyrage (>=1.4.0,<2.0.0)
|
|
17
|
+
Requires-Dist: requests (>=2.33.0,<2.34.0)
|
|
18
|
+
Requires-Dist: tenacity (>=9.2.1,<10.0.0)
|
|
19
|
+
Requires-Dist: tomlkit (>=0.15.3,<0.16.0)
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# pyfogies
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "fogies"
|
|
3
3
|
# Version follows semantic versioning <https://semver.org/>.
|
|
4
|
-
version = "0.0.0-dev.
|
|
4
|
+
version = "0.0.0-dev.14"
|
|
5
5
|
description = ""
|
|
6
6
|
authors = [
|
|
7
7
|
{name = "James Fogarty",email = "jayfo@users.noreply.github.com"}
|
|
8
8
|
]
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.
|
|
10
|
+
requires-python = ">=3.15,<4.0"
|
|
11
|
+
dynamic = ["dependencies"]
|
|
11
12
|
|
|
12
13
|
[tool.poetry]
|
|
13
14
|
packages = [
|
|
@@ -26,40 +27,41 @@ include = [
|
|
|
26
27
|
# Example: ^1.2.3 will match 1.x.x versions >=1.2.3 and <2.0.0.
|
|
27
28
|
# ~ allows only patch releases.
|
|
28
29
|
# Example: ~1.2.3 will match versions >=1.2.3 and <1.3.0.
|
|
29
|
-
boto3 = "^1.
|
|
30
|
-
claude-agent-sdk = "^0.2.
|
|
31
|
-
filelock = "^3.
|
|
32
|
-
ollama = "^0.6.
|
|
30
|
+
boto3 = "^1.44.13"
|
|
31
|
+
claude-agent-sdk = "^0.2.189"
|
|
32
|
+
filelock = "^4.3.2"
|
|
33
|
+
ollama = "^0.6.3"
|
|
33
34
|
psutil = "^7.2.2"
|
|
34
|
-
pydantic = "^2.
|
|
35
|
+
pydantic = "^2.14.4"
|
|
35
36
|
pyrage = "^1.4.0"
|
|
36
|
-
requests = "~2.33.0"
|
|
37
|
-
tenacity = "^9.1
|
|
38
|
-
tomlkit = "^0.15.
|
|
37
|
+
requests = "~2.33.0" # Keep with types-requests.
|
|
38
|
+
tenacity = "^9.2.1"
|
|
39
|
+
tomlkit = "^0.15.3"
|
|
39
40
|
|
|
40
41
|
[tool.poetry.group.dev.dependencies]
|
|
41
42
|
# ^ allows all minor and patch releases.
|
|
42
43
|
# Example: ^1.2.3 will match 1.x.x versions >=1.2.3 and <2.0.0.
|
|
43
44
|
# ~ allows only patch releases.
|
|
44
45
|
# Example: ~1.2.3 will match versions >=1.2.3 and <1.3.0.
|
|
45
|
-
basedpyright = "^1.
|
|
46
|
-
black = "~26.
|
|
47
|
-
boto3-stubs = {extras = ["logs", "s3"], version = "^1.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
basedpyright = "^1.40.2"
|
|
47
|
+
black = "~26.10.1" # Black does not semver.
|
|
48
|
+
boto3-stubs = {extras = ["ec2", "ecs", "elbv2", "iam", "logs", "s3", "sts"], version = "^1.44.13"}
|
|
49
|
+
colorama = "^0.4.6"
|
|
50
|
+
invoke = "^3.0.3"
|
|
51
|
+
isort = "^9.0.2"
|
|
52
|
+
poetry = "^2.5.2"
|
|
53
|
+
pytest = "^9.2.0"
|
|
54
|
+
semver = "^3.2.0"
|
|
55
|
+
types-requests = "~2.33.0.20261030" # Keep with requests.
|
|
54
56
|
|
|
55
57
|
[tool.basedpyright]
|
|
56
58
|
typeCheckingMode = "recommended"
|
|
57
|
-
pythonVersion = "3.
|
|
59
|
+
pythonVersion = "3.15"
|
|
58
60
|
include = ["src", "tasks", "tests"]
|
|
59
61
|
allowedUntypedLibraries = ["invoke"]
|
|
60
62
|
|
|
61
63
|
[tool.black]
|
|
62
|
-
target-version = ["
|
|
64
|
+
target-version = ["py315"]
|
|
63
65
|
|
|
64
66
|
[build-system]
|
|
65
67
|
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
|
@@ -14,14 +14,11 @@ redirects, belongs here rather than in each loader.
|
|
|
14
14
|
import pathlib
|
|
15
15
|
import tomllib
|
|
16
16
|
from collections.abc import Callable
|
|
17
|
-
from typing import TypeVar
|
|
18
17
|
|
|
19
18
|
from pydantic import BaseModel
|
|
20
19
|
|
|
21
20
|
from fogies.templates import ensure_from_template
|
|
22
21
|
|
|
23
|
-
ConfigModel = TypeVar("ConfigModel", bound=BaseModel)
|
|
24
|
-
|
|
25
22
|
_REDIRECT_KEY = "redirect"
|
|
26
23
|
|
|
27
24
|
|
|
@@ -79,7 +76,7 @@ def resolve_config_path(*, path: pathlib.Path) -> pathlib.Path:
|
|
|
79
76
|
return target
|
|
80
77
|
|
|
81
78
|
|
|
82
|
-
def load_config(
|
|
79
|
+
def load_config[ConfigModel: BaseModel](
|
|
83
80
|
*,
|
|
84
81
|
path: pathlib.Path,
|
|
85
82
|
model: type[ConfigModel],
|
|
@@ -31,7 +31,7 @@ def _pep440_version() -> str:
|
|
|
31
31
|
"""
|
|
32
32
|
installed_version = importlib.metadata.version("fogies")
|
|
33
33
|
|
|
34
|
-
if _FINAL_RELEASE_RE.
|
|
34
|
+
if _FINAL_RELEASE_RE.fullmatch(installed_version) or _DEV_RELEASE_RE.fullmatch(
|
|
35
35
|
installed_version
|
|
36
36
|
):
|
|
37
37
|
return installed_version
|
|
@@ -47,7 +47,7 @@ def _semver_version() -> str:
|
|
|
47
47
|
"""The installed pyfogies version, as SemVer (e.g. "0.0.0-dev.6")."""
|
|
48
48
|
pep440_version = _pep440_version()
|
|
49
49
|
|
|
50
|
-
dev_release_match = _DEV_RELEASE_RE.
|
|
50
|
+
dev_release_match = _DEV_RELEASE_RE.fullmatch(pep440_version)
|
|
51
51
|
if dev_release_match:
|
|
52
52
|
return "{}-dev.{}".format(
|
|
53
53
|
dev_release_match.group("base"), dev_release_match.group("dev")
|
|
@@ -9,12 +9,9 @@ created, unless a retry actually happens.
|
|
|
9
9
|
import pathlib
|
|
10
10
|
from collections.abc import Callable
|
|
11
11
|
from datetime import datetime
|
|
12
|
-
from typing import TypeVar
|
|
13
12
|
|
|
14
13
|
import tenacity
|
|
15
14
|
|
|
16
|
-
_T = TypeVar("_T")
|
|
17
|
-
|
|
18
15
|
|
|
19
16
|
def _log_retry(log_path: pathlib.Path) -> Callable[[tenacity.RetryCallState], None]:
|
|
20
17
|
def log_it(retry_state: tenacity.RetryCallState) -> None:
|
|
@@ -34,11 +31,11 @@ def _log_retry(log_path: pathlib.Path) -> Callable[[tenacity.RetryCallState], No
|
|
|
34
31
|
return log_it
|
|
35
32
|
|
|
36
33
|
|
|
37
|
-
def retry_transient(
|
|
34
|
+
def retry_transient[T](
|
|
38
35
|
*,
|
|
39
36
|
exceptions: type[BaseException] | tuple[type[BaseException], ...],
|
|
40
37
|
log_path: pathlib.Path | None = None,
|
|
41
|
-
) -> Callable[[Callable[[],
|
|
38
|
+
) -> Callable[[Callable[[], T]], Callable[[], T]]:
|
|
42
39
|
"""Retry profile for a flaky one-off operation, with no backoff."""
|
|
43
40
|
return tenacity.retry(
|
|
44
41
|
retry=tenacity.retry_if_exception_type(exceptions),
|
|
@@ -10,10 +10,10 @@ import pathlib
|
|
|
10
10
|
from collections.abc import Callable
|
|
11
11
|
from typing import cast
|
|
12
12
|
|
|
13
|
-
from claude_agent_sdk import list_sessions
|
|
14
13
|
from invoke.collection import Collection
|
|
15
14
|
from invoke.context import Context
|
|
16
15
|
from invoke.tasks import Task, task
|
|
16
|
+
lazy from claude_agent_sdk import list_sessions
|
|
17
17
|
|
|
18
18
|
from fogies.tools.claude_code import claude_code
|
|
19
19
|
from fogies.tools.claude_desktop import (
|
|
@@ -4,10 +4,10 @@ import pathlib
|
|
|
4
4
|
from collections.abc import Callable
|
|
5
5
|
from typing import cast
|
|
6
6
|
|
|
7
|
-
from claude_agent_sdk import list_sessions
|
|
8
7
|
from invoke.collection import Collection
|
|
9
8
|
from invoke.context import Context
|
|
10
9
|
from invoke.tasks import Task, task
|
|
10
|
+
lazy from claude_agent_sdk import list_sessions
|
|
11
11
|
|
|
12
12
|
from fogies.tasks.terminal import spawn_new_terminal
|
|
13
13
|
from fogies.tools.aws_environ import aws_environ_from_config
|
|
@@ -146,7 +146,7 @@ def get_task_delete(
|
|
|
146
146
|
|
|
147
147
|
config = load_claude_sync_config(path=claude_sync_config_path)
|
|
148
148
|
with aws_environ_from_config(
|
|
149
|
-
|
|
149
|
+
aws_config_path=aws_config_path,
|
|
150
150
|
profile_name=config.aws_profile,
|
|
151
151
|
raise_if_env_exists=False,
|
|
152
152
|
):
|
|
@@ -260,7 +260,7 @@ def get_task_sync(
|
|
|
260
260
|
def sync_deletions_after_pull() -> None:
|
|
261
261
|
config = load_claude_sync_config(path=claude_sync_config_path)
|
|
262
262
|
with aws_environ_from_config(
|
|
263
|
-
|
|
263
|
+
aws_config_path=aws_config_path,
|
|
264
264
|
profile_name=config.aws_profile,
|
|
265
265
|
raise_if_env_exists=False,
|
|
266
266
|
):
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Tasks for building and publishing with Poetry.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
+
from collections.abc import Callable
|
|
5
6
|
from pathlib import Path
|
|
6
|
-
from typing import
|
|
7
|
+
from typing import cast
|
|
7
8
|
|
|
8
9
|
from invoke.collection import Collection
|
|
9
10
|
from invoke.context import Context
|
|
@@ -43,7 +44,7 @@ def get_task_build() -> Task[Callable[[Context], None]]:
|
|
|
43
44
|
return cast(Task[Callable[[Context], None]], task_build)
|
|
44
45
|
|
|
45
46
|
|
|
46
|
-
def get_task_publish(*,
|
|
47
|
+
def get_task_publish(*, poetry_config_path: Path) -> Task[Callable[[Context], None]]:
|
|
47
48
|
@task(
|
|
48
49
|
name="publish", auto_shortflags=False
|
|
49
50
|
) # pyright: ignore[reportUntypedFunctionDecorator]
|
|
@@ -52,7 +53,7 @@ def get_task_publish(*, secrets_poetry_path: Path) -> Task[Callable[[Context], N
|
|
|
52
53
|
Publish package to PyPI.
|
|
53
54
|
"""
|
|
54
55
|
poetry_config = load_config(
|
|
55
|
-
path=
|
|
56
|
+
path=poetry_config_path,
|
|
56
57
|
model=_PoetryConfig,
|
|
57
58
|
template_factory=poetry_toml_template_factory,
|
|
58
59
|
)
|
|
@@ -74,14 +75,14 @@ def get_task_publish(*, secrets_poetry_path: Path) -> Task[Callable[[Context], N
|
|
|
74
75
|
return cast(Task[Callable[[Context], None]], task_publish)
|
|
75
76
|
|
|
76
77
|
|
|
77
|
-
def get_collection(*,
|
|
78
|
+
def get_collection(*, poetry_config_path: Path) -> Collection:
|
|
78
79
|
"""
|
|
79
80
|
Get a collection of tasks.
|
|
80
81
|
"""
|
|
81
82
|
namespace = Collection("poetry")
|
|
82
83
|
|
|
83
84
|
task_build = get_task_build()
|
|
84
|
-
task_publish = get_task_publish(
|
|
85
|
+
task_publish = get_task_publish(poetry_config_path=poetry_config_path)
|
|
85
86
|
|
|
86
87
|
namespace.add_task(task_build)
|
|
87
88
|
namespace.add_task(task_publish)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""Helper for running a task in a new terminal."""
|
|
2
2
|
|
|
3
|
+
import ctypes
|
|
3
4
|
import os
|
|
4
5
|
import pathlib
|
|
5
6
|
import platform
|
|
@@ -44,6 +45,21 @@ def _is_new_terminal(command_line: list[str]) -> bool:
|
|
|
44
45
|
return os.environ.get(_NEW_TERMINAL_VARIABLE) == " ".join(command_line)
|
|
45
46
|
|
|
46
47
|
|
|
48
|
+
def _enable_ctrl_c() -> None:
|
|
49
|
+
"""Make Ctrl+C stop what runs in this terminal, which on Windows it may not.
|
|
50
|
+
|
|
51
|
+
A process started in a new process group, as some launchers start a shell,
|
|
52
|
+
ignores Ctrl+C, and so do the processes it starts, all the way down to the
|
|
53
|
+
command in a new terminal. That flag is the process's own to clear, which
|
|
54
|
+
this does, for it and for what it starts.
|
|
55
|
+
"""
|
|
56
|
+
if sys.platform == "win32":
|
|
57
|
+
# A ctypes call, which is untyped.
|
|
58
|
+
_ = ctypes.windll.kernel32.SetConsoleCtrlHandler( # pyright: ignore[reportAny]
|
|
59
|
+
None, False
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
47
63
|
def _cmd_quote(argument: str) -> str:
|
|
48
64
|
"""Return argument quoted for `cmd`, which otherwise reads & | < > and ^ in it.
|
|
49
65
|
|
|
@@ -96,6 +112,7 @@ def spawn_new_terminal(context: Context) -> bool:
|
|
|
96
112
|
"""
|
|
97
113
|
command_line = _invoke_command_line()
|
|
98
114
|
if _is_new_terminal(command_line):
|
|
115
|
+
_enable_ctrl_c()
|
|
99
116
|
return True
|
|
100
117
|
|
|
101
118
|
flag = " ".join(command_line)
|
|
@@ -139,7 +156,7 @@ def spawn_new_terminal(context: Context) -> bool:
|
|
|
139
156
|
shlex.join(command_line),
|
|
140
157
|
]
|
|
141
158
|
_ = path_command.write_text(
|
|
142
|
-
"".join(line + "\n" for line in lines), encoding="utf-8"
|
|
159
|
+
"".join(line + "\n" for line in lines), encoding="utf-8", newline="\n"
|
|
143
160
|
)
|
|
144
161
|
path_command.chmod(path_command.stat().st_mode | stat.S_IXUSR)
|
|
145
162
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"""Generic tasks for applying and destroying a Terraform configuration."""
|
|
2
2
|
|
|
3
3
|
import pathlib
|
|
4
|
+
from collections.abc import Callable
|
|
4
5
|
from contextlib import ExitStack
|
|
5
|
-
from typing import
|
|
6
|
+
from typing import cast
|
|
6
7
|
|
|
7
8
|
from invoke.collection import Collection
|
|
8
9
|
from invoke.context import Context
|
|
@@ -159,7 +159,7 @@ def _state_resources(*, bucket_name: str, region: str, key: str) -> list[object]
|
|
|
159
159
|
except client.exceptions.NoSuchKey:
|
|
160
160
|
return []
|
|
161
161
|
|
|
162
|
-
body = response["Body"].read().decode()
|
|
162
|
+
body = response["Body"].read().decode("utf-8")
|
|
163
163
|
state_json = cast(dict[str, object], json.loads(body))
|
|
164
164
|
return cast(list[object], state_json.get("resources", []))
|
|
165
165
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"""Helpers for configuring AWS-related environment variables."""
|
|
2
2
|
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
3
|
import contextlib
|
|
6
4
|
from collections.abc import Callable, Generator
|
|
7
5
|
from pathlib import Path
|
|
@@ -51,7 +49,7 @@ AwsEnvironContextManager = contextlib.AbstractContextManager[AwsEnviron]
|
|
|
51
49
|
AwsEnvironFactory = Callable[[], AwsEnvironContextManager]
|
|
52
50
|
|
|
53
51
|
|
|
54
|
-
def
|
|
52
|
+
def aws_profile_from_config(aws_config_path: Path, profile_name: str) -> AwsProfile:
|
|
55
53
|
"""Return AWS profile loaded from an AWS config file.
|
|
56
54
|
|
|
57
55
|
The file is expected to contain a table for each profile, for example:
|
|
@@ -65,7 +63,7 @@ def load_aws_profile_from_config(config_path: Path, profile_name: str) -> AwsPro
|
|
|
65
63
|
before it is used.
|
|
66
64
|
"""
|
|
67
65
|
aws_config = load_config(
|
|
68
|
-
path=
|
|
66
|
+
path=aws_config_path,
|
|
69
67
|
model=_AwsConfig,
|
|
70
68
|
template_factory=aws_toml_template_factory,
|
|
71
69
|
)
|
|
@@ -76,7 +74,7 @@ def load_aws_profile_from_config(config_path: Path, profile_name: str) -> AwsPro
|
|
|
76
74
|
raise KeyError(
|
|
77
75
|
"AWS profile '{}' not found in '{}'".format(
|
|
78
76
|
profile_name,
|
|
79
|
-
|
|
77
|
+
aws_config_path,
|
|
80
78
|
)
|
|
81
79
|
) from exc
|
|
82
80
|
|
|
@@ -164,14 +162,14 @@ def aws_environ_from_profile(
|
|
|
164
162
|
@contextlib.contextmanager
|
|
165
163
|
def aws_environ_from_config(
|
|
166
164
|
*,
|
|
167
|
-
|
|
165
|
+
aws_config_path: Path,
|
|
168
166
|
profile_name: str,
|
|
169
167
|
raise_if_env_exists: bool,
|
|
170
168
|
raise_if_env_changed: bool = True,
|
|
171
169
|
) -> Generator[AwsEnviron]:
|
|
172
170
|
"""Context manager that applies AWS variables read from an AWS config file.
|
|
173
171
|
|
|
174
|
-
The *
|
|
172
|
+
The *aws_config_path* parameter specifies the AWS config file to read. The
|
|
175
173
|
*profile_name* parameter specifies the AWS profile name, which is mapped
|
|
176
174
|
to a ``[<name>]`` table in the config file. See aws_environ_from_profile()
|
|
177
175
|
for credential validation and for raise_if_env_exists/raise_if_env_changed
|
|
@@ -180,8 +178,8 @@ def aws_environ_from_config(
|
|
|
180
178
|
Yields an :class:`AwsEnviron` describing which profile, account ID, IAM
|
|
181
179
|
username, and key ID are active.
|
|
182
180
|
"""
|
|
183
|
-
aws_profile =
|
|
184
|
-
|
|
181
|
+
aws_profile = aws_profile_from_config(
|
|
182
|
+
aws_config_path=aws_config_path, profile_name=profile_name
|
|
185
183
|
)
|
|
186
184
|
with aws_environ_from_profile(
|
|
187
185
|
profile=aws_profile,
|
|
@@ -80,7 +80,7 @@ class _ClaudeCode:
|
|
|
80
80
|
is its answer rather than a failure, and is left to the caller to report.
|
|
81
81
|
"""
|
|
82
82
|
command = [str(self._path), "auth", "status", "--text"]
|
|
83
|
-
result = subprocess.run(command, capture_output=True,
|
|
83
|
+
result = subprocess.run(command, capture_output=True, encoding="utf-8")
|
|
84
84
|
if result.returncode not in (0, 1):
|
|
85
85
|
raise subprocess.CalledProcessError(
|
|
86
86
|
result.returncode, command, result.stdout, result.stderr
|
|
@@ -21,7 +21,6 @@ other way makes them differ from it.
|
|
|
21
21
|
import dataclasses
|
|
22
22
|
import hashlib
|
|
23
23
|
import json
|
|
24
|
-
import locale
|
|
25
24
|
import os
|
|
26
25
|
import pathlib
|
|
27
26
|
import re
|
|
@@ -36,7 +35,7 @@ from pydantic import BaseModel, ValidationError, field_validator
|
|
|
36
35
|
from fogies.age_key import generate_age_key, validate_age_key
|
|
37
36
|
from fogies.config import load_config, resolve_config_path
|
|
38
37
|
from fogies.templates import claude_sync_toml_template_factory
|
|
39
|
-
from fogies.tools.aws_environ import AwsProfile,
|
|
38
|
+
from fogies.tools.aws_environ import AwsProfile, aws_profile_from_config
|
|
40
39
|
from fogies.tools.command import CommandParams, command_run
|
|
41
40
|
from fogies.tools.go import go
|
|
42
41
|
|
|
@@ -71,14 +70,9 @@ _KEY_FILE_NAME = "age-key.txt"
|
|
|
71
70
|
def _symbol(symbol: str) -> str:
|
|
72
71
|
"""Return the pattern of a symbol that begins a line, and the space after it.
|
|
73
72
|
|
|
74
|
-
claude-sync prints it as UTF-8, which
|
|
75
|
-
decodes bytes (e.g., cp1252 on Windows, unless it is UTF-8), so it is also
|
|
76
|
-
matched as that.
|
|
73
|
+
claude-sync prints it as UTF-8, which command_run decodes as UTF-8.
|
|
77
74
|
"""
|
|
78
|
-
|
|
79
|
-
for encoding in {"cp1252", locale.getpreferredencoding(False)}:
|
|
80
|
-
variants.add(symbol.encode("utf-8").decode(encoding, errors="replace"))
|
|
81
|
-
return "(?:{}) ".format("|".join(re.escape(v) for v in sorted(variants)))
|
|
75
|
+
return "{} ".format(re.escape(symbol))
|
|
82
76
|
|
|
83
77
|
|
|
84
78
|
_DONE = _symbol("✓")
|
|
@@ -597,8 +591,8 @@ def configure_claude_sync(
|
|
|
597
591
|
|
|
598
592
|
# The key in the config, or a new one if it has none.
|
|
599
593
|
config = load_claude_sync_config(path=claude_sync_config_path)
|
|
600
|
-
aws_profile =
|
|
601
|
-
|
|
594
|
+
aws_profile = aws_profile_from_config(
|
|
595
|
+
aws_config_path=aws_config_path, profile_name=config.aws_profile
|
|
602
596
|
)
|
|
603
597
|
generated_age_key = config.age_key is None
|
|
604
598
|
age_key = generate_age_key() if config.age_key is None else config.age_key
|
|
@@ -33,8 +33,8 @@ from collections.abc import Callable
|
|
|
33
33
|
from dataclasses import dataclass
|
|
34
34
|
from typing import Annotated, Literal
|
|
35
35
|
|
|
36
|
-
from claude_agent_sdk import delete_session
|
|
37
36
|
from pydantic import AfterValidator, BaseModel, Field, ValidationError
|
|
37
|
+
lazy from claude_agent_sdk import delete_session
|
|
38
38
|
|
|
39
39
|
from fogies.tools.boto import S3PreconditionFailed, s3_get_object, s3_put_object
|
|
40
40
|
from fogies.tools.claude_sync import claude_directory, require_claude_sync_directory
|
|
@@ -3,7 +3,6 @@ import dataclasses
|
|
|
3
3
|
import os
|
|
4
4
|
import pathlib
|
|
5
5
|
import subprocess
|
|
6
|
-
from typing import cast
|
|
7
6
|
|
|
8
7
|
from invoke.context import Context
|
|
9
8
|
from invoke.runners import Result
|
|
@@ -94,6 +93,7 @@ def command_run(
|
|
|
94
93
|
with cd_context:
|
|
95
94
|
result = context.run(
|
|
96
95
|
command_str,
|
|
96
|
+
encoding="utf-8",
|
|
97
97
|
echo_stdin=command_params.echo_stdin,
|
|
98
98
|
# "out" hides only stdout; invoke's False shows both streams.
|
|
99
99
|
hide="out" if command_params.hide else False,
|
|
@@ -104,6 +104,4 @@ def command_run(
|
|
|
104
104
|
in_stream=None if command_params.in_stream else False,
|
|
105
105
|
)
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
# Ensure future revisions to this code never introduce the parameter.
|
|
109
|
-
return cast(Result, result)
|
|
107
|
+
return result
|
fogies-0.0.0.dev13/PKG-INFO
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: fogies
|
|
3
|
-
Version: 0.0.0.dev13
|
|
4
|
-
Summary:
|
|
5
|
-
Author: James Fogarty
|
|
6
|
-
Author-email: jayfo@users.noreply.github.com
|
|
7
|
-
Requires-Python: >=3.14,<4.0
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
10
|
-
Requires-Dist: boto3 (>=1.42.68,<2.0.0)
|
|
11
|
-
Requires-Dist: claude-agent-sdk (>=0.2.168,<0.3.0)
|
|
12
|
-
Requires-Dist: filelock (>=3.25.2,<4.0.0)
|
|
13
|
-
Requires-Dist: ollama (>=0.6.2,<0.7.0)
|
|
14
|
-
Requires-Dist: psutil (>=7.2.2,<8.0.0)
|
|
15
|
-
Requires-Dist: pydantic (>=2.12.5,<3.0.0)
|
|
16
|
-
Requires-Dist: pyrage (>=1.4.0,<2.0.0)
|
|
17
|
-
Requires-Dist: requests (>=2.33.0,<2.34.0)
|
|
18
|
-
Requires-Dist: tenacity (>=9.1.4,<10.0.0)
|
|
19
|
-
Requires-Dist: tomlkit (>=0.15.1,<0.16.0)
|
|
20
|
-
Description-Content-Type: text/markdown
|
|
21
|
-
|
|
22
|
-
# pyfogies
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/includes/templates/backend_status.toml.template
RENAMED
|
File without changes
|
{fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/includes/templates/claude_sync.toml.template
RENAMED
|
File without changes
|
{fogies-0.0.0.dev13 → fogies-0.0.0.dev14}/src/fogies/includes/templates/poetry.toml.template
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|