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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃敤 Maintenance/pyupgrade code base targeting py3.9 #3122

Merged

Conversation

pcrespov
Copy link
Member

@pcrespov pcrespov commented Jun 20, 2022

What do these changes do?

The entire repo (*) use python 3.9.
Upgrading to the new syntax (e.g. List -> list-like ) is very time consuming, noisy and error-prone.

This PR uses pyupgrade to automatically upgrade targeted code syntax to py3.9

  • 馃敟 we start (this PR) with some non-critical code base in the repo (namely tests, api and packages/settings-library). Subsequent PRs will address packages and then one service at a time.
  • 馃敤 Adds pre-commit hook that applies pyupgrade to modified code
  • 馃敤Adds scripts/pyupgrade.bash
  • 馃摑 adds some doc on python versioning (draft) since this tool can also assist in future python's upgrades

(*) Except for services/director and some files in packages/pytest-simcore used as well there

How to test

  • 100% test coverage should ideally cover this

TODO

  • pre-commit hook
  • shell script in scripts/ with containarized tool
  • make recipe
  • document py ugrade

@pcrespov pcrespov changed the title Maintenance/py upgrade code py3.9 WIP: Maintenance/py upgrade code py3.9 Jun 20, 2022
@pcrespov pcrespov self-assigned this Jun 20, 2022
@pcrespov pcrespov added python t:maintenance Some planned maintenance work labels Jun 20, 2022
@codecov
Copy link

codecov bot commented Jun 20, 2022

Codecov Report

Merging #3122 (3c75fe5) into master (1ef2b40) will decrease coverage by 0.0%.
The diff coverage is 100.0%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #3122     +/-   ##
========================================
- Coverage    81.0%   80.9%   -0.1%     
========================================
  Files         706     706             
  Lines       30458   30457      -1     
  Branches     3945    3945             
========================================
- Hits        24673   24657     -16     
- Misses       4938    4951     +13     
- Partials      847     849      +2     
Flag Coverage 螖
integrationtests 65.8% <酶> (-0.1%) 猬囷笍
unittests 77.2% <100.0%> (-0.1%) 猬囷笍

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

Impacted Files Coverage 螖
...settings-library/src/settings_library/utils_cli.py 78.1% <100.0%> (酶)
...ings-library/src/settings_library/utils_r_clone.py 100.0% <100.0%> (酶)
...rvice_datcore_adapter/utils/requests_decorators.py 68.4% <0.0%> (-10.6%) 猬囷笍
...imcore_service_webserver/garbage_collector_task.py 94.8% <0.0%> (-5.2%) 猬囷笍
...imcore_service_webserver/garbage_collector_core.py 65.2% <0.0%> (-3.7%) 猬囷笍
...ore_service_director_v2/utils/client_decorators.py 73.3% <0.0%> (-3.4%) 猬囷笍
...e_service_director_v2/modules/dask_clients_pool.py 92.7% <0.0%> (-1.5%) 猬囷笍
...tor_v2/modules/dynamic_sidecar/scheduler/events.py 91.3% <0.0%> (-1.1%) 猬囷笍
...simcore_service_director_v2/modules/dask_client.py 91.9% <0.0%> (-0.7%) 猬囷笍
...ector_v2/modules/dynamic_sidecar/scheduler/task.py 82.1% <0.0%> (-0.5%) 猬囷笍
... and 4 more

@pcrespov pcrespov changed the title WIP: Maintenance/py upgrade code py3.9 WIP: 馃敤 Maintenance/py upgrade code py3.9 Jun 20, 2022
@pcrespov pcrespov added this to the Diolkos milestone Jun 21, 2022
@pcrespov pcrespov changed the title WIP: 馃敤 Maintenance/py upgrade code py3.9 馃敤 Maintenance/py upgrade code py3.9 Jun 21, 2022
@pcrespov pcrespov marked this pull request as ready for review June 21, 2022 08:59
@pcrespov pcrespov changed the title 馃敤 Maintenance/py upgrade code py3.9 馃敤 Maintenance/pyupgrade code base targeting py3.9 Jun 21, 2022
Copy link
Contributor

@GitHK GitHK left a comment

Choose a reason for hiding this comment

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

Nice! Glad this will go out of the way.
Please see below some minor stuff and questions.

Copy link
Member

@sanderegg sanderegg left a comment

Choose a reason for hiding this comment

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

pretty nice tool!
so the idea is to use it later on right? cause I can imagine some PR will be not so nice to merge afterwards...

@pcrespov
Copy link
Member Author

Yes. Easy. That is why this PR only upgrades non-critical packages
In addition, there is now the pre-commit hook. So from now on, whatever gets changed it is also upgraded on the fly

@sonarcloud
Copy link

sonarcloud bot commented Jun 21, 2022

Kudos, SonarCloud Quality Gate passed!聽 聽 Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.5% 0.5% Duplication

@pcrespov pcrespov merged commit cf422bb into ITISFoundation:master Jun 21, 2022
@pcrespov pcrespov deleted the maintenance/py-upgrade-webserver branch June 21, 2022 15:22
@dyollb
Copy link
Member

dyollb commented Jun 21, 2022

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t:maintenance Some planned maintenance work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants