Skip to content
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

Fix 2849: Problem with custom commands inheriting directly from distutils #2855

Merged
merged 5 commits into from
Nov 4, 2021

Conversation

abravalheri
Copy link
Contributor

Summary of changes

This PR provides a fallback when packages extend build_py directly from distutils instead of setuptools.

It is pretty much the same changed implemented in 8a0e63a, but now we have a compelling reason to leave it there.

I added a unit test for that scenario, however other people have suggest trying to build scipy against 'setuptools'.

I understand that, it would be a nice integration test, but it is also very resource and time heavy, so I am not sure about how to proceed with that.

Closes #2849

Pull Request Checklist

According to pypa#2849, some projects, including important data-science
packages rely on `distutils` when creating custom commands, instead of
extending the ones provided by setuptools.

This change should accomodate this use case, while also warning the
users to migrate.
@abravalheri abravalheri changed the title Fix 2849 Fix 2849: Problem with custom commands inheriting directly from distutils Nov 4, 2021
@jjerphan
Copy link

jjerphan commented Nov 4, 2021

Thanks in advance, @abravalheri, for tackling this problem!

@abravalheri
Copy link
Contributor Author

That is an interesting Windows error: OSError: [WinError 0] The operation completed successfully...

I suppose Windows had some problem starting the processes.

Maybe running again solves the problem?

@peratik
Copy link

peratik commented Nov 4, 2021

Please merge it as soon as possible, Thanks in advance

if hasattr(build_py, 'get_data_files_without_manifest'):
return build_py.get_data_files_without_manifest()

log.warn(
Copy link
Member

Choose a reason for hiding this comment

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

I'm unsure whether to invoke log.warn here or issue a DeprecationWarning. The latter can be controlled by warnings filters. In any case, I quite like the approach taken here to direct the users away from using distutils, which is deprecated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure myself 😅

If you prefer a DeprecationWarning, I can work in a change over the weekend.

@@ -0,0 +1,3 @@
Add fallback for custom ``build_py`` commands inheriting directly from
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 consider this a bugfix for the feature, so I'll rename this file to .misc.

Copy link
Member

@jaraco jaraco left a comment

Choose a reason for hiding this comment

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

Looks great. Just one nitpick on the changelog scope. I'll make the change and get this out asap. Brilliant work creating a test. I also agree on resisting integration tests with a large and complex suite like scikit. I'd love to see some integration tests, but I'd like to see them outside this project.

@jaraco jaraco merged commit 51eb5a1 into pypa:main Nov 4, 2021
@jaraco
Copy link
Member

jaraco commented Nov 4, 2021

Fix going out as v58.5.3.

@abravalheri abravalheri deleted the fix-2849 branch November 4, 2021 22:44
@abravalheri
Copy link
Contributor Author

Thank you very much @jaraco 👏

@mattip
Copy link
Contributor

mattip commented Nov 5, 2021

Thanks for the fix. As I mentioned elsewhere, the danger of a new version of setuptools inadvertently breaking project's workflow is that then the project will begin pinning setuptools to an earlier version, which means setuptools will never find out that its HEAD no longer works for that project. Perhaps a compromise, assuming not every change can be tested, would be to add tests before a release.

jjerphan added a commit to jjerphan/scikit-learn that referenced this pull request Nov 5, 2021
…cikit-learn#21549)"

This reverts commit 953d101.

The fix for setuptools#21549 has been introduced in 58.5.3.

See: pypa/setuptools#2855 (comment)
LarsMichelsen pushed a commit to Checkmk/checkmk that referenced this pull request Nov 5, 2021
ogrisel pushed a commit to scikit-learn/scikit-learn that referenced this pull request Nov 5, 2021
…21549)" (#21560)

This reverts commit 953d101.

The fix for setuptools#21549 has been introduced in 58.5.3.

See: pypa/setuptools#2855 (comment)
@jaraco
Copy link
Member

jaraco commented Nov 5, 2021

I agree it would be nice to have integration tests for at least some common, popular use-cases. I'd like for these tests to be separate from the normal development workflow (either deselected by default or run as a separate suite) so that the test suite execution time and CI test time isn't dramatically affected. I'm thinking maybe another GH action between test and release.

abravalheri added a commit to abravalheri/setuptools that referenced this pull request Nov 5, 2021
As discussed in pypa#2855, using an actual warning instead of the logger
allow users to control what gets displayed via warning filters.
@abravalheri
Copy link
Contributor Author

I can try to have a look on this, if the idea is to do it as an action before the release.

There was a previous attempt from PyPA to have integration tests: https://github.com/pypa/integration-test
(currently archived until interest is renewed). That could also be an option.

glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Nov 29, 2021
samronsin pushed a commit to samronsin/scikit-learn that referenced this pull request Nov 30, 2021
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Dec 24, 2021
glemaitre pushed a commit to scikit-learn/scikit-learn that referenced this pull request Dec 25, 2021
…21549)" (#21560)

This reverts commit 953d101.

The fix for setuptools#21549 has been introduced in 58.5.3.

See: pypa/setuptools#2855 (comment)
mathijs02 pushed a commit to mathijs02/scikit-learn that referenced this pull request Dec 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] setuptools 58.5 breaks installation of docutils==0.10.0
5 participants