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

Fix invalid escape sequence in EKS Hook module #39252

Open
1 task done
Taragolis opened this issue Apr 25, 2024 · 2 comments · May be fixed by #39428
Open
1 task done

Fix invalid escape sequence in EKS Hook module #39252

Taragolis opened this issue Apr 25, 2024 · 2 comments · May be fixed by #39428
Labels
area:providers good first issue kind:meta High-level information important to the community provider:amazon-aws AWS/Amazon - related issues

Comments

@Taragolis
Copy link
Contributor

Taragolis commented Apr 25, 2024

Body

Right now import airflow/providers/amazon/aws/hooks/eks.py raise DeprecationWarning / SyntaxWarning (depends on python version)

{
  "category":"DeprecationWarning",
  "message":"invalid escape sequence \\s",
  "filename":"airflow/providers/amazon/aws/hooks/eks.py",
  "lineno":79,
  "when":"collect",
  "node_id":null
}

We should avoid to use something that deprecated in Python itself years ago in Python 3.6.

output=$({python_executable} -m airflow.providers.amazon.aws.utils.eks_get_token \
--cluster-name {eks_cluster_name} {args} 2>&1)

json_string=$(printf '{{"kind": "ExecCredential","apiVersion": \
"client.authentication.k8s.io/v1alpha1","spec": {{}},"status": \
{{"expirationTimestamp": "%s","token": "%s"}}}}' "$expiration_timestamp" "$token")

\ in the end of the line make sense only in regular strings, not in triple quoted, however right now it work as intended - remove new line in the end of the line

Note

This rule right now ignored in statical code checks (provided by ruff rule W605) on module level

airflow/pyproject.toml

Lines 392 to 393 in 79b5443

# https://github.com/apache/airflow/issues/39252
"airflow/providers/amazon/aws/hooks/eks.py" = ["W605"]

So it also required to remove this lines from pyproject.toml,

Warning

Ruff Autofix suggest use raw string here, however it is not a case here and better rewrite built this command.
Previous attempt #38734 is reverted #38864

Committer

  • I acknowledge that I am a maintainer/committer of the Apache Airflow project.
@Taragolis Taragolis added provider:amazon-aws AWS/Amazon - related issues area:providers good first issue kind:meta High-level information important to the community labels Apr 25, 2024
@Taragolis Taragolis changed the title Fix iInvalid escape sequence in EKS Hook module Fix invalid escape sequence in EKS Hook module Apr 25, 2024
@SoulPancake
Copy link

Is there more work left in this that I can help with? @Taragolis

@Taragolis
Copy link
Contributor Author

Taragolis commented Apr 30, 2024

There is only one things remaining, that it exact the thing which describe into the issue

This warning which might annoying end users because since Python 3.12+ such warnings become SyntaxWarning, see: python/cpython#98401, which are not ignored by default as DeprecatedWarnings

So if you would like to fix, feel free to make a PR

@romsharon98 romsharon98 linked a pull request May 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers good first issue kind:meta High-level information important to the community provider:amazon-aws AWS/Amazon - related issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants