How to publish a package with a sub-package to conda-forge?

Hi~

We have a package on PyPI that we want to publish to conda-forge. Let’s call it package A. Package A depends on package B, which is also on PyPI. Package B requires cython, so we decided to separate B from A so that A could be a noarch package for easy distribution.

When we publish A to conda-forge, we want to also build B as a sub-package, so we don’t need to also set up a feedstock for B. So we specify separate sources for both A and B. Then, with the outputs field, we build both A and B, and then have a meta-package that has both A and B as a dependency, This worked all fine. A, B, and the meta-package were all built successfully, but when it comes to testing A and B, imports failed with ModuleNotFound error.

We’d appreciate any suggestions! The PR is here.

Here’s the recipe

{% set name = "hssm" %}
{% set version = "0.2.0" %}
{% set wfpt_name = "hddm-wfpt" %}
{% set wfpt_version = "0.1.4" %}

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

source:
  - url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/hssm-{{ version }}.tar.gz
    sha256: a4b874ff970cdef38ca1d6ec738edb1708b6a9b5e5243b7e4217d4a428be4842
  - url: https://pypi.io/packages/source/{{ name[0] }}/{{ wfpt_name }}/hddm_wfpt-{{ wfpt_version }}.tar.gz
    sha256: b16d318ce47f4691b90e341f29918fd0f7ca0cbce120f794d2e7c8198a40fb6d
    folder: hddm_wfpt

build:
  noarch: python
  number: 0

requirements:
  run:
    - hddm-wfpt
    - hssm-core

test:
  imports:
    - hssm
  commands:
    - pip check
  requires:
    - pip

outputs:
  - name: hddm-wfpt
    version: {{ wfpt_version }}
    build:
      noarch: python
      script: python -m pip install ./hddm_wfpt -vv --no-deps --no-build-isolation
    requirements:
      build:
        - python >=3.10,<3.12
        - {{ compiler('cxx') }}
        - {{ compiler('c') }}
        - {{ stdlib('c') }}
        - numpy
        - cython
        - pip
      host:
        - python >=3.10,<3.12
        - setuptools
        - wheel
        - cython
        - numpy
        - pip
      run:
        - python >=3.10,<3.12
        - numpy >=1.23.4,<1.26.4
        - scipy >=1.9.1
  - name: hssm-core
    version: {{ version }}
    build:
      noarch: python
      script: python -m pip install . -vv --no-deps --no-build-isolation
    requirements:
      build:
        - python >=3.10,<3.12
        - pip
        - poetry-core
      host:
        - python >=3.10,<3.12
        - pip
        - poetry-core
      run:
        - python >=3.10,<3.12
        - pymc <5.10
        - arviz >=0.14.0,<0.15.0
        - onnx >=1.12.0,<2.0.0
        - jax >=0.4.10,<0.4.16
        - ssm-simulators >=0.7.2,<0.8.0
        - huggingface_hub >=0.15.1,<0.16.0
        - onnxruntime >=1.15.0,<2.0.0
        - bambi >=0.12.0,<0.13.0
        - numpyro >=0.12.1,<0.13.0

test:
  imports:
    - hssm
  commands:
    - pip check
  requires:
    - pip
    - hddm-wfpt
    - hssm-core

about:
  home: https://lnccbrown.github.io/HSSM/
  summary: Bayesian inference for hierarchical sequential sampling models.
  dev_url: https://github.com/lnccbrown/HSSM/
  license: LicenseRef-Brown-University-2023
  license_file: LICENSE