Skip to content

Commit 4028837

Browse files
committed
Release version 0.0.0.dev446
1 parent 199be2c commit 4028837

File tree

5 files changed

+40
-24
lines changed

5 files changed

+40
-24
lines changed

pkg/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespaces = true
1717
# ----------------------------------------- Project Metadata -------------------------------------
1818
#
1919
[project]
20-
version = "0.0.0.dev445"
20+
version = "0.0.0.dev446"
2121
name = "ControlMan"
2222
dependencies = [
2323
"packaging >= 23.2, < 24",
Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
$id: https://controlman.repodynamics.com/schema/env-var
22
$schema: https://json-schema.org/draft/2020-12/schema
3-
title: Environment Variables
4-
summary: Definition of environment variables.
3+
title: Environment Variable
4+
summary: Definition of an environment variable.
55
type: object
6-
additionalProperties:
7-
title: Environment Variable
8-
summary: A single environment variable.
9-
type: object
10-
properties:
11-
key:
12-
summary: Environment variable key.
13-
default: ${{ .__key__ }}$
14-
$ref: https://jsonschemata.repodynamics.com/string/oneline
15-
value:
16-
summary: Environment variable value.
17-
$ref: https://jsonschemata.repodynamics.com/string/oneline
18-
description:
19-
summary: Description of the environment variable.
20-
$ref: https://jsonschemata.repodynamics.com/string/nonempty
6+
additionalProperties: false
7+
required: [ key, value ]
8+
properties:
9+
key:
10+
summary: Environment variable key.
11+
default: ${{ .__key__ }}$
12+
$ref: https://jsonschemata.repodynamics.com/string/oneline
13+
value:
14+
summary: Environment variable value.
15+
type: string
16+
name:
17+
summary: Display name of the environment variable.
18+
$ref: https://jsonschemata.repodynamics.com/string/nonempty
19+
summary:
20+
summary: Summary of the environment variable.
21+
$ref: https://jsonschemata.repodynamics.com/string/nonempty
22+
description:
23+
summary: Description of the environment variable.
24+
$ref: https://jsonschemata.repodynamics.com/string/nonempty
25+
notes:
26+
summary: Notes about the environment variable.
27+
$ref: https://jsonschemata.repodynamics.com/string/nonempty

pkg/src/controlman/_data/schema/main.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,10 @@ patternProperties:
429429
type: object
430430
additionalProperties:
431431
$ref: https://controlman.repodynamics.com/schema/bash-task
432+
variable:
433+
type: object
434+
additionalProperties:
435+
$ref: https://controlman.repodynamics.com/schema/env-var
432436
path:
433437
summary: Path to the environment file.
434438
$ref: https://jsonschemata.repodynamics.com/path/posix/absolute-from-cwd
@@ -3673,15 +3677,15 @@ properties:
36733677
additionalProperties: false
36743678
default: { }
36753679
properties:
3676-
build:
3680+
temp:
36773681
type: object
36783682
default: { }
36793683
additionalProperties: false
36803684
properties:
36813685
path:
3682-
summary: Path to the local build directory.
3686+
summary: Path to the local temporary directory.
36833687
$ref: https://jsonschemata.repodynamics.com/path/posix/absolute-from-cwd
3684-
default: .local/build
3688+
default: .local/temp
36853689
cache:
36863690
type: object
36873691
default: { }

pkg/src/controlman/file_gen/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ def add_lines(content: str):
342342
packages=list(env.get("conda", {}).values()),
343343
pip_packages=list(env.get("pip", {}).values()),
344344
env_name=env["name"],
345+
variables=list(env.get("variable", {}).values()),
345346
),
346347
**self._data["default"]["file_setting"]["yaml"],
347348
),

pkg/src/controlman/file_gen/unit.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def create_env_file_conda(
2222
packages: list[dict] | None = None,
2323
pip_packages: list[dict] | None = None,
2424
env_name: str | None = None,
25+
variables: list[dict] | None = None,
2526
) -> dict:
2627
"""Create a Conda
2728
[environment.yml](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-file-manually)
@@ -37,9 +38,8 @@ def create_env_file_conda(
3738
List of dictionaries with pip package details.
3839
env_name
3940
Name of the conda environment.
40-
indent:
41-
Number of spaces to use for indentation.
42-
If `None`, a compact format is used with no indentation or newlines.
41+
variables:
42+
Environment variables to set in the conda environment.
4343
"""
4444
file = {}
4545
if env_name:
@@ -51,6 +51,10 @@ def create_env_file_conda(
5151
pip_specs = sorted([pkg["spec"]["full"] for pkg in pip_packages])
5252
dependencies.append({"pip": pip_specs})
5353
file["dependencies"] = dependencies
54+
if variables:
55+
# https://docs.conda.io/projects/conda/en/stable/user-guide/tasks/manage-environments.html#setting-environment-variables
56+
# https://stackoverflow.com/questions/31598963/how-to-set-specific-environment-variables-when-activating-conda-environment
57+
file["variables"] = {var["key"]: var["value"] for var in variables}
5458
return file
5559

5660

0 commit comments

Comments
 (0)