ismrmrd / ismrmrd-python

Python API for the ISMRMRD file format
Other
51 stars 27 forks source link

Package on conda-forge and conda osx-arm64 #69

Open gabuzi opened 1 year ago

gabuzi commented 1 year ago

Hi,

I have realized that I can't install ismrmrd-python on an apple silicon device (conda platform osx-arm64). While one can pretend to be on x86-64 by creating the env with --platform osx-64, I don't think that this should be required (as ismrmrd-python is a pure python package).

Further, install from conda seems to require conda-forge channels anyway since xsdata is only available from there. Ismrmrd-python could also be distributed via conda-forge to simplify the installation as the currently required custom 'ismrmrd' channel for install is not well documented and I had to dig a bit in the repo to find it.

I would thus propose to publish also to conda-forge. My initial tests with building a noarch python conda package (https://docs.anaconda.com/reference/glossary/?highlight=noarch#noarch-package) for ismrmrd-python were successful, although I could not build directly from the sources released on PyPI, because they don't include all source files (crucially schema/.xsdata.xml is absent, and then the xsdata code generation will default to PascalCase instead of camelCase for classes). Also examples are not present.

The are two options that worked for me for building, including tests:

  1. Build either from github source release.
  2. Build from PyPI wheel (which contains the xsd-generated python module): https://docs.conda.io/projects/conda-build/en/3.27.x/user-guide/wheel-files.html. If building from PyPI wheel, we need to download the PyPI sources still, because LICENSE and tests/ are only contained therein. I have tested this, it works on my apple silicon machine, but it makes the recipe more complicated.

Conda-forge prefers source builds over builds from wheels. Preferably, sources uploaded to PyPI are identical with those in github releases to avoid confusion. Then it also wouldn't matter anymore where the sources are taken from. It should also be possible for to setup automatic conda-forge packaging regardless of where the sources are from (https://conda-forge.org/docs/maintainer/updating_pkgs.html#how-does-regro-cf-autotick-bot-create-automatic-version-updates), but I have no personal experience with this.

I wanted to ask for the ismrmrd-python maintainers' opinions on this. I'd be happy to submit a PR to https://github.com/conda-forge/staged-recipes to get the process started.

gabuzi commented 8 months ago

Any objections to me going forward with a conda-forge build?

dchansen commented 8 months ago

@hansenms Any objections here?

hansenms commented 8 months ago

Go for it!

gabuzi commented 8 months ago

Happy to report that the PR was merged and ismrmrd-python is now available from the conda-forge channel: https://anaconda.org/conda-forge/ismrmrd-python

This is a "noarch" conda package (pure python) and should thus run on windows, linux, macos...

I was forced to constrain to Python <3.12 as 3.12 has now finally removed the imp library: https://docs.python.org/3/whatsnew/3.12.html. Nose, which is quite old (1.3.7 was last updated 9 years ago) is no longer compatible (I'm honestly surprised that it lasted for so long). At this point, I would suggest to migrate away from nose to another testing library. There is pynose as a maintained fork of nose, but it doesn't seem to be available from conda.

Lastly, I'm happy to maintain the conda-forge recipe, but if any maintainer here wants to be added as a recipe maintainer, please let me know, it's certainly better to have more people in the loop!

lrlunin commented 4 weeks ago

Happy to report that the PR was merged and ismrmrd-python is now available from the conda-forge channel: https://anaconda.org/conda-forge/ismrmrd-python

This is a "noarch" conda package (pure python) and should thus run on windows, linux, macos...

I was forced to constrain to Python <3.12 as 3.12 has now finally removed the imp library: https://docs.python.org/3/whatsnew/3.12.html. Nose, which is quite old (1.3.7 was last updated 9 years ago) is no longer compatible (I'm honestly surprised that it lasted for so long). At this point, I would suggest to migrate away from nose to another testing library. There is pynose as a maintained fork of nose, but it doesn't seem to be available from conda.

Lastly, I'm happy to maintain the conda-forge recipe, but if any maintainer here wants to be added as a recipe maintainer, please let me know, it's certainly better to have more people in the loop!

Can you please update the library to the 1.14.1 version? Maybe there is some way inclduing GitHub workflow to automatically update the conda-forge version to the last release in this repo.

Thank you very much for your work!

gabuzi commented 4 weeks ago

Can you please update the library to the 1.14.1 version? Maybe there is some way inclduing GitHub workflow to automatically update the conda-forge version to the last release in this repo.

Thank you very much for your work!

Sorry, that update slipped my attention, thanks for the reminder. PR is merged https://github.com/conda-forge/ismrmrd-python-feedstock/pull/2, should show up on conda-forge shortly.