Skip to content

Commit

Permalink
Use uv for environment management and ruff with py310 #113
Browse files Browse the repository at this point in the history
  • Loading branch information
agoscinski authored Jan 31, 2025
2 parents 73b0697 + 503bc48 commit c57a890
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ source = ["sirocco"]

[tool.ruff]
include = ["src/*py", "tests/*py"]
target-version = "py39"
target-version = "py310"

[tool.ruff.lint]
ignore = [
Expand All @@ -74,7 +74,11 @@ include = [
[tool.hatch.version]
path = "src/sirocco/__init__.py"

[tool.hatch.envs.default]
installer = "uv"

[tool.hatch.envs.hatch-test]
installer = "uv"
extra-dependencies = [
"ipdb"
]
Expand All @@ -85,6 +89,7 @@ extra-args = ["--doctest-modules"]
python = ["3.12"]

[tool.hatch.envs.docs]
installer = "uv"
description = "Build the documentation"
extra-dependencies = [
"mkdocs-material",
Expand Down
2 changes: 1 addition & 1 deletion src/sirocco/core/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, workflow_config: CanonicalWorkflow) -> None:
# Function to iterate over date and parameter combinations
def iter_coordinates(param_refs: list, date: datetime | None = None) -> Iterator[dict]:
space = ({} if date is None else {"date": [date]}) | {k: workflow_config.parameters[k] for k in param_refs}
yield from (dict(zip(space.keys(), x)) for x in product(*space.values()))
yield from (dict(zip(space.keys(), x, strict=False)) for x in product(*space.values()))

# 1 - create availalbe data nodes
for data_config in workflow_config.data.available:
Expand Down
6 changes: 3 additions & 3 deletions src/sirocco/parsing/_yaml_data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def check_nmls(cls, nmls: dict[str, ConfigNamelist] | list[Any]) -> dict[str, Co
master_found = False
for nml in nmls:
msg = f"was expecting a dict of length 1 or a string, got {nml}"
if not isinstance(nml, (str, dict)):
if not isinstance(nml, str | dict):
raise TypeError(msg)
if isinstance(nml, dict) and len(nml) > 1:
raise TypeError(msg)
Expand Down Expand Up @@ -596,7 +596,7 @@ class ConfigData(BaseModel):
def get_plugin_from_named_base_model(
data: dict | ConfigRootTask | ConfigShellTask | ConfigIconTask,
) -> str:
if isinstance(data, (ConfigRootTask, ConfigShellTask, ConfigIconTask)):
if isinstance(data, ConfigRootTask | ConfigShellTask | ConfigIconTask):
return data.plugin
name_and_specs = ConfigBaseTask.extract_merge_name(data)
if name_and_specs.get("name", None) == "ROOT":
Expand Down Expand Up @@ -666,7 +666,7 @@ def check_parameters_lists(cls, data) -> dict[str, list]:
msg = f"""{param_name}: parameters must map a string to list of single values, got {param_values}"""
if isinstance(param_values, list):
for v in param_values:
if isinstance(v, (dict, list)):
if isinstance(v, dict | list):
raise TypeError(msg)
else:
raise TypeError(msg)
Expand Down

0 comments on commit c57a890

Please sign in to comment.