Skip to content

Commit 410b00a

Browse files
committed
policy: make overrides, exclude and ignored_validations optional
1 parent 9cb4647 commit 410b00a

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
envs/env1.yaml
5151
envs/env2.yaml
5252
expected-failure: ["false"]
53+
policy-file: ["policy.yaml"]
5354
include:
5455
- env-paths: |
5556
envs/failing-env1.yaml
@@ -58,6 +59,8 @@ jobs:
5859
envs/env1.yaml
5960
envs/failing-env1.yaml
6061
expected-failure: "true"
62+
- env-paths: "envs/env3.yaml"
63+
policy-file: policy_no_extra_options.yaml
6164

6265
steps:
6366
- name: clone the repository
@@ -67,7 +70,7 @@ jobs:
6770
id: action-run
6871
continue-on-error: true
6972
with:
70-
policy: policy.yaml
73+
policy: ${{ matrix.policy-file }}
7174
environment-paths: ${{ matrix.env-paths }}
7275
today: 2024-12-20
7376
- name: detect outcome

envs/env3.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
channels:
2+
- conda-forge
3+
dependencies:
4+
- python=3.10
5+
- numpy=1.24

minimum_versions.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@
5252
"required": [
5353
"packages",
5454
"default",
55-
"overrides",
56-
"exclude",
57-
"ignored_violations",
5855
],
5956
},
6057
},
@@ -167,11 +164,11 @@ def parse_policy(file):
167164
return Policy(
168165
channels=policy["channels"],
169166
platforms=policy["platforms"],
170-
exclude=package_policy["exclude"],
167+
exclude=package_policy.get("exclude", {}),
171168
package_months=package_policy["packages"],
172169
default_months=package_policy["default"],
173-
ignored_violations=package_policy["ignored_violations"],
174-
overrides=package_policy["overrides"],
170+
ignored_violations=package_policy.get("ignored_violations", {}),
171+
overrides=package_policy.get("overrides", {}),
175172
)
176173

177174

policy_no_extra_options.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
channels:
2+
- conda-forge
3+
platforms:
4+
- noarch
5+
- linux-64
6+
policy:
7+
# all packages in months
8+
packages:
9+
python: 30
10+
numpy: 18
11+
default: 12

0 commit comments

Comments
 (0)