Copier Configuration Reference
Relevant source files
The following files were used as context for generating this wiki page:
The Meltano Extension Developer Kit (EDK) utilizes Copier to provide a standardized template for creating new Meltano extensions. This system automates the scaffolding process, ensuring that new projects follow the established architecture of the EDK while allowing for customization through user-defined variables.
Sources: README.md:12-14, copier.yml:1-35
Template Initialization Flow
The initialization process involves a user providing configuration values which are then processed by Copier to generate a functional project structure. This workflow ensures that specific metadata, such as the extension name and CLI targets, are correctly propagated throughout the generated codebase.
The diagram shows how initial user input for the extension name triggers a series of transformations to generate consistent IDs and library names.
Sources: copier.yml:1-20, tests/copier_template/test_generated.py:33-51
Configuration Variables
The copier.yml file defines the schema for the data required to initialize an EDK project. It includes both mandatory fields and fields with dynamic defaults based on previous inputs.
Core Variables
| Variable | Type | Description | Default / Logic |
|---|---|---|---|
extension_name | str | The formal name of the extension (e.g., MyExtensionName). | N/A |
admin_name | str | Used for the pyproject.toml author entry. | N/A |
extension_name_lower | str | Lowercase version of the extension name. | {{ extension_name.lower() }} |
extension_id | str | Unique identifier for the wrapper. | {{ extension_name_lower }}-ext |
library_name | str | Python package/library name. | {{ extension_id.replace('-', '_') }} |
cli_prefix | str | Prefix used for CLI commands. | {{ extension_name_lower }} |
wrapper_target_name | str | The actual command being wrapped (e.g., dbt). | N/A |
extension_description | str | Brief summary for README and metadata. | "A meltano utility extension for..." |
Sources: copier.yml:1-35, tests/copier_template/test_generated.py:41-50
Subdirectory and Exclusion Rules
The EDK template restricts the scope of the generation process to a specific subdirectory and excludes internal development files to ensure the resulting project is clean.
- Target Subdirectory: The actual template files are located in the
copier_templatedirectory. - Exclusions: Several file patterns are excluded from the final generated output, including:
- Version control files (
.git,.github) - Python cache and temporary files (
__pycache__,*.py[co]) - Environment and lock files (
.python-version,uv.lock) - Configuration files for the EDK itself (
copier.yml,.pre-commit-config.yaml)
- Version control files (
Sources: copier.yml:37-53
Integration with EDK Architecture
The variables defined in the Copier configuration directly map to the core classes and models within the meltano.edk package. Specifically, the generated code implements the ExtensionBase interface and utilizes the models.Describe structure.
The diagram illustrates the relationship between the base extension class and the models used to describe the capabilities of the generated extension.
Sources: meltano/edk/extension.py:31-75, meltano/edk/models.py:7-47
Configuration Example
The following snippet from the test suite demonstrates a standard data payload used during the template generation process:
run_copy(
src_path=template_path,
dst_path=outdir,
data={
"admin_name": "John Doe",
"cli_prefix": "testflow",
"extension_description": "A meltano utility extension for testflow.",
"extension_id": "testflow-ext",
"extension_name": "Testflow",
"extension_name_lower": "testflow",
"library_name": "testflow_ext",
"wrapper_target_name": "/bin/notreal",
},
quiet=True,
)
Sources: tests/copier_template/test_generated.py:40-51
Validation of Generated Output
The EDK ensures the integrity of the Copier configuration through automated testing. The test_copier_output function validates that the generated files adhere to strict quality standards:
- Mypy Static Analysis: Checks for type consistency in the generated Python code.
- Ruff Linting: Ensures the code meets PEP 8 and project-specific linting rules using the
E,F,W,Qselection. - Formatting Check: Verifies that the code is correctly formatted via
ruff format.
Sources: tests/copier_template/test_generated.py:54-75, pyproject.toml:68-110
The Copier configuration is a vital component of the Meltano EDK, serving as the bridge between the framework's abstract classes and a concrete, deployable extension project. By enforcing consistent naming conventions and validating the output through automated linting, it reduces the friction involved in building wrappers for various CLI tools.