Skip to content

Update CHANGELOG and fix mypy compatibility for curry.partial #2094

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AdrianAcala
Copy link

@AdrianAcala AdrianAcala commented Apr 2, 2025

  • Added a bugfix entry in CHANGELOG for curry.partial compatibility with mypy 1.6.1+.
  • Modified inference.py to use a local variable for argument inference context.
  • Added mypy configuration file and a test for partial functionality in test_partial.py.

I have made things!

Checklist

  • I have double checked that there are no unrelated changes in this pull request (old patches, accidental config files, etc)
  • I have created at least one test case for the changes I have made
  • I have updated the documentation for the changes I have made (since this is just fixing dependency issues, I didn't think a documentation update was necessary)
  • I have added my changes to the CHANGELOG.md

Related issues

🙏 Please, if you or your company finds dry-python valuable, help us sustain the project by sponsoring it transparently on https://github.com/sponsors/dry-python. As a thank you, your profile/company logo will be added to our main README which receives hundreds of unique visitors per day.

@@ -82,13 +82,15 @@ def _infer_constraints(
self._fallback.arg_names,
lambda index: checker.accept(exprs[index]),
)

arg_context = checker.argument_infer_context()
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, how does this change fix the mypy compat? What even is the problem that we are fixing here?

Copy link
Author

Choose a reason for hiding this comment

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

Based off of this commit python/mypy@0291ec9,

the infer_constraints_for_callable function was modified to require an additional arg_names parameter. This change, combined with how mypy processes function calls internally, caused the direct use of checker.argument_infer_context() as a parameter to fail

When the context is saved to a local variable first, mypy correctly recognizes it during parameter binding.

@AdrianAcala AdrianAcala marked this pull request as draft April 3, 2025 07:17
@AdrianAcala AdrianAcala force-pushed the 1711-fix-mypy-1-6-1 branch 2 times, most recently from a06a7e9 to efa6e4e Compare April 3, 2025 15:09
- Introduced a new test suite for the `partial` function in `typesafety/test_curry/test_partial/test_partial.py` to ensure its correct behavior with various argument types and signatures.
- Updated `mypy.ini` to specify Python version and include the necessary plugins for type checking.
- Fixed compatibility issues with `curry.partial` and mypy 1.6.1+.
- Added a new entry in `CHANGELOG.md` for unreleased bugfixes.
@AdrianAcala AdrianAcala force-pushed the 1711-fix-mypy-1-6-1 branch from efa6e4e to 4a40f83 Compare April 19, 2025 06:10
@AdrianAcala AdrianAcala marked this pull request as ready for review April 19, 2025 06:11
@AdrianAcala
Copy link
Author

@sobolevn , ready for your review whenever you have time. Thanks so much for the work you do 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Mypy 1.6.1 fails with returns 0.21.0 on use of curry.partial
2 participants