Skip to content

Commit d40c3ce

Browse files
More dissection and consolidation of dependencies as appropriate. Try to get CI Actions to pass for 'uv run ruff check' on 2 particular projects (sftp-outbound-transfer-lambda and locust_tests).
1 parent a6ca9b2 commit d40c3ce

27 files changed

Lines changed: 82 additions & 158 deletions

File tree

.github/workflows/ci-python.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- "**/*.py"
77
- "**/*requirement*.txt"
88
- "**/uv.lock"
9+
- "**/pyproject.toml"
910
- ".github/workflows/ci-python.yml"
1011

1112
merge_group:
@@ -17,7 +18,7 @@ env:
1718
PYTHON_MAX: 3.14
1819

1920
jobs:
20-
matrix-pytest:
21+
setup-workspace:
2122
runs-on: ubuntu-24.04
2223
strategy:
2324
matrix:
@@ -62,6 +63,9 @@ jobs:
6263
java-version: "25"
6364
distribution: "corretto"
6465
- uses: astral-sh/setup-uv@v7
66+
with:
67+
version: "latest"
68+
enable-cache: true
6569
- name: Run Python Tests per project
6670
id: run-pytest-set
6771
run: |

apps/bfd-model-idr/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dependencies = [
88
"pandas>=2.2.3",
99
"xlsxwriter>=3.2.5",
1010
"pyyaml>=6.0.2",
11-
"pydantic>=2.12.3",
11+
"pydantic",
1212
"tqdm>=4.67.1",
1313
"click>=8.3.1",
1414
"requests>=2.32.5",

apps/bfd-server-ng/codegen/.python-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/utils/locust_tests/common/bfd_user_base.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,17 @@
77
from collections.abc import Callable, Mapping
88
from typing import Any
99

10-
from locust import FastHttpUser, events
11-
from locust.argument_parser import LocustArgumentParser
12-
from locust.contrib.fasthttp import ResponseContextManager
13-
from locust.env import Environment
14-
1510
from common import custom_args, data, validation
1611
from common.locust_utils import is_distributed, is_locust_worker
1712
from common.stats import stats_compare, stats_writers
1813
from common.stats.aggregated_stats import FinalCompareResult, StatsCollector
1914
from common.stats.stats_config import StatsConfiguration
2015
from common.url_path import create_url_path
2116
from common.validation import ValidationResult
17+
from locust import FastHttpUser, events
18+
from locust.argument_parser import LocustArgumentParser
19+
from locust.contrib.fasthttp import ResponseContextManager
20+
from locust.env import Environment
2221

2322
_COMPARISONS_METADATA_PATH = None
2423
"""The path to a given stats comparison metadata JSON file for a particular test suite. Should be
@@ -27,12 +26,12 @@
2726

2827

2928
@events.init_command_line_parser.add_listener
30-
def _(parser: LocustArgumentParser, **kwargs: dict[str, Any]) -> None: # noqa: ARG001
29+
def _(parser: LocustArgumentParser, **kwargs: dict[str, Any]) -> None:
3130
custom_args.register_custom_args(parser)
3231

3332

3433
@events.init.add_listener
35-
def _(environment: Environment, **kwargs: dict[str, Any]) -> None: # noqa: ARG001
34+
def _(environment: Environment, **kwargs: dict[str, Any]) -> None:
3635
if is_distributed(environment) and is_locust_worker(environment):
3736
return
3837

@@ -44,7 +43,7 @@ def _(environment: Environment, **kwargs: dict[str, Any]) -> None: # noqa: ARG0
4443

4544

4645
@events.quitting.add_listener
47-
def _(environment: Environment, **kwargs: dict[str, Any]) -> None: # noqa: ARG001
46+
def _(environment: Environment, **kwargs: dict[str, Any]) -> None:
4847
"""Run one-time teardown tasks after the tests have completed.
4948
5049
Args:

apps/utils/locust_tests/common/db.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def _get_regression_query(select_query: str) -> str:
5454
)
5555

5656

57-
def get_regression_bene_ids(uri: str, table_sample_pct: float | None = None) -> list[str]: # noqa: ARG001
57+
def get_regression_bene_ids(uri: str, table_sample_pct: float | None = None) -> list[str]:
5858
"""Retrieve a list of beneficiary IDs within the range of 20,000 contiguous synthetic
5959
beneficiaries that exist in each environment. Returned list is sorted in ascending order.
6060
@@ -68,7 +68,7 @@ def get_regression_bene_ids(uri: str, table_sample_pct: float | None = None) ->
6868
return [str(r[0]) for r in _execute(uri, bene_query)]
6969

7070

71-
def get_regression_hashed_mbis(uri: str, table_sample_pct: float | None = None) -> list[str]: # noqa: ARG001
71+
def get_regression_hashed_mbis(uri: str, table_sample_pct: float | None = None) -> list[str]:
7272
"""Retrieve a list of hashed MBIs within the range of 20,000 contiguous synthetic
7373
beneficiaries that exist in each environment. Returned list is sorted in ascending order.
7474
@@ -82,7 +82,7 @@ def get_regression_hashed_mbis(uri: str, table_sample_pct: float | None = None)
8282
return [str(r[0]) for r in _execute(uri, mbi_query)]
8383

8484

85-
def get_regression_mbis(uri: str, table_sample_pct: float | None = None) -> list[str]: # noqa: ARG001
85+
def get_regression_mbis(uri: str, table_sample_pct: float | None = None) -> list[str]:
8686
"""Retrieve a list of MBIs within the range of 20,000 contiguous synthetic
8787
beneficiaries that exist in each environment. Returned list is sorted in ascending order.
8888
@@ -98,7 +98,7 @@ def get_regression_mbis(uri: str, table_sample_pct: float | None = None) -> list
9898

9999
def get_regression_contract_ids(
100100
uri: str,
101-
table_sample_pct: float | None = None, # noqa: ARG001
101+
table_sample_pct: float | None = None,
102102
) -> list[dict[str, str]]:
103103
"""Retrieve a list of contract IDs within the range of 20,000 contiguous synthetic
104104
beneficiaries that exist in each environment. Returned list is sorted in ascending order, and
@@ -126,7 +126,7 @@ def get_regression_contract_ids(
126126
]
127127

128128

129-
def get_regression_pac_hashed_mbis(uri: str, table_sample_pct: float | None = None) -> list[str]: # noqa: ARG001
129+
def get_regression_pac_hashed_mbis(uri: str, table_sample_pct: float | None = None) -> list[str]:
130130
"""Return a list of MBI hashes within the set of static, synthetic PAC data.
131131
132132
Args:
@@ -141,7 +141,7 @@ def get_regression_pac_hashed_mbis(uri: str, table_sample_pct: float | None = No
141141
return [str(r[0]) for r in _execute(uri, claims_mbis_query)]
142142

143143

144-
def get_regression_pac_mbis(uri: str, table_sample_pct: float | None = None) -> list[str]: # noqa: ARG001
144+
def get_regression_pac_mbis(uri: str, table_sample_pct: float | None = None) -> list[str]:
145145
"""Return a list of MBI within the set of static, synthetic PAC data.
146146
147147
Args:

apps/utils/locust_tests/common/db_idr.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def _execute(uri: str, query: LiteralString) -> list:
2828

2929

3030
# table_sample_pct is required for the interface even though it's unused here
31-
def get_regression_bene_sks(uri: str, table_sample_pct: float | None = None) -> list[str]: # noqa: ARG001
31+
def get_regression_bene_sks(uri: str, table_sample_pct: float | None = None) -> list[str]:
3232
"""Retrieve a random list of beneficiary IDs.
3333
3434
Args:
@@ -43,7 +43,7 @@ def get_regression_bene_sks(uri: str, table_sample_pct: float | None = None) ->
4343

4444
def get_regression_current_part_a_bene_sks(
4545
uri: str,
46-
table_sample_pct: float | None = None, # noqa: ARG001
46+
table_sample_pct: float | None = None,
4747
) -> list[str]:
4848
"""Retrieve a random list of beneficiary IDs.
4949
@@ -65,7 +65,7 @@ def get_regression_current_part_a_bene_sks(
6565

6666
def get_regression_current_part_b_bene_sks(
6767
uri: str,
68-
table_sample_pct: float | None = None, # noqa: ARG001
68+
table_sample_pct: float | None = None,
6969
) -> list[str]:
7070
"""Retrieve a random list of beneficiary IDs.
7171
@@ -84,7 +84,7 @@ def get_regression_current_part_b_bene_sks(
8484
return [str(r[0]) for r in _execute(uri, bene_query)]
8585

8686

87-
def get_regression_bene_mbis(uri: str, table_sample_pct: float | None = None) -> list[str]: # noqa: ARG001
87+
def get_regression_bene_mbis(uri: str, table_sample_pct: float | None = None) -> list[str]:
8888
"""Retrieve a random list list of MBIs.
8989
9090
Args:
@@ -97,7 +97,7 @@ def get_regression_bene_mbis(uri: str, table_sample_pct: float | None = None) ->
9797
return [str(r[0]) for r in _execute(uri, bene_query)]
9898

9999

100-
def get_regression_claim_ids(uri: str, table_sample_pct: float | None = None) -> list[str]: # noqa: ARG001
100+
def get_regression_claim_ids(uri: str, table_sample_pct: float | None = None) -> list[str]:
101101
"""Retrieve a random list list of clam Ids.
102102
103103
Args:

apps/utils/locust_tests/common/stats/aggregated_stats.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
from enum import StrEnum
1010
from typing import Any
1111

12+
from common.validation import ValidationResult
1213
from locust.env import Environment
1314
from locust.stats import PERCENTILES_TO_REPORT, StatsEntry
1415

15-
from common.validation import ValidationResult
16-
1716
ResponseTimePercentiles = dict[str, int | float]
1817
"""A type representing a dictionary of stringified percentile keys to their integer or
1918
floating-point values"""

apps/utils/locust_tests/common/stats/stats_loaders.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
from statistics import mean
1212
from typing import Any
1313

14-
from gevent import monkey
15-
1614
from common.stats.aggregated_stats import (
1715
AggregatedStats,
1816
FinalCompareResult,
@@ -25,6 +23,7 @@
2523
StatsStorageType,
2624
)
2725
from common.validation import ValidationResult
26+
from gevent import monkey
2827

2928
# botocore/boto3 is incompatible with gevent out-of-box causing issues with SSL.
3029
# We need to monkey patch gevent _before_ importing boto3 to ensure this doesn't happen.
@@ -180,7 +179,7 @@ def __init__(self, stats_config: StatsConfiguration, metadata: StatsMetadata) ->
180179
def load_previous(self) -> AggregatedStats | None:
181180
query = (
182181
f"SELECT cast(totals as JSON), cast(tasks as JSON) "
183-
f'FROM "{self.stats_config.stats_store_s3_database}"."{self.stats_config.stats_store_s3_table}" ' # noqa: E501
182+
f'FROM "{self.stats_config.stats_store_s3_database}"."{self.stats_config.stats_store_s3_table}" '
184183
f"WHERE {self.__get_where_clause()} ORDER BY metadata.timestamp DESC "
185184
"LIMIT 1"
186185
)
@@ -191,7 +190,7 @@ def load_previous(self) -> AggregatedStats | None:
191190
def load_average(self) -> AggregatedStats | None:
192191
query = (
193192
f"SELECT cast(totals as JSON), cast(tasks as JSON) "
194-
f'FROM "{self.stats_config.stats_store_s3_database}"."{self.stats_config.stats_store_s3_table}" ' # noqa: E501
193+
f'FROM "{self.stats_config.stats_store_s3_database}"."{self.stats_config.stats_store_s3_table}" '
195194
f"WHERE {self.__get_where_clause()} "
196195
"ORDER BY metadata.timestamp DESC "
197196
f"LIMIT {self.stats_config.stats_compare_load_limit}"

apps/utils/locust_tests/common/stats/stats_writers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
from dataclasses import asdict
88
from pathlib import Path
99

10-
from gevent import monkey
11-
1210
from common.stats.aggregated_stats import AggregatedStats
1311
from common.stats.stats_config import StatsConfiguration, StatsStorageType
12+
from gevent import monkey
1413

1514
# botocore/boto3 is incompatible with gevent out-of-box causing issues with SSL.
1615
# We need to monkey patch gevent _before_ importing boto3 to ensure this doesn't happen.

apps/utils/locust_tests/high_volume_suite.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@
1010
TypeVar,
1111
)
1212

13-
from locust import TaskSet, User, events, tag, task
14-
from locust.env import Environment
15-
1613
from common import data, db
1714
from common.bfd_user_base import BFDUserBase
1815
from common.locust_utils import is_distributed, is_locust_master
1916
from common.url_path import create_url_path
2017
from common.user_init_aware_load_shape import UserInitAwareLoadShape
18+
from locust import TaskSet, User, events, tag, task
19+
from locust.env import Environment
2120

2221
TaskT = TypeVar("TaskT", Callable[..., None], type["TaskSet"])
2322
MASTER_BENE_IDS: Collection[str] = []
@@ -28,7 +27,7 @@
2827

2928

3029
@events.test_start.add_listener
31-
def _(environment: Environment, **kwargs: dict[str, Any]) -> None: # noqa: ARG001
30+
def _(environment: Environment, **kwargs: dict[str, Any]) -> None:
3231
if (
3332
is_distributed(environment) and is_locust_master(environment)
3433
) or not environment.parsed_options:
@@ -296,7 +295,7 @@ class PatientTaskSet(HighVolumeTaskSet):
296295
def patient_test_coverage_contract_v1(self) -> None:
297296
"""Patient search by coverage contract (all pages)."""
298297

299-
def make_url(): # noqa: ANN202
298+
def make_url():
300299
contract = self.user.contract_data.pop()
301300
return create_url_path(
302301
"/v1/fhir/Patient",

0 commit comments

Comments
 (0)