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
Making the numpy test suite separately installable #26289
Comments
I agree that having the tests come from a separate package but install in-tree is not great. Maybe it would be better to have a little pain from merge conflict fallout and just bite the bullet and move all the tests into a |
The biggest annoyance about moving the tests is maybe even that it makes backporting hard so yeah, would be nice to avoid. OTOH, it is also a bit odd to have a very different test layout for development and non-dev installs.
Do you want to bother moving these C test files/helpers? I am not going to complain, but it doesn't really seem worth the build-setup hassle (of course I didn't check how big these |
There was a discussion about moving the tests back when we switched to using pytest, as that was the recommended arrangement. If we do decide to do it, let's wait until 2.0.1 is out, I expect we will branch 2.1 soon after |
I think the most important thing is that running tests remains easy. |
This could be done, but I'm inclined to try to avoid it at least for the moment. Because it'd probably quite a bit of pain, and we don't want to do it now because of backports etc.
About 300 kb installed, 100 kb wheel size. When the total wheel size is down to 3.5 MB (on macOS), that's still significant enough. So yes, I'd like to drop them unless it turns out to be too annoying to do so.
Agreed, that is a hard constraint.
This is probably the way to go for now. What it would mean:
It's the second half of (4) that needs investigating. We can discuss in the next community meeting perhaps? |
Just a small 👍 to having the option not to include the tests, but a 👎 on having them install somewhere else than in the numpy directories. Things should just remain in the same place, with the only difference being that one does not have to install the tests; having two possible locations is just going to cause pain further down the line (if one does it, it should be for all of numpy, but this seems a lot of churn for very little benefit). p.s. A possible alternative to a new |
Hi, for some more context, this is how it is being done for |
FWIW, I'm -0.5 on making test sources optionally associated with a project, even isolating to the case of distributed versions. I've never liked the complications that can arise when I've developed on other projects that do it, and prefer the size cost of "always there" to the mental overhead cost of "may not be there," or "may be from a mismatched test package vs. source package situation." That said, sounds like maintainers are actually "ok" with it, so just making that somewhat obvious observation. |
That is my preference as well indeed. I need to test the install/uninstall experience to ensure there's no strange effects from targeting the same
It currently isn't, there are extension modules built that are test-only:
That could be changed perhaps, but I'm really looking for the most minimal change possible here at the moment. Either way, we don't want to change build backends, that'd be very invasive for no real reason. We can do this with a one-line patch I believe.
This belongs more on gh-25737 (this issue assumes we are doing this, unless it turns out to be too disruptive). I added context in #25737 (comment). |
Okay, some testing results for the in-numpy-tree install of a separate
Patch needed for the diff --git a/pyproject.toml b/pyproject.toml
index b4df3c36d7..2d15cfb0de 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -6,7 +6,7 @@ requires = [
]
[project]
-name = "numpy"
+name = "numpy-tests"
version = "2.1.0.dev0"
# TODO: add `license-files` once PEP 639 is accepted (see meson-python#88)
license = {file = "LICENSE.txt"}
@@ -17,6 +17,7 @@ maintainers = [
{name = "NumPy Developers", email="numpy-discussion@python.org"},
]
requires-python = ">=3.10"
+dependencies = ["numpy"]
readme = "README.md"
classifiers = [
'Development Status :: 5 - Production/Stable',
@@ -40,16 +41,6 @@ classifiers = [
'Operating System :: MacOS',
]
-[project.scripts]
-f2py = 'numpy.f2py.f2py2e:main'
-numpy-config = 'numpy._configtool:main'
-
-[project.entry-points.array_api]
-numpy = 'numpy'
-
-[project.entry-points.pyinstaller40]
-hook-dirs = 'numpy:_pyinstaller_hooks_dir'
-
[project.urls]
homepage = "https://numpy.org"
documentation = "https://numpy.org/doc/" Testing:
So far so good. Now the uninstall behavior:
That's not ideal, something gets left behind, turning the expected
Conclusion: what gets left behind is That is really weird behavior from
So splitting off the tests doesn't change this. Given that this behavior is broken and I don't think we knew about this problem, that suggests that all this proves is that very few users ever run the tests. tl;dr I think this approach works. |
Discussed in the community meeting just now. In general people were 👍🏼 on moving ahead with this. Requests:
|
No longer shipping the tests with the numpy wheels uploaded to PyPI was discussed in gh-25737. This is now possible after gh-26274. Here are some questions about how we want to go about this. My assumption is that we want to do this in a fairly non-disruptive way, meaning no moving of all tests files (that would yield a ton of merge conflicts on all open PRs).
I think these will be the next steps in a follow-up PR to gh-26274:
tests
label from the default set of install tags inpyproject.toml
or modify our cibuildwheel config to do that (this needs deciding)numpy-tests
wheels).numpy
install, or out-of-tree (e.g. in a separatenumpy-tests
directory)? The latter seems cleaner, but may require some more tweaks to test structure (e.g.,import numpy._core._multiarray_tests
needs modifying).python -c "import numpy; numpy.test()"
gives a clear error message when the tests are not installedThoughts?
The text was updated successfully, but these errors were encountered: