-
Notifications
You must be signed in to change notification settings - Fork 7
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
Updates for typeguard #87
Conversation
Hi @caneff! Thanks for your contribution, this is very useful! I've enabled you to run the ci/cd now (next time it should also run without me needing to give you permission). There's a type error somewhere. Do you want to have a look at it? Or shall I have a go? |
I can do it. How can I run the pre commit locally before pushing? I am still pretty new to working outside of the Google ecosystem. I know with other packages there was a way to set up pre-commit hooks. What is the steps here? |
Ah, yeah, you're right, I haven't set up a pre-commit hook here yet... Let's see if I can do that real quick (you'll probably have solved the errors before I get that going though :p ). |
Here you go! Lemme know if that works. |
I notice even on main mypy doesn't pass for me:
Can you fix this so I can have a clean starting point? It is looking like if we wanted typeguard 4 it is going to need to be a bigger refactor though (which I have started). |
@nanne-aben OK, so here is more what I think needs to be done with typeguard 4, going off https://typeguard.readthedocs.io/en/stable/extending.html But, for every test I try to run I get Looks like this mechanism for adding checkers was only added with typeguard 3. Not asking to completely debug, just if you had thoughts off the top of your head how to proceed in the debugging. |
Regarding mypy: in the ci/cd, I specifically run Regarding the other error, lemme have a look. |
I'm not sure yet, tbh. Here's what I found.
Btw, I just noticed there's now an error in the notebook stage of the cicd too... I have to check out now though. Will get back to it later! |
The notebook issue appears to be a known bug in typeguard... I'll replace that block of code by a markdown block so it works again. Pity though that they've changed the interface in a way that it breaks usage in notebooks. |
7b9b666
to
7b77cc5
Compare
OK I've added the last failing mypy thing, and fixed the pre-commit hooks too. Note that the error message doesn't have argname any more which is unfortunate, but I think it is the same issue as your typeguard.qualified_name() issue. If you know any way to get the name back in there I'm all ears. Please take another look? |
@nanne-aben I'm inclined to drop this. I've encountered other discussions about typeguard > 2 having gone off the rails, being incompatible with jaxtype because it does some fragile reparsing of source code and it being not really maintained any more. Thoughts? |
To answer to an earlier message
I can confirm that that works.
Hmmm, I agree that this doesn't look great. Some thoughts:
|
Will do
Isn't it already? 2.13.3 is what is in requirements.txt and seems to be the latest 2. |
Oh, I thought you'd said it wasn't the latest yet. I hadn't checked it myself. But if it's the latest already, then we can just leave it as it is! |
If I'm not mistaken, pandera requries typeguard > 4, so it is no longer possible to have both strictly_typed_pandas and pandera in the same project. One option would be to vendor typeguard v2, you aren't using any upstream changes anyway. It would be a quick, safe change that frees projects from the above problem. |
Hmmm, yeah, that's a good idea! I've checked the license and tpeguard 2.13.2 (latest v2) is also under an MIT license, so that's fine. So off the top of my head, we need to:
I'm currently on vacation, so I don't have a lot of time to contribute to this right now. Would you be interested in contributing a PR here? |
I had a look into it and most problems looked to be surmountable, but I think typeguard's "importhook" does something that can only be done by once by one library, so it would get a little messy. I wanted a clean, works-in-every-environment, no-changes-necessary solution, but couldn't find one; I think getting this to work will need some compromises to be made. I'll make a fork and push my branch over there with some comments about the possible choices. |
That's great, thanks! |
For future reference, this is the PR: #142 |
This brings typeguard up to a more current version. Requires accessing protected members but so did the existing code so shrug.