-
Notifications
You must be signed in to change notification settings - Fork 1
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
ci: refactor cibuldwheel code #2
base: master
Are you sure you want to change the base?
Conversation
There is only `setup.py.in` template pypa/cibuildwheel#1139
Replacing `apt` with `dnf` and use latest `cibuildwheel`
Because custom Python can not see system installed modules
This reverts commit 8011ddf.
by pointing to the "libopendht.so.2" library location
Signed-off-by: Henry Schreiner <[email protected]>
@@ -61,11 +33,11 @@ jobs: | |||
steps: | |||
- uses: actions/download-artifact@v3 | |||
with: | |||
name: opendht-wheels-linux | |||
name: opendht-wheels | |||
path: dist |
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.
Pretty sure missing this was a bug
I see what you've meant that Looks like I need to setup https://test.pypi.org/ to test uploads for real. |
Cython development is not fast, and its docs are even slower. It still recommends |
'./configure', | ||
'make', | ||
'make install', | ||
] |
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.
There are many things I find unsettling here.
-
Python level file, which is supposed to be built in user space, contains system commands that alter my OS.
-
Encoding bash scripts in TOML like that. The thought that I may need to copy/paste these commands for debugging. TOML supports multiline strings, so why not to use it here to be on par with
CIBW_BEFORE_ALL
? -
dependencies.txt
is in parent dir, sodnf install
won't install anything and should fail. It if doesn't then that's a problem. -
After
cd asio-1.21.0
there is nocd
back, so it is not clear in which dircibuidwheel
should start the process. -
The
asio
build process is only valid for before all onmanylinux_2_28
, because AlmaLinux 8 ships with outdated dependency.
So in the context of CI job having such hack is fine, but embedding it in Python project doesn't look good to me. So I think about moving shell parts into standalone build scripts, but then there is already CMake that is for doing builds. Oh my.. :D
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.
1: No it does not. This only runs inside the docker container, even locally. But you your point, it should be prefixed by linux just in case. macOS and Windows would run on your OS. And these lines wouldn't be valid anyway. Though there are no selected builds for those OSs, so it currently would do nothing if you target them.
2: Multiline strings would require the &&'ing together. But you could use that if you prefer. If you are debugging, you are probably running line by line anyway, or you are running cibuldwheel locally, in which there's no copy/paste. Select one based on personal taste. This is harder to make a mistake and forget the &&
.
3: This is run from the parent dir. It's being run by cibuildwheel.
4: before-build is not tied to the per-build runs. It can't be, it runs once while the per-build runs run on each time. They are separate processes (with seperate Pythons, etc). So no need to clean up cd's.
5: You only support manylinux_2_28 right?
This is cibulidwheel config. Just like you had before. Only now it's shorter and can be run locally.
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 built the wheels locally to make sure this worked. That's how I was able to do it in a few minutes instead of 7 days of back & forth with the CI, and why it worked first time here as a PR. There were a few oddities I didn't expect (like Cython being required twice).
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.
Multi-line strings should obviously contain newline characters, which, when copy-pasted into a shell, are equivalent to ;
, which is likewise equivalent to &&
except that one failing command will not prevent newline / ;
from running the follow-up commands.
But I see that from a beginners standpoint, Cython documentation approach is more simple. graph LR
ic[install Cython yourself] --> is[import in setup.py] --> sp[set paths in setup.py]
It just becomes more complicated with graph LR
cp[set Cython as build dependency] --> sbb[set build backend] --> ica[still install Cython manually for CMake] --> sps[set paths in setup.py]
So in the end it is just more moving parts. |
The "still install Cython manually for CMake" is due to the buggy build system manually trying to access cython locally. That or Cython literally is running twice on the same input. I'd work on on fixing that rather than not putting a real build dependency in the place for build dependencies - pyproject.toml. You really should flip the build system and run CMake from setup.py. The current system won't ever work locally without hacks like manually running. You always have a build backend. You just are implicitly getting the terrible |
[tool.cibuildwheel] | ||
build = 'cp3{9,10}-manylinux_x86_64' | ||
manylinux-x86_64-image = 'manylinux_2_28' | ||
before-all = [ |
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.
before-all = [ | |
linux.before-all = [ |
(You can also put these in [tool.cibuildwheel.linux]
if you like that better, vs. adding linux.
to the front)
I would absolutely not show this to a beginner. Beginners should learn to do things properly with setup.py calling CMake (pybind/scikit_build_example or pybind/cmake_example), and not see raw Also, this is not a "python level file". It's a config file. You can stick the config in cibuildwheel.toml, run with Anyway, thought I'd try to help. Close if you don't care about local builds, simpler configs, fewer hacks, only supporting Microsoft's CI system, etc. |
I had a long running belief that Is there a good reason why
|
If you are building code, I think you have a lot more security problems than a bit of Python configuration. ;) (And if the code is already built, say in a wheel, the pyproject.toml is not even present any more - that's the security solution). To the best of my knowledge, building extensions has always been something that has to sit in Now I very much believe there is a path forward, it's just not setuptools. I'll be working on scikit-build-core, and extensionlib (possibly a matching PEP), and there's also meson-py. We need a real build system for compiled code (CMake or Meson) with a pyproject.toml configuration. And it's coming. ;) |
For me the solution is to reduce the clutter, not to throw more tools into it. If people know how the process should look like, they could do all the magic We need to get
What kind of info is needed to get all the |
Most projects care about making a working SDist. Not every user will be able to access a wheel, like users with anything older than CentOS 8, Alpine Linux, Clear Linux, repackagers like conda-forge and linux distributions need the SDist, etc. If you make an SDist, you need a working Python build system. In your case, since the package must be created from CMake, due to the way it's designed with a generated setup.py, then you could probably generate the dist-info (it has things like a hash of the other wheel contents, but it can be done, see the spec. You could make the Without a working Python build system you'll also have to give up cibuildwheel, as it requires either
No, please not more custom code that breaks every time anything changes! I maintain both Once I can get scikit-build to avoid the setuptools legacy code (that can often break it), then there should be no reason not to use it to build CMake code. |
The I'm open to merging a modernization of the python build for OpenDHT, or implementing any reasonable change in the build system if that makes people's life easier. |
This reworks the cibuildwheel code to use pyproject.toml and support local runs with:
And gets rid of some hacks (like touching
setup.py
).