You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "john-bodley (via GitHub)" <gi...@apache.org> on 2023/05/25 18:22:54 UTC
[GitHub] [superset] john-bodley commented on a diff in pull request #24197: chore(pre-commit): Add pyupgrade and pycln hooks
john-bodley commented on code in PR #24197:
URL: https://github.com/apache/superset/pull/24197#discussion_r1204535917
##########
.pre-commit-config.yaml:
##########
@@ -15,14 +15,26 @@
# limitations under the License.
#
repos:
+ - repo: https://github.com/MarcoGorelli/auto-walrus
+ rev: v0.2.2
+ hooks:
+ - id: auto-walrus
+ - repo: https://github.com/asottile/pyupgrade
+ rev: v3.4.0
+ hooks:
+ - id: pyupgrade
+ args:
+ - --keep-runtime-typing
Review Comment:
Though these hooks are great, with a code base as large and complex as ours there are always caveats. We have a minimum requirement of Python 3.9, however given:
1. When I used the `--py39-plus` option it changed the typing from `Type` to `type` which is problematic per https://github.com/python/mypy/issues/15047.
2. Per https://github.com/asottile/pyupgrade/issues/345 there's no way of skipping/ignoring lines.
3. Per https://github.com/asottile/pyupgrade/issues/592 the `--keep-runtime-typing` is ignored for `--py39-plus`
The only viable route seemed to be to take the more conservation option and specify `--py38-plus` which does support `--keep-runtime-typing`. Hopefully once the Mypy etc. issues are resolved we can relax this constraint as there' are some great upgrades to be had, i.e.,
```python
Optional[List[str]]
```
becomes
```python
list[str] | None
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org