Skip to content

Add hook to process manifest#476

Merged
jcfr merged 7 commits into
scikit-build:masterfrom
SylvainCorlay:filter-manifest
Apr 25, 2020
Merged

Add hook to process manifest#476
jcfr merged 7 commits into
scikit-build:masterfrom
SylvainCorlay:filter-manifest

Conversation

@SylvainCorlay

@SylvainCorlay SylvainCorlay commented Apr 7, 2020

Copy link
Copy Markdown
Contributor

This is a simple hook to enable custom processing of the cmake manifest before producing the wheel.

The goal for us is to drop static binaries of dependencies, as well as their headers, and other artefacts such as cmake files, as we want the wheel to only include what is required at runtime.

I am using this here: jupyter-xeus/xeus-python-wheel#36

Fixes #473

@SylvainCorlay

SylvainCorlay commented Apr 7, 2020

Copy link
Copy Markdown
Contributor Author

It seems that the Python 2.7 builds need to be disabled as the installed version of setuptools requires Python>=3.5.

@jcfr jcfr added the Status: Triage Issues/PRs that need to be triaged label Apr 8, 2020
@thewtex thewtex requested a review from jcfr April 9, 2020 02:50
@jcfr

jcfr commented Apr 9, 2020

Copy link
Copy Markdown
Contributor

Thanks for the contribution 🙏

I will be able to review tomorrow.

@SylvainCorlay

Copy link
Copy Markdown
Contributor Author

I will be able to review tomorrow.

Thanks! If you are OK with it, I am happy to add a bit of documentation in the relevant section. I was able to use it successfully in jupyter-xeus/xeus-python-wheel#36.

If there is a release of scikit-build with that hook, that would be great.

@thewtex

thewtex commented Apr 14, 2020

Copy link
Copy Markdown
Member

@jcfr why are the CI tests failing?

@jcfr

jcfr commented Apr 14, 2020

Copy link
Copy Markdown
Contributor

why are the CI tests failing?

It is because the latest version of setuptools is not working with 2.7 ... I got distracted on Friday and didn't move forward with publishing a fix.

Stay tuned for an update. 🙏

@SylvainCorlay

Copy link
Copy Markdown
Contributor Author

@jcfr I am happy to rebase this PR if you update master.

@SylvainCorlay

Copy link
Copy Markdown
Contributor Author

If someone has the time to give this a look, it would be super appreciated.

@jcfr

jcfr commented Apr 16, 2020

Copy link
Copy Markdown
Contributor

@SylvainCorlay I didn't forget ... it is definitely in the queue. Thanks for your patience 🙏

@jcfr jcfr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In the context of the xeus-python-wheel project where all dependencies would be expected to support an option <projectname>_INSTALL_DEVELOPMENT allowing to skip the installation of development files when installing the project without specifying component, this makes sense.

Before we move forward, could you:

  • update documentation to describe the keyword and in which case it could be used
  • update CHANGES.rst
  • add a simple test

Thanks 🙏

Comment thread skbuild/setuptools_wrap.py Outdated
Comment thread skbuild/setuptools_wrap.py Outdated
@jcfr jcfr added Status: In Progress This item is in progress. Type: Enhancement Improvement to functionality and removed Status: Triage Issues/PRs that need to be triaged labels Apr 16, 2020
@SylvainCorlay SylvainCorlay force-pushed the filter-manifest branch 3 times, most recently from ebd4c2f to ef9369d Compare April 19, 2020 01:09
@SylvainCorlay

SylvainCorlay commented Apr 19, 2020

Copy link
Copy Markdown
Contributor Author

Before we move forward, could you:

  • update documentation to describe the keyword and in which case it could be used
  • update CHANGES.rst
  • add a simple test

Done! This is ready to go @jcfr

@jcfr

jcfr commented Apr 19, 2020

Copy link
Copy Markdown
Contributor

Thanks, I will review later tomorrow or Monday. Have a good weekend.

@SylvainCorlay

Copy link
Copy Markdown
Contributor Author

Hey, let me know if there is anything else needed. This is on our critical path to publish the xeus-python wheels.

We are currently using scikit-build from this branch, but this is not great for reproducibility.

@thewtex

thewtex commented Apr 21, 2020

Copy link
Copy Markdown
Member

ping @jcfr

@SylvainCorlay

Copy link
Copy Markdown
Contributor Author

Hey @jcfr is there anything we can do to help move this forward?

@jcfr jcfr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks very good.

One last nitpick, let me know what you think

# This hook enables custom processing of the cmake manifest
cmake_manifest = cmkr.install()
process_manifest = kw.get('cmake_process_manifest_hook')
if callable(process_manifest):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It may be sensible to report an error if it is not callable

@jcfr

jcfr commented Apr 21, 2020

Copy link
Copy Markdown
Contributor

@SylvainCorlay I will add the error reporting and integrate. No further action needed.

@jcfr jcfr linked an issue Apr 23, 2020 that may be closed by this pull request
@jcfr jcfr force-pushed the filter-manifest branch from 589b626 to b0ae814 Compare April 23, 2020 08:18
As described in [1], support for python 2.7 was removed in setuptools >= 45
and it must be pinned.

This commit fixes error like the following:

  ERROR: Package 'setuptools' requires a different Python: 2.7.17 not in '>=3.5'

See scikit-build#478

[1] https://github.com/pypa/setuptools/blob/v46.1.3/.github/ISSUE_TEMPLATE/setuptools-warns-about-python-2-incompatibility.md
@jcfr jcfr force-pushed the filter-manifest branch from b0ae814 to a0cbced Compare April 23, 2020 08:21
@jcfr

jcfr commented Apr 23, 2020

Copy link
Copy Markdown
Contributor

The test tests/test_filter_manifest.py::test_bdist_wheel_command is failing on macOS (for all python versions) with the following error:

lib_file = <_io.BufferedReader name='_skbuild/macosx-10.13-x86_64-3.7/setuptools/bdist.macosx-10.13-x86_64/wheel/hello/_swig_mwe.so'>
seek = 0
    def get_base_class_and_magic_number(lib_file, seek=None):
        if seek is None:
            seek = lib_file.tell()
        else:
            lib_file.seek(seek)
        magic_number = ctypes.c_uint32.from_buffer_copy(
>           lib_file.read(ctypes.sizeof(ctypes.c_uint32))).value
E       ValueError: Buffer size too small (0 instead of at least 4 bytes)
../../../.pyenv/versions/3.7.0/lib/python3.7/site-packages/wheel/macosx_libfile.py:224: ValueError

This is caused by the dummy .so file being an invalid library. In that case, the following function fails to extract macOS information: https://github.com/pypa/wheel/blob/a51977075740fda01b2c0e983a79bfe753567219/src/wheel/macosx_libfile.py#L219-L225

…m .so to .pyd

This commit fixes the test by using .pyd extension on all platforms.
This will avoid failure on macOS where wheel wheel/macosx_libfile.py
attempts to extract shared library information.
@jcfr jcfr force-pushed the filter-manifest branch from e475e78 to 11540d2 Compare April 23, 2020 17:04
@SylvainCorlay

Copy link
Copy Markdown
Contributor Author

Maybe I should include a real compiled extension rather than an empty dummy file for this example - although the other tests that do the same will still be failing.

@jcfr

jcfr commented Apr 24, 2020 via email

Copy link
Copy Markdown
Contributor

jcfr added 2 commits April 25, 2020 00:15
…dule extension from .so to .pyd

This commit fixes the test by using .pyd extension on all platforms.
This will avoid failure on macOS where wheel wheel/macosx_libfile.py
attempts to extract shared library information.
This commit ensures that no signing message is displayed when running
tests on workstation with commit signing enabled globally.
@jcfr jcfr force-pushed the filter-manifest branch from 11540d2 to bef4146 Compare April 25, 2020 04:31
@jcfr

jcfr commented Apr 25, 2020

Copy link
Copy Markdown
Contributor

CI is mostly green, after Travis completes I will integrate.

Linux_PyPy3 failures are unrelated and will be fixed later or even disabled.

@SylvainCorlay

Copy link
Copy Markdown
Contributor Author

Great! Thanks for taking the time!

@jcfr jcfr merged commit ccbd20f into scikit-build:master Apr 25, 2020
@jcfr

jcfr commented Apr 25, 2020

Copy link
Copy Markdown
Contributor

if callable(process_manifest):

It may be sensible to report an error if it is not callable

I created an issue to track this. See #482

This would be a good first issue for anyone new to the code base

@jcfr

jcfr commented Apr 25, 2020

Copy link
Copy Markdown
Contributor

Great! Thanks for taking the time!

Thanks to you for contributing 🙏

Have a good weekend

@SylvainCorlay SylvainCorlay deleted the filter-manifest branch April 25, 2020 21:59
@jcfr jcfr removed the Status: In Progress This item is in progress. label Apr 27, 2020
@SylvainCorlay

Copy link
Copy Markdown
Contributor Author

@jcfr it would be fantastic if there was a scikit-build tag including this patch!

We have been looking into streamlining the release of xeus-python on PyPI for a few weeks and having a new release of scikit-build is the main blocker.

@jcfr

jcfr commented Apr 27, 2020

Copy link
Copy Markdown
Contributor

Yes, I will do a release shortly. After integrating Pablo PR.

@SylvainCorlay

Copy link
Copy Markdown
Contributor Author

Great thanks!

@SylvainCorlay

Copy link
Copy Markdown
Contributor Author

Yes, I will do a release shortly. After integrating Pablo PR.

Is there any blocker on this ! I don't want to be nagging - but I am following up as we have been blocked on this for a few weeks!

@jcfr

jcfr commented Apr 29, 2020

Copy link
Copy Markdown
Contributor

Fundamentally there are no blockers, time is just finite resource.

After #486 completes I will do release 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Enhancement Improvement to functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix continuous integration requiring older setuptool for python 2.7 Cleanup wheels from useless artefacts

3 participants