proxygen-cli 4.0.7__tar.gz → 4.0.9__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.
Files changed (39) hide show
  1. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/PKG-INFO +4 -3
  2. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/cli/command_credentials.py +3 -3
  3. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/cli/command_settings.py +3 -3
  4. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/lib/auth.py +1 -1
  5. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/lib/credentials.py +35 -32
  6. proxygen_cli-4.0.9/proxygen_cli/lib/settings.py +37 -0
  7. proxygen_cli-4.0.9/proxygen_cli/lib/url_types.py +21 -0
  8. proxygen_cli-4.0.9/proxygen_cli/test/auth_test.py +50 -0
  9. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/test/command_credentials_test.py +85 -4
  10. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/test/command_settings_test.py +28 -2
  11. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/pyproject.toml +6 -5
  12. proxygen_cli-4.0.7/proxygen_cli/lib/settings.py +0 -37
  13. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/README.md +0 -0
  14. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/__init__.py +0 -0
  15. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/cli/command_docker.py +0 -0
  16. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/cli/command_instance.py +0 -0
  17. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/cli/command_main.py +0 -0
  18. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/cli/command_pytest_nhsd_apim_token.py +0 -0
  19. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/cli/command_secret.py +0 -0
  20. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/cli/command_spec.py +0 -0
  21. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/lib/constants.py +0 -0
  22. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/lib/dot_proxygen.py +0 -0
  23. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/lib/output.py +0 -0
  24. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/lib/proxygen_api.py +0 -0
  25. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/lib/spec.py +0 -0
  26. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/lib/spec_server.py +0 -0
  27. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/lib/version.py +0 -0
  28. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/test/__init__.py +0 -0
  29. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/test/command_instance_test.py +0 -0
  30. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/test/command_main_test.py +0 -0
  31. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/test/command_pytest_nhsd_apim_token_test.py +0 -0
  32. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/test/command_secret_test.py +0 -0
  33. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/test/command_spec_test.py +0 -0
  34. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/test/conftest.py +0 -0
  35. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/test/fixtures/client.key +0 -0
  36. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/test/fixtures/client.pem +0 -0
  37. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/test/fixtures/secret.txt +0 -0
  38. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/test/mock_private_key.py +0 -0
  39. {proxygen_cli-4.0.7 → proxygen_cli-4.0.9}/proxygen_cli/test/validate_cli_version_test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: proxygen-cli
3
- Version: 4.0.7
3
+ Version: 4.0.9
4
4
  Summary: CLI for interacting with NHSD APIM's proxygen service
5
5
  Author: Ben Strutt
6
6
  Author-email: ben.strutt1@nhs.net
@@ -12,8 +12,9 @@ Classifier: Programming Language :: Python :: 3.15
12
12
  Requires-Dist: click (>=8.1.2,<9.0.0)
13
13
  Requires-Dist: cryptography (>=48.0.1,<51.0.0)
14
14
  Requires-Dist: lxml (>=6.0.1,<7.0.0)
15
- Requires-Dist: packaging (>=24.2,<25.0)
16
- Requires-Dist: pydantic (>=1.9.1,<2.0.0)
15
+ Requires-Dist: packaging (>=26.3,<27.0)
16
+ Requires-Dist: pydantic (>=2.14.3,<3.0.0)
17
+ Requires-Dist: pydantic-settings (>=2.16.3,<3.0.0)
17
18
  Requires-Dist: pyjwt (>=2.13.0,<3.0.0)
18
19
  Requires-Dist: pyyaml (>=6.0.3,<7.0.0)
19
20
  Requires-Dist: requests (>=2.32.3,<3.0.0)
@@ -9,7 +9,7 @@ from proxygen_cli.lib.credentials import (
9
9
  Credentials, get_credentials, _yaml_credentials_file_source, create_yaml_credentials_file, initialise_credentials)
10
10
  from proxygen_cli.lib.dot_proxygen import credentials_file
11
11
 
12
- CHOICE_OF_CREDENTIAL_KEYS = click.Choice(Credentials.__fields__.keys())
12
+ CHOICE_OF_CREDENTIAL_KEYS = click.Choice(Credentials.model_fields.keys())
13
13
 
14
14
  @click.group()
15
15
  def credentials():
@@ -26,7 +26,7 @@ def list():
26
26
  exit()
27
27
 
28
28
  creds = get_credentials()
29
- output.print_spec(json.loads(creds.json(exclude_none=True)))
29
+ output.print_spec(json.loads(creds.model_dump_json(exclude_none=True)))
30
30
 
31
31
 
32
32
  @credentials.command()
@@ -80,7 +80,7 @@ def set(custom_pairs, force, env):
80
80
  current_credentials[key] = value
81
81
 
82
82
  try:
83
- new_credentials = json.loads(Credentials(**current_credentials).json(exclude_none=True))
83
+ new_credentials = json.loads(Credentials(**current_credentials).model_dump_json(exclude_none=True))
84
84
  except pydantic.ValidationError as e:
85
85
  errors = json.loads(e.json())
86
86
  raise click.BadParameter("\n".join(error["msg"] for error in errors))
@@ -9,7 +9,7 @@ from proxygen_cli.lib.dot_proxygen import settings_file
9
9
  from proxygen_cli.lib.settings import (SETTINGS, Settings,
10
10
  _yaml_settings_file_source)
11
11
 
12
- CHOICE_OF_SETTINGS_KEYS = click.Choice(Settings.__fields__.keys())
12
+ CHOICE_OF_SETTINGS_KEYS = click.Choice(Settings.model_fields.keys())
13
13
 
14
14
 
15
15
  @click.group()
@@ -28,7 +28,7 @@ def list():
28
28
  """
29
29
  List all settings values.
30
30
  """
31
- output.print_spec(json.loads(SETTINGS.json(exclude_none=True)))
31
+ output.print_spec(json.loads(SETTINGS.model_dump_json(exclude_none=True)))
32
32
 
33
33
 
34
34
  @settings.command()
@@ -61,7 +61,7 @@ def set(key, value, env):
61
61
  current_settings[key] = value
62
62
 
63
63
  try:
64
- new_settings = json.loads(Settings(**current_settings).json(exclude_none=True))
64
+ new_settings = json.loads(Settings(**current_settings).model_dump_json(exclude_none=True))
65
65
  except pydantic.ValidationError as e:
66
66
  errors = json.loads(e.json())
67
67
  raise click.BadParameter("\n".join(error["msg"] for error in errors))
@@ -14,7 +14,7 @@ from .dot_proxygen import token_cache_file
14
14
 
15
15
 
16
16
  def cache_key():
17
- s = get_credentials().json()
17
+ s = get_credentials().model_dump_json()
18
18
  return hashlib.md5(s.encode("utf-8")).hexdigest()
19
19
 
20
20
 
@@ -5,18 +5,15 @@ import yaml
5
5
  import sys
6
6
  import os
7
7
 
8
- from pydantic import (
9
- BaseSettings,
10
- validator,
11
- AnyHttpUrl,
12
- ValidationError,
13
- )
8
+ from pydantic import ValidationError, field_validator
9
+ from pydantic_settings import BaseSettings, SettingsConfigDict
14
10
 
15
11
  from . import dot_proxygen
16
12
  from . import constants
13
+ from .url_types import HttpUrlStr
17
14
 
18
15
 
19
- def _yaml_credentials_file_source(_):
16
+ def _yaml_credentials_file_source(_=None):
20
17
  with dot_proxygen.credentials_file().open() as yaml_file:
21
18
  credentials = yaml.safe_load(yaml_file)
22
19
  return credentials or {}
@@ -31,7 +28,12 @@ def create_yaml_credentials_file():
31
28
 
32
29
 
33
30
  class Credentials(BaseSettings):
34
- base_url: AnyHttpUrl
31
+ model_config = SettingsConfigDict(
32
+ env_prefix="PROXYGEN_CREDENTIALS_",
33
+ case_sensitive=True,
34
+ )
35
+
36
+ base_url: HttpUrlStr
35
37
  private_key_path: Optional[str] = None
36
38
  key_id: Optional[str] = None
37
39
  client_id: Optional[str] = None
@@ -39,9 +41,25 @@ class Credentials(BaseSettings):
39
41
  username: Optional[str] = None
40
42
  password: Optional[str] = None
41
43
 
42
- @validator("username", "password", "client_secret", "client_id")
43
- def validate_humans_users(cls, value, values):
44
- if values.get("private_key_path") is None and value is None:
44
+ @classmethod
45
+ def settings_customise_sources(
46
+ cls,
47
+ settings_cls,
48
+ init_settings,
49
+ env_settings,
50
+ dotenv_settings,
51
+ file_secret_settings,
52
+ ):
53
+ return (
54
+ init_settings,
55
+ env_settings,
56
+ _yaml_credentials_file_source,
57
+ )
58
+
59
+ @field_validator("username", "password", "client_secret", "client_id")
60
+ @classmethod
61
+ def validate_humans_users(cls, value, info):
62
+ if info.data.get("private_key_path") is None and value is None:
45
63
  raise ValueError("field required")
46
64
  return value
47
65
 
@@ -55,17 +73,19 @@ class Credentials(BaseSettings):
55
73
  with private_key_file.open() as f:
56
74
  return f.read()
57
75
 
58
- @validator("key_id")
59
- def validate_kid(cls, kid, values):
76
+ @field_validator("key_id")
77
+ @classmethod
78
+ def validate_kid(cls, kid, info):
60
79
  """
61
80
  If authenticating using a machine (with an associated jwks configured in Keycloak) key,
62
81
  then the key id is required for newer versions of Keycloak.
63
82
  """
64
- if values.get("private_key_path") and not kid:
83
+ if info.data.get("private_key_path") and not kid:
65
84
  raise ValueError("Private key specified with no associated Key ID (KID)")
66
85
  return kid
67
86
 
68
- @validator("private_key_path")
87
+ @field_validator("private_key_path")
88
+ @classmethod
69
89
  def validate_private_key_path(cls, private_key_path):
70
90
  """
71
91
  Pydantic only allows relative to cwd with FilePath.
@@ -92,23 +112,6 @@ class Credentials(BaseSettings):
92
112
  raise ValueError(f"{private_key_path} is a directory, not a file")
93
113
  return str(private_key_file)
94
114
 
95
- class Config:
96
- env_prefix = "PROXYGEN_CREDENTIALS_"
97
- case_sensitive = True
98
-
99
- @classmethod
100
- def customise_sources(
101
- cls,
102
- init_settings,
103
- env_settings,
104
- file_secret_settings,
105
- ):
106
- return (
107
- init_settings,
108
- env_settings,
109
- _yaml_credentials_file_source,
110
- )
111
-
112
115
 
113
116
  _CREDENTIALS = None
114
117
 
@@ -0,0 +1,37 @@
1
+ from typing import Literal, Optional
2
+ from pydantic_settings import BaseSettings
3
+
4
+ import yaml
5
+
6
+ from .dot_proxygen import settings_file
7
+ from .url_types import UrlStr
8
+
9
+
10
+ def _yaml_settings_file_source(_=None):
11
+ with settings_file().open() as yaml_file:
12
+ settings = yaml.safe_load(yaml_file)
13
+ return settings or {}
14
+
15
+
16
+ class Settings(BaseSettings):
17
+ endpoint_url: Optional[UrlStr] = None
18
+ spec_output_format: Literal["json", "yaml"] = "yaml"
19
+ api: Optional[str] = None
20
+
21
+ @classmethod
22
+ def settings_customise_sources(
23
+ cls,
24
+ settings_cls,
25
+ init_settings,
26
+ env_settings,
27
+ dotenv_settings,
28
+ file_secret_settings,
29
+ ):
30
+ return (
31
+ init_settings,
32
+ env_settings,
33
+ _yaml_settings_file_source,
34
+ )
35
+
36
+
37
+ SETTINGS = Settings()
@@ -0,0 +1,21 @@
1
+ from typing import Annotated
2
+
3
+ from pydantic import AfterValidator, AnyHttpUrl, AnyUrl, TypeAdapter
4
+
5
+
6
+ def _validated_str(url_type):
7
+ """
8
+ Validate against a pydantic URL type but keep the value as the original str.
9
+ Pydantic v2 URL types are not str and normalise values (e.g. add a trailing slash).
10
+ """
11
+ adapter = TypeAdapter(url_type)
12
+
13
+ def validate(value: str) -> str:
14
+ adapter.validate_python(value)
15
+ return value
16
+
17
+ return AfterValidator(validate)
18
+
19
+
20
+ UrlStr = Annotated[str, _validated_str(AnyUrl)]
21
+ HttpUrlStr = Annotated[str, _validated_str(AnyHttpUrl)]
@@ -0,0 +1,50 @@
1
+ from unittest.mock import Mock, patch
2
+
3
+ from proxygen_cli.lib import auth
4
+
5
+ BASE_URL = "https://mock-keycloak-url.nhs.uk/realms/api-producers"
6
+
7
+
8
+ def credentials_yaml(**kwargs):
9
+ credentials = {
10
+ "base_url": BASE_URL,
11
+ "client_id": "mock-client",
12
+ "client_secret": "mock-secret",
13
+ "username": "mock-user",
14
+ "password": "mock-password",
15
+ } | kwargs
16
+ return "\n".join(
17
+ f"{key}: {value}" for key, value in credentials.items() if value is not None
18
+ )
19
+
20
+
21
+ def test_cache_key_is_stable_and_depends_on_credentials(update_config):
22
+ update_config(credentials=credentials_yaml())
23
+ key = auth.cache_key()
24
+ assert auth.cache_key() == key
25
+
26
+ update_config(credentials=credentials_yaml(password="other-password"))
27
+ assert auth.cache_key() != key
28
+
29
+
30
+ def test_machine_user_token_request_uses_unmodified_base_url(update_config):
31
+ update_config(
32
+ credentials=credentials_yaml(
33
+ username=None,
34
+ password=None,
35
+ private_key_path="path_to/private_key.pem",
36
+ key_id="kid-1",
37
+ )
38
+ )
39
+ token_response = Mock(status_code=200, json=Mock(return_value={"access_token": "abc"}))
40
+
41
+ with patch("proxygen_cli.lib.auth.jwt.encode", return_value="signed") as encode, \
42
+ patch("proxygen_cli.lib.auth.requests.post", return_value=token_response) as post:
43
+ token_data = auth._get_token_data_from_machine_user()
44
+
45
+ assert token_data == {"access_token": "abc"}
46
+ assert post.call_args.args[0] == f"{BASE_URL}/protocol/openid-connect/token"
47
+ claims = encode.call_args.args[0]
48
+ assert claims["aud"] == BASE_URL
49
+ assert isinstance(claims["aud"], str)
50
+ assert encode.call_args.kwargs["headers"] == {"kid": "kid-1"}
@@ -4,10 +4,10 @@ import yaml
4
4
  import pytest
5
5
  import os
6
6
  from click.testing import CliRunner
7
- from pydantic.error_wrappers import ValidationError
7
+ from pydantic import ValidationError
8
8
 
9
9
  import proxygen_cli.cli.command_credentials as cmd_credentials
10
- from proxygen_cli.lib.credentials import Credentials
10
+ from proxygen_cli.lib.credentials import Credentials, get_credentials
11
11
  CLIENT_ID = os.environ["PROXYGEN_CLIENT_ID"]
12
12
  CLIENT_SECRET = os.environ["PROXYGEN_CLIENT_SECRET"]
13
13
  # added below urls to resolve sonar cloud issues.
@@ -285,7 +285,10 @@ def test_set_invalid_setting(patch_config):
285
285
  runner = CliRunner()
286
286
  result = runner.invoke(cmd_credentials.set, ["invalid", "new-username"])
287
287
 
288
- assert "Enter client ID:Aborted!" in result.output.strip()
288
+ # Click >= 8.2 may emit stderr ("Aborted!") before the stdout prompt
289
+ assert result.exit_code == 1
290
+ assert "Enter client ID:" in result.output
291
+ assert "Aborted!" in result.output
289
292
 
290
293
 
291
294
  def test_set_invalid_private_key_path(patch_config):
@@ -327,4 +330,82 @@ def test_remove_invalid_setting(patch_config):
327
330
  runner = CliRunner()
328
331
  result = runner.invoke(cmd_credentials.rm, ["invalid"])
329
332
 
330
- assert "'invalid' is not one of 'base_url'" in result.output.strip()
333
+ assert "'invalid' is not one of 'base_url'" in result.output.strip()
334
+
335
+ def test_machine_user_credentials_valid(update_config):
336
+ """A machine user needs a key file and key id but no username/password."""
337
+ update_config(
338
+ credentials="\n".join(
339
+ [
340
+ f"base_url: {MOCK_KEYCLOAK_URL}",
341
+ "private_key_path: path_to/private_key.pem",
342
+ "key_id: kid-1",
343
+ ]
344
+ )
345
+ )
346
+
347
+ credentials = Credentials()
348
+
349
+ assert credentials.private_key_path.endswith("path_to/private_key.pem")
350
+ assert credentials.key_id == "kid-1"
351
+ assert credentials.username is None
352
+
353
+
354
+ def test_private_key_path_missing_key_id_rejected(update_config):
355
+ update_config(
356
+ credentials=get_test_credentials(private_key_path="path_to/private_key.pem")
357
+ )
358
+
359
+ with pytest.raises(ValidationError, match="no associated Key ID"):
360
+ Credentials()
361
+
362
+
363
+ def test_private_key_path_does_not_exist(update_config):
364
+ update_config(
365
+ credentials=get_test_credentials(private_key_path="missing.pem", key_id="kid-1")
366
+ )
367
+
368
+ with pytest.raises(ValidationError, match="does not exist"):
369
+ Credentials()
370
+
371
+
372
+ def test_private_key_path_is_directory(update_config):
373
+ update_config(
374
+ credentials=get_test_credentials(private_key_path="path_to", key_id="kid-1")
375
+ )
376
+
377
+ with pytest.raises(ValidationError, match="is a directory"):
378
+ Credentials()
379
+
380
+
381
+ def test_base_url_scheme_must_be_http(update_config):
382
+ update_config(credentials=get_test_credentials(base_url="ftp://mock.nhs.uk"))
383
+
384
+ with pytest.raises(ValidationError, match="http"):
385
+ Credentials()
386
+
387
+
388
+ def test_base_url_is_kept_as_plain_string(update_config):
389
+ """Pydantic URL types would add a trailing slash and break string concatenation."""
390
+ update_config(credentials=get_test_credentials(base_url=MOCK_KEYCLOAK_URL))
391
+
392
+ credentials = Credentials()
393
+
394
+ assert type(credentials.base_url) is str
395
+ assert credentials.base_url == MOCK_KEYCLOAK_URL
396
+
397
+
398
+ def test_environment_variable_overrides_credentials_file(update_config, monkeypatch):
399
+ update_config(credentials=get_test_credentials())
400
+ monkeypatch.setenv("PROXYGEN_CREDENTIALS_username", "env-user")
401
+
402
+ assert Credentials().username == "env-user"
403
+
404
+
405
+ def test_initialise_credentials_invalid_prints_warning(update_config, capsys):
406
+ update_config(credentials=get_test_credentials(username=""))
407
+
408
+ with patch("proxygen_cli.lib.credentials._CREDENTIALS", "sentinel"):
409
+ assert get_credentials() is None
410
+
411
+ assert "Credentials invalid or not configured" in capsys.readouterr().err
@@ -2,7 +2,7 @@ from unittest.mock import patch
2
2
 
3
3
  import pytest
4
4
  from click.testing import CliRunner
5
- from pydantic.error_wrappers import ValidationError
5
+ from pydantic import ValidationError
6
6
 
7
7
  import proxygen_cli.cli.command_settings as cmd_settings
8
8
  from proxygen_cli.lib.settings import Settings
@@ -92,7 +92,7 @@ def test_set_invalid_url():
92
92
  runner = CliRunner()
93
93
  result = runner.invoke(cmd_settings.set, ["endpoint_url", "invalid_url"])
94
94
 
95
- assert "invalid or missing URL scheme" in result.output.strip()
95
+ assert "Input should be a valid URL" in result.output.strip()
96
96
 
97
97
 
98
98
  def test_remove_setting(patch_config, settings_file):
@@ -127,3 +127,29 @@ def test_remove_invalid_setting(patch_config):
127
127
  result = runner.invoke(cmd_settings.rm, ["invalid"])
128
128
 
129
129
  assert " 'invalid' is not one of 'endpoint_url'" in result.output.strip()
130
+
131
+
132
+ def test_endpoint_url_is_kept_as_plain_string(update_config):
133
+ """Pydantic URL types would add a trailing slash and break urljoin/path handling."""
134
+ update_config(settings=get_test_settings(endpoint_url="https://mock-proxygen.nhs.uk"))
135
+
136
+ settings = Settings()
137
+
138
+ assert type(settings.endpoint_url) is str
139
+ assert settings.endpoint_url == "https://mock-proxygen.nhs.uk"
140
+
141
+
142
+ def test_settings_defaults(update_config):
143
+ update_config(settings="endpoint_url: https://mock-proxygen.nhs.uk")
144
+
145
+ settings = Settings()
146
+
147
+ assert settings.api is None
148
+ assert settings.spec_output_format == "yaml"
149
+
150
+
151
+ def test_invalid_spec_output_format(update_config):
152
+ update_config(settings=get_test_settings(spec_output_format="xml"))
153
+
154
+ with pytest.raises(ValidationError):
155
+ Settings()
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "proxygen-cli"
3
- version = "4.0.7"
3
+ version = "4.0.9"
4
4
  description = "CLI for interacting with NHSD APIM's proxygen service"
5
5
  authors = ["Ben Strutt <ben.strutt1@nhs.net>"]
6
6
  readme = "README.md"
@@ -12,7 +12,8 @@ proxygen = 'proxygen_cli.cli.command_main:main'
12
12
 
13
13
  [tool.poetry.dependencies]
14
14
  python = "^3.13"
15
- pydantic = "^1.9.1"
15
+ pydantic = "^2.14.3"
16
+ pydantic-settings = "^2.16.3"
16
17
  click="^8.1.2"
17
18
  pyjwt = "^2.13.0"
18
19
  requests = "^2.32.3"
@@ -21,12 +22,12 @@ cryptography = ">=48.0.1,<51.0.0" # Not directly imported, but needed by pyjwt f
21
22
  pyyaml = "^6.0.3"
22
23
  yaspin = "^3.2.0"
23
24
  tabulate = ">=0.9,<0.11"
24
- packaging = "^24.2"
25
+ packaging = "^26.3"
25
26
 
26
27
  [tool.poetry.group.dev.dependencies]
27
28
  pytest = "^9.0.3"
28
- pytest-cov = "^4.0.0"
29
- pytest-icdiff = "^0.6"
29
+ pytest-cov = "^7.1.0"
30
+ pytest-icdiff = "^0.9"
30
31
 
31
32
  [build-system]
32
33
  requires = ["poetry-core"]
@@ -1,37 +0,0 @@
1
- from typing import Literal, Optional
2
- from pydantic import BaseSettings, AnyUrl
3
-
4
- import yaml
5
-
6
- from .dot_proxygen import settings_file
7
-
8
-
9
- def _yaml_settings_file_source(_):
10
- with settings_file().open() as yaml_file:
11
- settings = yaml.safe_load(yaml_file)
12
- return settings or {}
13
-
14
-
15
- class Settings(BaseSettings):
16
- endpoint_url: Optional[AnyUrl] = None
17
- spec_output_format: Literal["json", "yaml"] = "yaml"
18
- api: str = None
19
-
20
- class Config:
21
- env_prefix: Literal["PROXYGEN_CREDENTIALS_"]
22
-
23
- @classmethod
24
- def customise_sources(
25
- cls,
26
- init_settings,
27
- env_settings,
28
- file_secret_settings,
29
- ):
30
- return (
31
- init_settings,
32
- env_settings,
33
- _yaml_settings_file_source,
34
- )
35
-
36
-
37
- SETTINGS = Settings()
File without changes