Skip to content

MAINT Remove setup.py mentions from documentation and comments #29352

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

Merged
merged 6 commits into from
Jun 28, 2024

Conversation

lesteve
Copy link
Member

@lesteve lesteve commented Jun 26, 2024

Preparing before removing setup.py completely i.e. #29346.

Things I am not so sure about:

Copy link

github-actions bot commented Jun 26, 2024

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: c64f2c3. Link to the linter CI: here

@jeremiedbb
Copy link
Member

build_command in asv.conf.json, I copied what numpy does, not tested

I tested and the new command works. It's actually the new default build command since asv 0.6.2 (latest version is 0.6.3).

@jeremiedbb
Copy link
Member

I'm ok to remove the alternative compilers section since we're remove setuptools support any time soon and this section was mostly about intel compilers support by setuptools. With other build systems one should use the CC, CFLAGS, LDFLAGS, ... env vars as usual.

@@ -97,8 +97,6 @@ Tips for performance

* Inline methods and function when it makes sense

* Make sure your Cython compilation units `use NumPy recent C API <https://github.com/scikit-learn/scikit-learn/blob/62a017efa047e9581ae7df8bbaa62cf4c0544ee4/setup.py#L64-L70>`_.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be interested to have more details about what we need/don't need to do about that before deciding to completely remove it and forget about it. ping @jjerphan, you seem familiar with this stuff :)

Copy link
Member

@jjerphan jjerphan Jun 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now taken care of natively by setup.py (note that this might need to be ported to meson):

scikit-learn/setup.py

Lines 121 to 128 in 87fa654

# Always use NumPy 1.7 C API for all compiled extensions.
# See: https://numpy.org/doc/stable/reference/c-api/deprecations.html
DEFINE_MACRO_NUMPY_C_API = (
"NPY_NO_DEPRECATED_API",
"NPY_1_7_API_VERSION",
)
for ext in self.extensions:
ext.define_macros.append(DEFINE_MACRO_NUMPY_C_API)

so this comment can be removed. 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think NPY_NO_DEPRECATED_API must be defined everywhere especially if NumPy 2 is used as old C APIs might be deprecated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I think this part has not been ported to Meson, which is likely an oversight ... fixing this is probably doable.

Not 100% sure, but my understanding is that using NPY_NO_DEPRECATED_API + NPY_1_7_API_VERSION makes sure that we don't use any Numpy C API that is deprecated in Numpy version 1.7.

@jjerphan but do you have a suggestion about which version we should pick? Is NPY_1_7_API_VERSION OK? Would using NPY_1_9_API_VERSION be better, which is what scipy is doing see https://github.com/scipy/scipy/blob/fffcaa8c58b6909d22063c29e4f9593059a40230/scipy/meson.build#L76-L77?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the meantime I have opened #29357 to do the same thing as what setup.py was doing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also pick NPY_1_9_API_VERSION to be consistent with SciPy's choice. 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#29357 has been merged, so I guess this PR can be merged too?

lesteve and others added 2 commits June 27, 2024 15:15
Co-authored-by: Jérémie du Boisberranger <jeremie@probabl.ai>
Co-authored-by: Jérémie du Boisberranger <jeremie@probabl.ai>
@jjerphan jjerphan merged commit d840f36 into scikit-learn:main Jun 28, 2024
30 checks passed
@lesteve lesteve deleted the remove-setup-py-from-doc branch June 28, 2024 11:14
@jeremiedbb jeremiedbb mentioned this pull request Jul 2, 2024
11 tasks
snath-xoc pushed a commit to snath-xoc/scikit-learn that referenced this pull request Jul 5, 2024
…t-learn#29352)

Co-authored-by: Jérémie du Boisberranger <jeremie@probabl.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants