pypulseq icon indicating copy to clipboard operation
pypulseq copied to clipboard

Conda Package for Pypulseq

Open gabuzi opened this issue 9 months ago • 5 comments

Is your feature request related to a problem? Please describe. Pypulseq is only available from PyPI. I frequently find myself using conda as a package manager because some performance critical, mostly GPU related packages are managed via conda environments in our organization.

While installing packages from PyPI via pip in a conda environment works generally ok, it is fragile and does not properly take dependencies into account. Thus, the recommended practice is to not run any conda commands after pip has been used.

A requirement of building conda packages is that they can only list other conda packages as dependencies, not packages from PyPI.

Describe the solution you'd like Build conda packages for every release. Conda-forge can be setup to automatically track PyPI releases. See e.g. https://github.com/conda-forge/sigpy-feedstock/pull/3 contributed by @wtclarke for sigpy.

The following conda meta.yaml file was obtained with the grayskull tool (https://conda-forge.org/blog/posts/2020-03-05-grayskull/), setup to create a conda package from the pypulseq package on PyPI and can serve as a starting point.

{% set name = "pypulseq" %}
{% set version = "1.4.0" %}  # this should eventually be changed to v 1.4.x where x is the version where sigpy was bumped to newer versions that support modern numpy!

package:
  name: {{ name|lower }}
  version: {{ version }}

source:
  url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/pypulseq-{{ version }}.tar.gz
  sha256: 0f639aa1bdbdba547b38da73cd59f54325f1586c84263ddac59973bc83acc74e

build:
  noarch: python
  script: {{ PYTHON }} -m pip install . -vv
  number: 0

requirements:
  host:
    - python >=3.6
    - pip
  run:
    - python >=3.6
    - coverage >=6.2
    - matplotlib-base >=3.5.2
    - numpy <1.24  # again, should be adjusted in line with scipy requirements
    - scipy >=1.8.1
    - sigpy ==0.1.25  # I bumped this to the latest available on conda-forge, but should be adjusted

test:
  imports:
    - pypulseq
  source_files:
    - pypulseq/tests
  commands:
#    - pip check  # disabled because checks for sigpy 0.1.23!
    - pytest pypulseq/tests  # some currently fail due to missing matlab pulseq files
  requires:
    - pip
    - coverage >= 6.2
    - pytest

about:
  home: https://github.com/imr-framework/pypulseq
  summary: Pulseq in Python
  license: AGPL-3.0
  license_file: LICENSE

extra:
  recipe-maintainers:
    - AddYourGitHubIdHere

This can be built with conda build -c conda-forge . in the directory where you put this meta.yaml file.

This builds on my macbook (arm), but there are errors and warnings from unit tests (annotated above).

All of this should obviously go together with a CI pipeline and more unit tests, including getting the matlab pulseq files for the current test suite into the repository (see #144).

gabuzi avatar Nov 17 '23 18:11 gabuzi