yamloom 0.1.0__cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,78 @@
1
+ from __future__ import annotations
2
+ from yamloom.actions.utils import validate_choice
3
+
4
+ from typing import TYPE_CHECKING
5
+
6
+ from ..._yamloom import Step
7
+ from ..._yamloom import action
8
+ from ..types import (
9
+ Oboollike,
10
+ Oboolstr,
11
+ Ointlike,
12
+ Ostr,
13
+ Ostrlike,
14
+ StringLike,
15
+ )
16
+
17
+ if TYPE_CHECKING:
18
+ from collections.abc import Mapping
19
+
20
+ __all__ = ['setup_ruby']
21
+
22
+
23
+ def setup_ruby(
24
+ *,
25
+ name: Ostrlike = None,
26
+ version: str = 'v1',
27
+ ruby_version: Ostrlike = None,
28
+ rubygems: Ostrlike = None,
29
+ bundler: Ostrlike = None,
30
+ bundler_cache: Oboollike = None,
31
+ ruby_working_directory: Ostrlike = None,
32
+ cache_version: Ostrlike = None,
33
+ self_hosted: Oboollike = None,
34
+ windows_toolchain: Ostrlike = None,
35
+ token: Ostrlike = None,
36
+ args: Ostrlike = None,
37
+ entrypoint: Ostrlike = None,
38
+ condition: Oboolstr = None,
39
+ working_directory: Ostrlike = None,
40
+ shell: Ostr = None,
41
+ id: Ostr = None, # noqa: A002
42
+ env: Mapping[str, StringLike] | None = None,
43
+ continue_on_error: Oboollike = None,
44
+ timeout_minutes: Ointlike = None,
45
+ ) -> Step:
46
+ options: dict[str, object] = {
47
+ 'ruby-version': ruby_version,
48
+ 'rubygems': rubygems,
49
+ 'bundler': bundler,
50
+ 'bundler-cache': bundler_cache,
51
+ 'working-directory': ruby_working_directory,
52
+ 'cache-version': cache_version,
53
+ 'self-hosted': self_hosted,
54
+ 'windows-toolchain': validate_choice(
55
+ 'windows-toolchain', windows_toolchain, ['defauult', 'none']
56
+ ),
57
+ 'token': token,
58
+ }
59
+ options = {key: value for key, value in options.items() if value is not None}
60
+
61
+ if name is None:
62
+ name = 'Setup Ruby'
63
+
64
+ return action(
65
+ name,
66
+ 'actions/setup-ruby',
67
+ ref=version,
68
+ with_opts=options or None,
69
+ args=args,
70
+ entrypoint=entrypoint,
71
+ condition=condition,
72
+ working_directory=working_directory,
73
+ shell=shell,
74
+ id=id,
75
+ env=env,
76
+ continue_on_error=continue_on_error,
77
+ timeout_minutes=timeout_minutes,
78
+ )
@@ -0,0 +1,153 @@
1
+ from __future__ import annotations
2
+ from yamloom.actions.utils import validate_choice
3
+
4
+ from typing import TYPE_CHECKING
5
+
6
+ from ..._yamloom import Step
7
+ from ..._yamloom import action
8
+ from ..types import (
9
+ Oboollike,
10
+ Oboolstr,
11
+ Ointlike,
12
+ Ostr,
13
+ Ostrlike,
14
+ StringLike,
15
+ )
16
+
17
+ if TYPE_CHECKING:
18
+ from collections.abc import Mapping, Sequence
19
+
20
+ __all__ = ['install_rust_tool', 'setup_rust']
21
+
22
+
23
+ def setup_rust(
24
+ *,
25
+ name: Ostrlike = None,
26
+ version: str = 'v1',
27
+ toolchain: Ostrlike = None,
28
+ target: Ostrlike = None,
29
+ components: Sequence[StringLike] | None = None,
30
+ cache: Oboollike = None,
31
+ cache_directories: Sequence[StringLike] | None = None,
32
+ cache_workspaces: Sequence[StringLike] | None = None,
33
+ cache_on_failure: Oboollike = None,
34
+ cache_key: Ostrlike = None,
35
+ cache_shared_key: Ostrlike = None,
36
+ cache_bin: Oboollike = None,
37
+ cache_provider: Ostrlike = None,
38
+ cache_all_crates: Oboollike = None,
39
+ cache_workspace_crates: Oboollike = None,
40
+ matcher: Oboollike = None,
41
+ rustflags: Ostrlike = None,
42
+ override: Oboollike = None,
43
+ rust_src_dir: Ostrlike = None,
44
+ args: Ostrlike = None,
45
+ entrypoint: Ostrlike = None,
46
+ condition: Oboolstr = None,
47
+ working_directory: Ostrlike = None,
48
+ shell: Ostr = None,
49
+ id: Ostr = None, # noqa: A002
50
+ env: Mapping[str, StringLike] | None = None,
51
+ continue_on_error: Oboollike = None,
52
+ timeout_minutes: Ointlike = None,
53
+ ) -> Step:
54
+ options: dict[str, object] = {
55
+ 'toolchain': toolchain,
56
+ 'target': target,
57
+ 'components': ','.join(str(s) for s in components)
58
+ if components is not None
59
+ else None,
60
+ 'cache': cache,
61
+ 'cache-directories': '\n'.join(str(s) for s in cache_directories)
62
+ if cache_directories is not None
63
+ else None,
64
+ 'cache-workspaces': '\n'.join(str(s) for s in cache_workspaces)
65
+ if cache_workspaces is not None
66
+ else None,
67
+ 'cache-on-failure': cache_on_failure,
68
+ 'cache-key': cache_key,
69
+ 'cache-shared-key': cache_shared_key,
70
+ 'cache-bin': cache_bin,
71
+ 'cache-provider': validate_choice(
72
+ 'cache_provider', cache_provider, ['github', 'buildjet', 'warpbuild']
73
+ ),
74
+ 'cache-all-crates': cache_all_crates,
75
+ 'cache-workspace-crates': cache_workspace_crates,
76
+ 'matcher': matcher,
77
+ 'rustflags': rustflags,
78
+ 'override': override,
79
+ 'rust-src-dir': rust_src_dir,
80
+ }
81
+
82
+ options = {key: value for key, value in options.items() if value is not None}
83
+
84
+ if name is None:
85
+ name = 'Setup Rust'
86
+
87
+ return action(
88
+ name,
89
+ 'actions-rust-lang/setup-rust-toolchain',
90
+ ref=version,
91
+ with_opts=options or None,
92
+ args=args,
93
+ entrypoint=entrypoint,
94
+ condition=condition,
95
+ working_directory=working_directory,
96
+ shell=shell,
97
+ id=id,
98
+ env=env,
99
+ continue_on_error=continue_on_error,
100
+ timeout_minutes=timeout_minutes,
101
+ )
102
+
103
+
104
+ def install_rust_tool(
105
+ *,
106
+ tool: Sequence[StringLike],
107
+ name: Ostrlike = None,
108
+ version: str = 'v1',
109
+ checksum: Oboollike = None,
110
+ fallback: Ostrlike = None,
111
+ args: Ostrlike = None,
112
+ entrypoint: Ostrlike = None,
113
+ condition: Oboolstr = None,
114
+ working_directory: Ostrlike = None,
115
+ shell: Ostr = None,
116
+ id: Ostr = None, # noqa: A002
117
+ env: Mapping[str, StringLike] | None = None,
118
+ continue_on_error: Oboollike = None,
119
+ timeout_minutes: Ointlike = None,
120
+ ) -> Step:
121
+ if not tool:
122
+ msg = "at least one 'tool' must be specified"
123
+ raise ValueError(msg)
124
+
125
+ options: dict[str, object] = {
126
+ 'tool': ','.join(str(s) for s in tool),
127
+ 'checksum': checksum,
128
+ 'fallback': validate_choice(
129
+ 'fallback', fallback, ['none', 'cargo-binstall', 'cargo-install']
130
+ ),
131
+ }
132
+
133
+ options = {key: value for key, value in options.items() if value is not None}
134
+
135
+ if name is None:
136
+ suffix = 's' if len(tool) > 1 else ''
137
+ name = f'Install Rust Tool{suffix}'
138
+
139
+ return action(
140
+ name,
141
+ 'taiki-e/install-action',
142
+ ref=version,
143
+ with_opts=options or None,
144
+ args=args,
145
+ entrypoint=entrypoint,
146
+ condition=condition,
147
+ working_directory=working_directory,
148
+ shell=shell,
149
+ id=id,
150
+ env=env,
151
+ continue_on_error=continue_on_error,
152
+ timeout_minutes=timeout_minutes,
153
+ )
@@ -0,0 +1,72 @@
1
+ from __future__ import annotations
2
+ from yamloom.actions.utils import validate_choice, check_string
3
+
4
+ from typing import TYPE_CHECKING
5
+
6
+ from ..._yamloom import Step
7
+ from ..._yamloom import action
8
+ from ..types import (
9
+ Oboollike,
10
+ Oboolstr,
11
+ Ointlike,
12
+ Ostr,
13
+ Ostrlike,
14
+ StringLike,
15
+ )
16
+
17
+ if TYPE_CHECKING:
18
+ from collections.abc import Mapping
19
+
20
+ __all__ = ['setup_mpi']
21
+
22
+
23
+ def setup_mpi(
24
+ *,
25
+ name: Ostrlike = None,
26
+ version: str = 'v1',
27
+ mpi: Ostrlike = None,
28
+ args: Ostrlike = None,
29
+ entrypoint: Ostrlike = None,
30
+ condition: Oboolstr = None,
31
+ working_directory: Ostrlike = None,
32
+ shell: Ostr = None,
33
+ id: Ostr = None, # noqa: A002
34
+ env: Mapping[str, StringLike] | None = None,
35
+ continue_on_error: Oboollike = None,
36
+ timeout_minutes: Ointlike = None,
37
+ ) -> Step:
38
+ options: dict[str, object] = {
39
+ 'mpi': validate_choice('mpi', mpi, ['mpich', 'openmpi', 'intelmpi', 'msmpi']),
40
+ }
41
+
42
+ options = {key: value for key, value in options.items() if value is not None}
43
+
44
+ mpi_names = {
45
+ 'mpich': 'MPICH',
46
+ 'openmpi': 'Open MPI',
47
+ 'intelmpi': 'Intel MPI',
48
+ 'msmpi': 'Microsoft MPI',
49
+ }
50
+
51
+ if name is None:
52
+ mpi_str = check_string(options.get('mpi'))
53
+ if mpi_str:
54
+ name = f'Setup {mpi_names[mpi_str]}'
55
+ else:
56
+ name = 'Setup MPI'
57
+
58
+ return action(
59
+ name,
60
+ 'mpi4py/setup-mpi',
61
+ ref=version,
62
+ with_opts=options or None,
63
+ args=args,
64
+ entrypoint=entrypoint,
65
+ condition=condition,
66
+ working_directory=working_directory,
67
+ shell=shell,
68
+ id=id,
69
+ env=env,
70
+ continue_on_error=continue_on_error,
71
+ timeout_minutes=timeout_minutes,
72
+ )
@@ -0,0 +1,30 @@
1
+ from __future__ import annotations
2
+ from typing import Union
3
+
4
+ from ..expressions import BooleanExpression, NumberExpression, StringExpression
5
+
6
+ Ostr = Union[str, None]
7
+ Obool = Union[bool, None]
8
+ Oint = Union[int, None]
9
+ StringLike = Union[str, StringExpression]
10
+ BoolLike = Union[bool, BooleanExpression]
11
+ IntLike = Union[int, NumberExpression]
12
+ Ostrlike = Union[StringLike, None]
13
+ Oboolstr = Union[BooleanExpression, str, None]
14
+ Oboollike = Union[BoolLike, None]
15
+ Ointlike = Union[IntLike, None]
16
+ StringOrBoolLike = Union[StringLike, BoolLike]
17
+
18
+ __all__ = [
19
+ 'Ostr',
20
+ 'Obool',
21
+ 'Oint',
22
+ 'StringLike',
23
+ 'BoolLike',
24
+ 'IntLike',
25
+ 'Ostrlike',
26
+ 'Oboolstr',
27
+ 'Oboollike',
28
+ 'Ointlike',
29
+ 'StringOrBoolLike',
30
+ ]
@@ -0,0 +1,32 @@
1
+ from yamloom.actions.types import Ostrlike
2
+ from collections.abc import Sequence
3
+
4
+
5
+ def validate_choice(
6
+ option_name: str, option_value: Ostrlike, choices: Sequence[str]
7
+ ) -> Ostrlike:
8
+ if option_value is not None:
9
+ if isinstance(option_value, str):
10
+ lowered = option_value.lower()
11
+ if option_value not in choices:
12
+ quoted_choices = [f"'{c}'" for c in choices]
13
+ if len(choices) > 2:
14
+ choices_str = (
15
+ f'{", ".join(quoted_choices[:-1])}, or {quoted_choices[-1]}'
16
+ )
17
+ else:
18
+ choices_str = ' or '.join(quoted_choices)
19
+ msg = f"'{option_name}' must be {choices_str}"
20
+ raise ValueError(msg)
21
+ return lowered
22
+ else:
23
+ return option_value
24
+ else:
25
+ return None
26
+
27
+
28
+ def check_string(s: object | None) -> str | None:
29
+ if isinstance(s, str):
30
+ if '${{' not in s:
31
+ return s
32
+ return None
yamloom/expressions.py ADDED
@@ -0,0 +1,5 @@
1
+ from ._yamloom import expressions as _expressions
2
+
3
+ globals().update(_expressions.__dict__)
4
+
5
+ __all__ = _expressions.__all__