Skip to content

Commit

Permalink
Create APISettings to group to group API-specific client settings (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
desertaxle authored Oct 9, 2024
1 parent da21962 commit 00d064f
Show file tree
Hide file tree
Showing 8 changed files with 434 additions and 213 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/python-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ jobs:
# Do not run Kubernetes service tests, we do not have a cluster available
# maxprocesses 6 is based on empirical testing; higher than 6 sees diminishing returns
- name: Run tests
env:
PREFECT_EXPERIMENTAL_ENABLE_PYDANTIC_V2_INTERNALS: "1"
run: >
pytest ${{ matrix.test-type.modules }}
--numprocesses auto
Expand Down Expand Up @@ -305,8 +303,6 @@ jobs:
# Do not run Kubernetes service tests, we do not have a cluster available
# maxprocesses 6 is based on empirical testing; higher than 6 sees diminishing returns
- name: Run tests
env:
PREFECT_EXPERIMENTAL_ENABLE_PYDANTIC_V2_INTERNALS: "1"
run: >
pytest tests
--numprocesses auto
Expand Down
21 changes: 14 additions & 7 deletions src/prefect/cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

import os
from typing import List, Optional
from typing import Any, Dict, List, Optional

import typer
from dotenv import dotenv_values
Expand Down Expand Up @@ -207,6 +207,18 @@ def _process_setting(
settings_output.append(f"{setting.name}='{display_value}'{source_blurb}")
processed_settings.add(setting.name)

def _collect_defaults(default_values: Dict[str, Any], current_path: List[str] = []):
for key, value in default_values.items():
if isinstance(value, dict):
_collect_defaults(value, current_path + [key])
else:
setting = prefect.settings.SETTING_VARIABLES[
".".join(current_path + [key])
]
if setting.name in processed_settings:
continue
_process_setting(setting, value, "defaults")

# Process settings from the current profile
for setting, value in current_profile_settings.items():
value_and_source = (
Expand All @@ -231,11 +243,6 @@ def _process_setting(
continue
_process_setting(setting, value, ".env file")
if show_defaults:
default_values = prefect.settings.Settings().model_dump(context=dump_context)
for key, value in default_values.items():
setting = prefect.settings.SETTING_VARIABLES[key]
if setting.name in processed_settings:
continue
_process_setting(setting, value, "defaults")
_collect_defaults(prefect.settings.Settings().model_dump(context=dump_context))

app.console.print("\n".join(sorted(settings_output)), soft_wrap=True)
Loading

0 comments on commit 00d064f

Please sign in to comment.