metaopt / optree

OpTree: Optimized PyTree Utilities
https://optree.readthedocs.io
Apache License 2.0
146 stars 7 forks source link

[Feature Request] Consider scikit-build build system #22

Closed Skylion007 closed 1 year ago

Skylion007 commented 1 year ago

Required prerequisites

Motivation

Solution

Setup.py has a lot of custom logic for handling building the cmake file. While this may make sense in a more complex project, better to farm out the complexity when possible. As such, I'd recommend into seeing if https://github.com/scikit-build/scikit-build would be a better build system bootstrapper: https://pypi.org/project/scikit-build-core/ is also an option and eliminates the setup.py entirely as shown here: https://github.com/pybind/scikit_build_example

See the why scikit-build page here: https://scikit-build.readthedocs.io/en/latest/usage.html

Biggest benefit would be the added support for more esoteric compilers and that it can play really nicely with buildwheel etc.

Alternatives

Keep the current cmake file and setup.py structure.

Additional context

No response

XuehaiPan commented 1 year ago

Hi @Skylion007, thanks for the suggestion. We will investigate this. There are still some concerns before we using the scikit-build/scikit-build-core backend. As listed in the README in the scikit-build/scikit-build-core repo, it's still under heavy development and does not support "editable" mode:

Some known missing features that will be developed soon:

  • No support for caching between builds
  • No editable mode support
  • The docs are not written
  • Dedicated entrypoints are planned for projects wanting to support discovery
  • No support for other targets besides install
  • Wheels are not fully reproducible yet
  • Windows ARM support missing
  • Other backends are also planned:

Setuptools integration highly experimental

  • The extensionlib integration is missing
  • No hatchling plugin yet

Currently, optree's build system supports install/build with pip / wheel / cibuildwheel. It also supports Linux/Windows native build and macOS cross compilation by setting ARCHFLAGS.

Skylion007 commented 1 year ago

@XuehaiPan oh yeah I wasn't referring to use scikit-build-core, but scikit-build https://github.com/scikit-build/scikit-build (which is effectively just a fancy setup.py extension instead of a full independent PEP517 build-system).

XuehaiPan commented 1 year ago

Hi @Skylion007, I tried scikit-build/scikit-build-sample-projects. As listed in scikit-build/scikit-build's README, it does not support "editable" installation yet. I think this is a core feature for in-repo development. We may consider using scikit-build if it fits our needs in the future. Please feel free to ask to reopen this issue.