Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support Python 3.12 #149

Merged
merged 2 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
Expand Down
5 changes: 1 addition & 4 deletions copier_template/{{library_name}}/extension.py.jinja
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
"""Meltano {{ extension_name }} extension."""
from __future__ import annotations

import os
import pkgutil
import subprocess
import sys
from pathlib import Path
from typing import Any

import structlog
Expand Down Expand Up @@ -54,5 +51,5 @@ class {{ extension_name }}(ExtensionBase):
models.InvokerCommand(
name="{{ cli_prefix }}_invoker", description="pass through invoker"
),
]
],
)
31 changes: 21 additions & 10 deletions copier_template/{{library_name}}/main.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def initialize(
ext.initialize(force)
except Exception:
log.exception(
"initialize failed with uncaught exception, please report to maintainer"
"initialize failed with uncaught exception, please report to maintainer",
)
sys.exit(1)

Expand All @@ -50,23 +50,28 @@ def invoke(ctx: typer.Context, command_args: List[str]) -> None:
"""
command_name, command_args = command_args[0], command_args[1:]
log.debug(
"called", command_name=command_name, command_args=command_args, env=os.environ
"called",
command_name=command_name,
command_args=command_args,
env=os.environ,
)
ext.pass_through_invoker(log, command_name, *command_args)


@app.command()
def describe(
output_format: DescribeFormat = typer.Option(
DescribeFormat.text, "--format", help="Output format"
)
DescribeFormat.text,
"--format",
help="Output format",
),
) -> None:
"""Describe the available commands of this extension."""
try:
typer.echo(ext.describe_formatted(output_format))
except Exception:
log.exception(
"describe failed with uncaught exception, please report to maintainer"
"describe failed with uncaught exception, please report to maintainer",
)
sys.exit(1)

Expand All @@ -76,21 +81,27 @@ def main(
ctx: typer.Context,
log_level: str = typer.Option("INFO", envvar="LOG_LEVEL"),
log_timestamps: bool = typer.Option(
False, envvar="LOG_TIMESTAMPS", help="Show timestamp in logs"
False,
envvar="LOG_TIMESTAMPS",
help="Show timestamp in logs",
),
log_levels: bool = typer.Option(
False, "--log-levels", envvar="LOG_LEVELS", help="Show log levels"
False,
"--log-levels",
envvar="LOG_LEVELS",
help="Show log levels",
),
meltano_log_json: bool = typer.Option(
False, "--meltano-log-json",
False,
"--meltano-log-json",
envvar="MELTANO_LOG_JSON",
help="Log in the meltano JSON log format"
help="Log in the meltano JSON log format",
),
) -> None:
"""Simple Meltano extension that wraps the {{ wrapper_target_name }} CLI."""
default_logging_config(
level=parse_log_level(log_level),
timestamps=log_timestamps,
levels=log_levels,
json_format=meltano_log_json
json_format=meltano_log_json,
)
2 changes: 1 addition & 1 deletion copier_template/{{library_name}}/pass_through.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ def pass_through_cli() -> None:
ext = {{extension_name}}()
ext.pass_through_invoker(
structlog.getLogger("{{ cli_prefix }}_invoker"),
*sys.argv[1:] if len(sys.argv) > 1 else []
*sys.argv[1:] if len(sys.argv) > 1 else [],
)
Loading