-
Notifications
You must be signed in to change notification settings - Fork 5
🧱 static integration testing #35
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
base: main
Are you sure you want to change the base?
Conversation
So numpy isn't compatible with our |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks great. Couple Q's.
|
||
- name: Run lefthook hooks | ||
run: uv run --frozen lefthook run pre-commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we want to add other hooks like a toml linter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, I had dprint in mind for that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lefthook fixes/reformats the files, but i couldn't find a flag to run it so that it'll error if it needs fixing/reformatting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we detect a git diff?
lefthook run --no-tty pre-commit
git diff --exit-code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds doable. But the advantage of using "bare" ruff here, is that it plays well with github, and annotates lines with errors and stuff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The GH compat is nice, but running the full lefthook in CI is also important. As we add more hooks this will become necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea good point. But it should then either fail if there's a diff, or commit the changes if there are any. Both options aren't trivial, and I can't immediately picture the best approach for it. If you have a proposal I'd be happy to put it in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commiting it here is also fine by me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should then either fail if there's a diff
Yes, I want to figure out how to make this happen
What string literals does it expect? Limited to the list of compatible versions? |
In numpy 2.3.1 it [looks like this]:(https://github.com/numpy/numpy/blob/4d833e5df760c382f24ee3eb643dc20c3da4a5a1/numpy/__init__.pyi#L1684) _ArrayAPIVersion: TypeAlias = L["2021.12", "2022.12", "2023.12", "2024.12"]
# --snip--
def __array_namespace__(self, /, *, api_version: _ArrayAPIVersion | None = None) -> ModuleType: ... in 2.0.2 it looks like this: def __array_namespace__(self, *, api_version: str | None = ...) -> Any: ... and |
Huh, why is mypy using the stubs from numpy 2.3.1 when numpy 1.25.0 is installed? |
So mypy apparently completely ignores build isolation... The workaround is to use |
Ok, now the question remains: What to do with |
My feeling is that we are going to end up using array-api-compat anyway, no? I guess not for older versions of the standard, but as the standard is developed. |
for the purposes of integration testing it might be a good idea to rely on it as little as we can |
Testing both is also an option 🤔 |
may as well ignore it for now if we can pass without it, and see what happens down the line |
This comment was marked as outdated.
This comment was marked as outdated.
Nevermind, I managed to get this working on numpy<2 by using |
Currently limited and numpy and only uses mypy. I plan to add (based)pyright in a follow-up.
Closes ##25 I guess