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

refactor(no-release): make mypy standalone #608

Closed
wants to merge 10 commits into from

Conversation

huxuan
Copy link
Member

@huxuan huxuan commented Jun 23, 2024

This is a first step for #465, mypy is the most special case and fortunately we make it work.

Any comments are welcome.


📚 Documentation preview 📚: https://ss-python--608.org.readthedocs.build/en/608/

@huxuan huxuan force-pushed the xuan.hu/mypy-standalone branch 10 times, most recently from f7568a9 to 718d68c Compare June 23, 2024 04:30
@huxuan huxuan marked this pull request as ready for review June 23, 2024 04:49
@huxuan huxuan requested a review from msclock June 23, 2024 04:49
@huxuan huxuan marked this pull request as draft June 23, 2024 07:55
@huxuan huxuan marked this pull request as ready for review June 23, 2024 07:56
.pre-commit-config.yaml Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
@huxuan huxuan marked this pull request as draft June 26, 2024 11:28
@huxuan huxuan force-pushed the xuan.hu/mypy-standalone branch from fdb618d to 960927e Compare June 26, 2024 11:46
@huxuan huxuan marked this pull request as ready for review June 26, 2024 11:52
@huxuan
Copy link
Member Author

huxuan commented Jun 28, 2024

@msclock do you have any comments on this pr then? I do not think we need to wait #617 since I will keep using refactor as commit type.

@msclock
Copy link
Contributor

msclock commented Jun 29, 2024

@msclock do you have any comments on this pr then? I do not think we need to wait #617 since I will keep using refactor as commit type.

@huxuan It will trigger a patch release, see

"type": "refactor",
"release": "patch"

@huxuan
Copy link
Member Author

huxuan commented Jun 29, 2024

@msclock do you have any comments on this pr then? I do not think we need to wait #617 since I will keep using refactor as commit type.

@huxuan It will trigger a patch release, see

"type": "refactor",
"release": "patch"

Ooops, damn the configuration. Or maybe add a no-release scope?

@msclock
Copy link
Contributor

msclock commented Jun 29, 2024

add a no-release scope

Yep, it needs a no-release scope.

@msclock msclock changed the title refactor: make mypy standalone refactor(no-release): make mypy standalone Jun 29, 2024
msclock
msclock previously approved these changes Jun 29, 2024
@huxuan
Copy link
Member Author

huxuan commented Jun 29, 2024

@msclock f550085 is a fix for mypy in pre-commit. It is quite tricky actually, I will not be able to do it without ChatGPT. :-(

@@ -50,7 +50,7 @@ repos:
pass_filenames: false
- id: mypy
name: mypy
entry: mypy --python-executable $(pdm info --python)
entry: bash -c "mypy --python-executable $(pdm info --python) $@" --
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it work on win? I don't confirm the bash is always available on win.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question, I never tried it - -

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean it seems not to support pre-commit on win. And the pre-commit is absent in the Makefile or in CI. So it can't verify its working.

Copy link
Member Author

@huxuan huxuan Jun 29, 2024

Choose a reason for hiding this comment

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

Yes, I will try it when Win is available. It should fail when I try to push the code, I also feel a little confused why it does not take effect then. Actually, I did not realize the problem until I try to push something else and it failed.

Copy link
Member Author

Choose a reason for hiding this comment

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

After some investigation, there is no easy solution for cross-platform command substitution or environment variable substitution. The maintainer of pre-commit also suggests the bash -c and env approach. :(

@huxuan huxuan marked this pull request as draft June 29, 2024 07:18
@huxuan huxuan force-pushed the xuan.hu/mypy-standalone branch 3 times, most recently from b7eb944 to ec375a8 Compare June 29, 2024 09:56
@huxuan
Copy link
Member Author

huxuan commented Jul 1, 2024

After consideration, I think we should keep mypy managed by pdm, at least for now. Although mypy provides the --python-executable option, it can be tricky to integrate with pre-commit while maintaining cross-platform compatibility.

Thanks for all the challenges and pushing back. I really appreciate the collaboration.

@huxuan huxuan closed this Jul 1, 2024
@huxuan huxuan deleted the xuan.hu/mypy-standalone branch July 4, 2024 02:13
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.

2 participants