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

Make all python scripts python3 compatible #4700

Merged
merged 2 commits into from
Aug 26, 2023

Conversation

albertteoh
Copy link
Contributor

@albertteoh albertteoh commented Aug 26, 2023

Which problem is this PR solving?

Description of the changes

  • Adds python 3 shebang to each python script.
  • The same can be done in a follow up PR to jaeger-ui if this PR is accepted.

How was this change tested?

  • Checked all python scripts within the jaeger project begin with a python3 shebang:
$ find . -name "*.py" | grep -v site-packages | grep -v venv | grep -v jaeger-ui | xargs head -1
```
==> ./scripts/utils/ids-to-base64.py <==
#!/usr/bin/env python3

==> ./scripts/draft-release.py <==
#!/usr/bin/env python3

==> ./scripts/release-notes.py <==
#!/usr/bin/env python3

==> ./scripts/import-order-cleanup.py <==
#!/usr/bin/env python3

==> ./scripts/updateLicense.py <==
#!/usr/bin/env python3

==> ./docker-compose/monitor/otlp_exporter_example.py <==
#!/usr/bin/env python3
```
  • Checked all python scripts within the jaeger project are executable:
$  find . -name "*.py" | grep -v site-packages | grep -v venv | grep -v jaeger-ui | xargs ls -al
-rwxr-xr-x  1 albertteoh  staff   949 Apr 24 00:35 ./docker-compose/monitor/otlp_exporter_example.py
-rwxr-xr-x  1 albertteoh  staff  1561 Aug 27 06:41 ./scripts/draft-release.py
-rwxr-xr-x  1 albertteoh  staff  2874 Aug 26 20:44 ./scripts/import-order-cleanup.py
-rwxr-xr-x  1 albertteoh  staff  5095 Aug 27 06:32 ./scripts/release-notes.py
-rwxr-xr-x  1 albertteoh  staff  2787 Aug 26 20:44 ./scripts/updateLicense.py
-rwxr-xr-x  1 albertteoh  staff   848 Aug 27 06:37 ./scripts/utils/ids-to-base64.py
  • Checked make fmt runs successfully.
  • Checked make changelog runs successfully.
  • Checked make draft-release runs successfully.

Checklist

Signed-off-by: albertteoh <[email protected]>
Signed-off-by: albertteoh <[email protected]>
@albertteoh albertteoh requested a review from a team as a code owner August 26, 2023 21:11
@codecov
Copy link

codecov bot commented Aug 26, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.02% ⚠️

Comparison is base (db3d1bb) 97.03% compared to head (699d92a) 97.02%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4700      +/-   ##
==========================================
- Coverage   97.03%   97.02%   -0.02%     
==========================================
  Files         301      301              
  Lines       17880    17880              
==========================================
- Hits        17350    17348       -2     
- Misses        425      426       +1     
- Partials      105      106       +1     
Flag Coverage Δ
unittests 97.02% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -1,6 +1,4 @@
from __future__ import (
absolute_import, print_function, division, unicode_literals
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are implicitly imported in python3.


for file in sys.argv[1:]:
print file
backup = '%s.bak' % file
print(file)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python3 is a bit more strict with print statements.

print file
backup = '%s.bak' % file
print(file)
backup = f'{file}.bak'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel the named formatted strings are a bit more readable, supported in python3.

@yurishkuro yurishkuro merged commit ec5868f into jaegertracing:main Aug 26, 2023
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: update python to python3
2 participants