Skip to content

Commit 278a5bc

Browse files
feat: Support Python 3.12 (#149)
1 parent ed2e724 commit 278a5bc

File tree

7 files changed

+131
-280
lines changed

7 files changed

+131
-280
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python-version: ["3.8", "3.9", "3.10", "3.11"]
17+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1818

1919
steps:
2020
- uses: actions/checkout@v4

copier_template/{{library_name}}/extension.py.jinja

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
"""Meltano {{ extension_name }} extension."""
22
from __future__ import annotations
33

4-
import os
5-
import pkgutil
64
import subprocess
75
import sys
8-
from pathlib import Path
96
from typing import Any
107

118
import structlog
@@ -54,5 +51,5 @@ class {{ extension_name }}(ExtensionBase):
5451
models.InvokerCommand(
5552
name="{{ cli_prefix }}_invoker", description="pass through invoker"
5653
),
57-
]
54+
],
5855
)

copier_template/{{library_name}}/main.py.jinja

+21-10
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def initialize(
3333
ext.initialize(force)
3434
except Exception:
3535
log.exception(
36-
"initialize failed with uncaught exception, please report to maintainer"
36+
"initialize failed with uncaught exception, please report to maintainer",
3737
)
3838
sys.exit(1)
3939

@@ -50,23 +50,28 @@ def invoke(ctx: typer.Context, command_args: List[str]) -> None:
5050
"""
5151
command_name, command_args = command_args[0], command_args[1:]
5252
log.debug(
53-
"called", command_name=command_name, command_args=command_args, env=os.environ
53+
"called",
54+
command_name=command_name,
55+
command_args=command_args,
56+
env=os.environ,
5457
)
5558
ext.pass_through_invoker(log, command_name, *command_args)
5659

5760

5861
@app.command()
5962
def describe(
6063
output_format: DescribeFormat = typer.Option(
61-
DescribeFormat.text, "--format", help="Output format"
62-
)
64+
DescribeFormat.text,
65+
"--format",
66+
help="Output format",
67+
),
6368
) -> None:
6469
"""Describe the available commands of this extension."""
6570
try:
6671
typer.echo(ext.describe_formatted(output_format))
6772
except Exception:
6873
log.exception(
69-
"describe failed with uncaught exception, please report to maintainer"
74+
"describe failed with uncaught exception, please report to maintainer",
7075
)
7176
sys.exit(1)
7277

@@ -76,21 +81,27 @@ def main(
7681
ctx: typer.Context,
7782
log_level: str = typer.Option("INFO", envvar="LOG_LEVEL"),
7883
log_timestamps: bool = typer.Option(
79-
False, envvar="LOG_TIMESTAMPS", help="Show timestamp in logs"
84+
False,
85+
envvar="LOG_TIMESTAMPS",
86+
help="Show timestamp in logs",
8087
),
8188
log_levels: bool = typer.Option(
82-
False, "--log-levels", envvar="LOG_LEVELS", help="Show log levels"
89+
False,
90+
"--log-levels",
91+
envvar="LOG_LEVELS",
92+
help="Show log levels",
8393
),
8494
meltano_log_json: bool = typer.Option(
85-
False, "--meltano-log-json",
95+
False,
96+
"--meltano-log-json",
8697
envvar="MELTANO_LOG_JSON",
87-
help="Log in the meltano JSON log format"
98+
help="Log in the meltano JSON log format",
8899
),
89100
) -> None:
90101
"""Simple Meltano extension that wraps the {{ wrapper_target_name }} CLI."""
91102
default_logging_config(
92103
level=parse_log_level(log_level),
93104
timestamps=log_timestamps,
94105
levels=log_levels,
95-
json_format=meltano_log_json
106+
json_format=meltano_log_json,
96107
)

copier_template/{{library_name}}/pass_through.py.jinja

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ def pass_through_cli() -> None:
1212
ext = {{extension_name}}()
1313
ext.pass_through_invoker(
1414
structlog.getLogger("{{ cli_prefix }}_invoker"),
15-
*sys.argv[1:] if len(sys.argv) > 1 else []
15+
*sys.argv[1:] if len(sys.argv) > 1 else [],
1616
)

0 commit comments

Comments
 (0)