-
Notifications
You must be signed in to change notification settings - Fork 68
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
ENH: use system ninja if adequate #175
Conversation
44ee2b4
to
9eb127d
Compare
Thanks @henryiii! I agree that checking if The tests seem to be unhappy still:
|
Ahh, I should uninstall Ninja before running the tests locally. I also might’ve forgotten to run the test after my last change. I’m hoping it’s just that some unit tests are not activating the isolated environment. but I’ll check. I’ll be traveling for the next couple of days so I might not be able to finish this until Monday. |
It looks like it hits the non-PEP 621 standard metadata generation:
Then it breaks because it's trying to run Meson outside building sdists/wheels. Is it possible to generate the metadata without ninja being present? Or could this step be delayed until inside the isolated environment via the hooks (even |
This is working for SDists:
But it's not working for Wheels, it's triggering meson too soon:
|
Ahh, this is "it's running a context manager that sets up a build directory". Okay, so it's running Meson to see if it it is pure or not. Is there a reason to use python-meson if it's pure? I think it probably should add patchelf regardless - it won't use it in the pure case, and it's would only be a downside if not present on the system on a linux system without patchelf binaries and for a pure Python build. This is faster too. |
This works now for me locally after uninstalling ninja:
Changes: diff --git a/pyproject.toml b/pyproject.toml
index 8d3e71d..153a282 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -28,7 +28,7 @@ test = ["pytest", "pytest-xdist"]
[build-system]
build-backend = 'mesonpy'
-requires = ["meson-python>=0.8.1", "wheel", "oldest-supported-numpy", "setuptools_scm"]
+requires = ["meson-python @ git+https://github.com/henryiii/meson-python@henryiii/fix/ninja", "oldest-supported-numpy", "setuptools_scm"]
[tool.setuptools_scm]
write_to = "src/fsps/fsps_version.py" |
I think I fixed the Windows and Linux tests, macOS was passing - you can tell what I'm developing on. :) |
This is working except on pypy & Windows, and those are failing due to the |
Could you try triggering the CI again? I think I fixed the platform incompatibilities by changing virtualenv implementations. |
What a fascinating error. Why is this even able to happen? |
10b8a78
to
2bc8635
Compare
Looks like Win Python 3.7 might be broken by this, though I'm not sure how. Will try to look into it in the next day or two. Something is going really wrong with the ABI tags, seems to be related to the stable ABI. Seems mesonpy is reporting itself as the Python implementation on Windows 3.7 only. 🙄 |
Looks like some of the tag parsing code is broken for windows tags. Windows does not have standardized tags so this all is just looking at what happens in practice and writing code around it 😑. Interesting how this only triggers on Python 3.7. |
It parsing code for a non-standardized format, so it's a bit fragile. |
The parsing code that generates the funny error is removed in #191. I'll be happy to provide another review for this PR. Can you please squash the commits into meaningful patches? |
Should I wait till after #191? |
Ahh, so this can happen without my changes: #189 - okay, can clean up. |
924d689
to
2f3dce2
Compare
Everything that was not related was PR'd separately already, so it's just one commit, the ninja change + related tests. |
081396b
to
57a0579
Compare
I'm getting |
I see |
Hmm, interesting! Any idea what that means, though? This is triggering build isolation, so it should be in a virtual environment, but it should still be pointing at the original source. Unless it's in the sdist -> wheel step. Then it's getting and SDist and making a wheel. Here's the relevant bit of the logs (stderr only has the traceback):
|
All tests in the Sage CI operate from an sdist, not from the meson-python clone. |
It seems that Meson isn't being able to produce a dist when it doesn't have VCS, which is reasonable, but we'll need to deal with that. |
Erroring out seems like the right default at least. If we do need a way to create an sdist outside of a VCS, can that be a new issue with its own rationale? Seems low-prio to me, and should not be blocking for dealing with system |
57a0579
to
21a5afb
Compare
Passing. :) |
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.
Nice. Maybe a couple of wrong merge resolutions during the rebase?
pyproject.toml
Outdated
'auditwheel', | ||
'Cython', | ||
'pyproject-metadata>=0.6.1', | ||
'wheel', | ||
'importlib_metadata; python_version<"3.8"', |
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.
Same for this one?
tests/test_pep518.py
Outdated
@@ -15,7 +15,6 @@ | |||
@pytest.mark.parametrize( | |||
'build_arg', ['', '--wheel'], ids=['sdist_to_wheel', 'wheel_directly'] | |||
) | |||
@pytest.mark.xfail(sys.platform.startswith('cygwin'), reason='ninja pip package not available on cygwin', strict=True) | |||
def test_pep518(pep518, package, build_arg, tmp_path): |
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 would be cool to extend this test to be an integration test for the two cases: ninja from a package and ninja from the system. However I'm not so sure about what strategy we could use to realize that. If we want to keep the test not dependent on a specific test environment setup, the only thing I can think about is to provide a wheelhouse that does not have ninja, mask a possibly existing ninja by adding a script that returns an error or a wrong version number to a directory we prepend to $PATH
, and verify that the build fails. Add ninja to the wheelhouse and verify that the build succeeds.
I just merged #212 Can you please rebase again? We should see the pep518 test fail on platforms that do not have a system ninja. |
If you rebase and add |
a20c78c
to
fbbfbf9
Compare
Seems that all the GitHub Actions runners have ninja installed... |
Never mind, |
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.
I just have one thing that needs to be fixed before merging. Otherwise, it looks good to me! Thank you @henryiii 😊
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
fbbfbf9
to
47f3ba6
Compare
Maybe a better way to describe this would be "if we do need a way to create an sdist from an sdist"? I'm not sure I understand the general desirability of this, although apparently some people do want for academic reasons. For test mocking specifically, there should probably be a setup fixture that runs |
There is a context manager that does that and I found it and now use it (which is why the tests are passing now) when I realized the other tests had to be doing this too. It can't be a fixture since it needs the package directory as input or it needs to have the working directory already changed to the package directory. (It could be a fixture that takes arguments via a mark, actually, but probably not worth it?) |
Ah okay, never mind then. :D |
Signed-off-by: Filipe Laíns <lains@riseup.net>
3f17afe
to
9d47743
Compare
This uses the same solution as patchelf - if the system has it (and it's a new enough version,
1.7+ according to the release notes, 1.8.2 according to the meson error if missing), then use that. This fixes the build on systems that have a new enough ninja present but are not supportable by binary wheels.See scikit-build/ninja-python-distributions#127 for discussion.