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: Python3.11 (str, Enum) issue #24803

Merged
merged 6 commits into from
Jul 31, 2023

Conversation

EugeneTorap
Copy link
Contributor

@EugeneTorap EugeneTorap commented Jul 25, 2023

SUMMARY

Changed Enum.format() (the default for format(), str.format() and f-strings) to always produce the same result as Enum.str(): for enums inheriting from ReprEnum it will be the member's value; for all other enums it will be the enum and member name (e.g. Color.RED).

Fix the next Py3.11 error

sqlalchemy.exc.ProgrammingError: (psycopg2.errors.SyntaxError) syntax error at or near "CtasMethod"
LINE 1: DROP CtasMethod.TABLE IF EXISTS test_sync_table

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented Jul 25, 2023

Codecov Report

Merging #24803 (fa98382) into master (4a81284) will increase coverage by 0.03%.
Report is 22 commits behind head on master.
The diff coverage is 85.45%.

❗ Current head fa98382 differs from pull request most recent head e96b24c. Consider uploading reports for the commit e96b24c to get more accurate results

@@            Coverage Diff             @@
##           master   #24803      +/-   ##
==========================================
+ Coverage   68.95%   68.99%   +0.03%     
==========================================
  Files        1902     1904       +2     
  Lines       73998    74081      +83     
  Branches     8195     8193       -2     
==========================================
+ Hits        51029    51115      +86     
+ Misses      20850    20845       -5     
- Partials     2119     2121       +2     
Flag Coverage Δ
hive 54.14% <68.66%> (+<0.01%) ⬆️
mysql 79.21% <91.33%> (+0.02%) ⬆️
postgres 79.31% <91.33%> (+0.02%) ⬆️
presto 54.04% <68.66%> (+<0.01%) ⬆️
python 83.36% <91.33%> (+0.01%) ⬆️
sqlite 77.88% <91.33%> (+0.02%) ⬆️
unit 55.00% <78.66%> (+0.04%) ⬆️

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

Files Changed Coverage Δ
...et-chart-deckgl/src/layers/Geojson/controlPanel.ts 50.00% <ø> (ø)
...egacy-preset-chart-deckgl/src/layers/Path/Path.jsx 0.00% <ø> (ø)
...reset-chart-deckgl/src/layers/Path/controlPanel.ts 50.00% <ø> (ø)
...preset-chart-deckgl/src/layers/Polygon/Polygon.jsx 0.00% <ø> (ø)
...et-chart-deckgl/src/layers/Polygon/controlPanel.ts 33.33% <ø> (ø)
...reset-chart-deckgl/src/utilities/Shared_DeckGL.jsx 86.48% <ø> (ø)
superset-frontend/src/SqlLab/App.jsx 0.00% <ø> (ø)
...d/src/SqlLab/components/SaveDatasetModal/index.tsx 60.63% <ø> (+10.63%) ⬆️
superset-frontend/src/SqlLab/fixtures.ts 100.00% <ø> (ø)
...tersConfigModal/Footer/CancelConfirmationAlert.tsx 100.00% <ø> (ø)
... and 35 more

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@mdeshmu
Copy link
Contributor

mdeshmu commented Jul 26, 2023

Please look into 3 failing tests.

@pull-request-size pull-request-size bot added size/L and removed size/M labels Jul 26, 2023
@EugeneTorap
Copy link
Contributor Author

EugeneTorap commented Jul 26, 2023

Python-Integration / test-postgres (3.11) CI is passed with my changes

.pylintrc Outdated
@@ -75,6 +75,7 @@ enable=
# --disable=W"
disable=
cyclic-import, # re-enable once this no longer raises false positives
no-member, # re-enable once this no longer raises false positives
Copy link
Member

Choose a reason for hiding this comment

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

I mentioned the my concerns about blanket disabling of messages in the past. Is this a necessary requirement?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's necessary requirement before we update min supported python to 3.11

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we could add a note in the comment that this will become redundant after the min required version is 3.11

Copy link
Contributor

Choose a reason for hiding this comment

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

meanwhile raised the issue on pylint GitHub pylint-dev/pylint#8897

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@villebro Added the note in the comment

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

LGTM, would love @john-bodley 's approval for merging

.pylintrc Outdated
@@ -75,6 +75,7 @@ enable=
# --disable=W"
disable=
cyclic-import, # re-enable once this no longer raises false positives
no-member, # re-enable once this no longer raises false positives
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we could add a note in the comment that this will become redundant after the min required version is 3.11

@mdeshmu
Copy link
Contributor

mdeshmu commented Jul 30, 2023

I think, we also need to update files where str, enum.Enum is used.

@EugeneTorap
Copy link
Contributor Author

Thanks @mdeshmu! Updated it.

@EugeneTorap
Copy link
Contributor Author

Hey @john-bodley @michael-s-molina @rusackas! Can we merge this PR?

@john-bodley john-bodley merged commit 5f10307 into apache:master Jul 31, 2023
29 checks passed
@EugeneTorap EugeneTorap deleted the fix/python3.11-str-enum branch July 31, 2023 16:27
@michael-s-molina michael-s-molina added the v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch label Aug 1, 2023
@mistercrunch mistercrunch added 🍒 3.0.0 🍒 3.0.1 🍒 3.0.2 🍒 3.0.3 🍒 3.0.4 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.1.0 labels Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch 🍒 3.0.0 🍒 3.0.1 🍒 3.0.2 🍒 3.0.3 🍒 3.0.4 🚢 3.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants