bitshuffle icon indicating copy to clipboard operation
bitshuffle copied to clipboard

Build backend updated to poetry core

Open danielemichilli opened this issue 3 years ago • 5 comments

This solves issue #118 and makes the repository compatible with poetry. To do so, it updates the style of pyproject.toml and uses its light weight, fully compliant, self-contained package allowing PEP 517 compatible build frontends, solving the error indicated in the issue

danielemichilli avatar May 04 '22 23:05 danielemichilli

Can you explain more why the issue you link to is an issue in bitshuffle? That poetry doesn't install the listed build requirements before trying to buld the package seems like an issue in poetry (quite possible this issue: https://github.com/python-poetry/poetry/issues/2789).

Generally I'm interested in moving a bunch of packages to more modern build methods but in my (limited) past experience poetry is the most frustrating of them all. At the moment the current setup.py/setuptools builds mostly works fine so a high premium should be placed on changing it over.

Are there tweaks to the pyproject.toml file that would make poetry install Cython without changing the build backend to poetry?

jrs65 avatar May 07 '22 16:05 jrs65

Anyway @danielemichilli I'm on vacation for two weeks, but it would be good to figure out the pros and cons of this when I'm back. Otherwise Kiyo might be able to deal with it in the mean time.

jrs65 avatar May 07 '22 16:05 jrs65

This is not necessarily an issue with bitshuflle but I think making it poetry-compatible is a good idea if it does not cause problems with the module. I was able to install bitshuffle without issues after my edits with or without poetry but I am not aware of all the building methods that are necessary to be supported. I believe this would be a quick test to run, in the meantime, enjoy your vacation!

Are there tweaks to the pyproject.toml file that would make poetry install Cython without changing the build backend to poetry?

I have looked into this but I did not find a way to do it.

danielemichilli avatar May 09 '22 18:05 danielemichilli

@danielemichilli @jrs65 -- looking into this issue and here are some observations.

  • The issue is not pyproject.toml -- it is setup with sufficient parameters.
  • The issue arises from the current layout of setup.py itself. You can replicate this issue by simply following the commands below:
cd bitshuffle
docker run -it -v $(pwd):/bitshuffle python:3.7-slim python /bitshuffle/setup.py --help
Traceback (most recent call last):
  File "/bitshuffle/setup.py", line 13, in <module>
    from Cython.Compiler.Main import default_options
ModuleNotFoundError: No module named 'Cython'

You need Cython installed in the environment to even evaluate the install and setup directives. This breaks any setup command other than install.

Most third-party dependency resolution systems, pipx, poetry, flit etc. use egg_info to fetch metadata, build tags and dependency links for the project. Note, this is outside the purview and different from install_requires and setup_requires dependencies which are correctly defined in pyproject.toml.

The solution is quite simple,

  1. Move the cython imports under a separate function
  2. Call the said function from within setup() which is invoked after setup_requires.

shinybrar avatar May 19 '22 03:05 shinybrar

I would recommend closing this PR in favor of #123

shinybrar avatar May 22 '22 00:05 shinybrar