Copier
copier
Copier adapter for template-based scaffolding.
CopierAdapter
Adapter for Copier template operations.
Wraps Copier's run_copy function with a Pydantic-based interface and returns structured ScaffoldResult.
Source code in packages/axm-init/src/axm_init/adapters/copier.py
| Python | |
|---|---|
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
apply_chain(layers, destination, data, *, record_answers=True)
Apply ordered template layers to one destination.
Each layer receives caller data overlaid with its own data and keeps a dedicated answers file so Copier can reapply its ownership rules independently from the other layers.
With record_answers=False, exclude the engine's answer destinations
before rendering and omit fallback answer creation. Existing answers
stay untouched, including answers belonging to the same layer.
Source code in packages/axm-init/src/axm_init/adapters/copier.py
copy(config)
Execute Copier copy operation.
Suppresses stdout/stderr via the scoped :func:_suppress_output
context manager so that post-copy tasks (git init, uv sync,
pre-commit install) don't pollute the parent process stdio —
critical when running inside an MCP server. Suppression is scoped
to the interpreter-level streams and never mutates the process-global
file descriptors 1/2, so concurrent writers on those fds are
unaffected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
CopierConfig
|
Copier configuration with template path, destination, and data. |
required |
Returns:
| Type | Description |
|---|---|
ScaffoldResult
|
ScaffoldResult with success status and path. |
Source code in packages/axm-init/src/axm_init/adapters/copier.py
CopierConfig
Bases: BaseModel
Configuration for Copier execution.
Note: type: ignore[explicit-any] flags pydantic BaseModel
internals (third-party).
Source code in packages/axm-init/src/axm_init/adapters/copier.py
answers_file = None
class-attribute
instance-attribute
Render the template without running its _tasks.
The bundled templates declare post-copy tasks that shell out to git init
and two uv add invocations, so a single render resolves 72 packages and
installs 72 of them — measured at 2.23s and 239 MB against 0.60s and 0.1 MB
with tasks skipped. The rendered tree is identical either way: only the
tasks' side-effects are absent, and the deterministic ones (LICENSE,
.python-version, uv.lock, the pre-commit hook) are cheap to
synthesize. Production scaffolding leaves this False; a caller that only
needs the rendered tree — a test asserting template structure, say — sets it
to True rather than paying for a package installation it never inspects.
exclude = ()
class-attribute
instance-attribute
Destination-relative patterns omitted by Copier during rendering.