<commit_before>{% set version = "1.5.3" %}
{% set number = 0 %}
{% set proc_type = "cuda" if cuda_compiler_version != "None" else "cpu" %}
{% if cuda_compiler_version != "None" %}
{% set number = number + 200 %}
{% endif %}

package:
  name: mmcv-recipe
  version: {{ version }}

source:
  url: https://github.com/open-mmlab/mmcv/archive/refs/tags/v{{ version }}.tar.gz
  sha256: 650929f52f1d0b2bae1bdaaa874e1e6dfdfa15f40bab5c366330488a9949ddd0
build:
  number: {{ number }}
  skip: true  # [win]

outputs:
  - name: mmcv-full
    build:
      string: cuda{{ cuda_compiler_version | replace('.', '') }}py{{ CONDA_PY }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}  # [cuda_compiler_version != "None"]
      string: cpu_py{{ CONDA_PY }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}                                      # [cuda_compiler_version == "None"]
      detect_binary_files_with_prefix: false
      run_exports:
        - {{ pin_subpackage('mmcv-full', max_pin='x.x') }}
      missing_dso_whitelist:
        # conda-forge::pytorch provides these libs
        - "$RPATH/libc10_cuda.so"
        - "$RPATH/libtorch_python.so"
        - "$RPATH/libtorch_cpu.so"
        - "$RPATH/libc10.so"
        - "$RPATH/libc10_cuda.dylib"
        - "$RPATH/libtorch_python.dylib"
        - "$RPATH/libtorch_cpu.dylib"
        - "$RPATH/libc10.dylib"
    script: build_mmcv.sh  # [not win]
    requirements:
      build:
        - python                                 # [build_platform != target_platform]
        - cross-python_{{ target_platform }}     # [build_platform != target_platform]
        - {{ compiler('c') }}
        - {{ compiler('cxx') }}
        # this adds matching cuda requirement to run deps using __cuda package
        - {{ compiler('cuda') }}    # [cuda_compiler_version != "None"]
        - ninja
      host:
        - python
        - pip
        - requests
        - future
        - six
        - typing
        - pkg-config  # [unix]
        - typing_extensions
        - pytorch ={{ pytorch }}={{ proc_type }}*
        - torchvision
        - setuptools
      run:
        # intentionally skipping opencv and pytorch (following upstream vendor)
        - addict
        - packaging
        - Pillow
        - pyyaml
        - yapf
        - {{ pin_compatible('numpy') }}
        - typing_extensions
      run_constrained:
        - pytorch =*={{ proc_type }}*
    test:
      requires:
        - pytest
        - requests
        - scipy
        - libopencv
        - py-opencv
        - opencv
        - python-lmdb
        - libiconv
        - tifffile
        - python-dateutil
        - torchvision
      imports:
        - mmcv
      source_files:
        - tests
      commands:
        {% set failing_tests = ["test_imcrop",
                                "test_tensor2imgs",
                                "test_imwrite",
                                "test_imfrombytes",
                                "test_imread"] %}
        {% set slow_tests = ["test_eval_hook",
                             "test_start_param",
                             "test_flat_cosine_runner_hook",
                             "test_momentum_runner_hook",
                             "test_step_runner_hook",
                             "test_adjust_sharpness",
                             "test_adjust_contrast",
                             "test_adjust_brightness",
                             "test_gradient_cumulative_optimizer_hook",
                             "test_auto_contrast"] %}
        {% set ignored_files = ["./tests/test_ops/test_onnx.py",
                                "./tests/test_ops/test_tensorrt.py",
                                "./tests/test_ops/test_tensorrt_preprocess.py",
                                "./tests/test_utils/test_timer.py",
                                "./tests/test_utils/test_progressbar.py"] %}
        # ignored tests:
        # test_onnx.py,test_tensorrt.py,test_tensorrt_preprocess.py - mccv currently compiled without onnx runtime
        # test_geometric.py:test_imcrop - depending on what backend opencv uses it produces diff results (lipjpeg vs libturbojpeg)
        # test_io.py - tries to import libturbojpeg that we don't install (conflicts with opencv that uses libjpeg)
        # test_progressbar.py, test_timer.py - on OSX sleep(1) takes 1.1sec, so all related tests fail
        # test_image_misc.py::test_tensor2imgs - need to investigate 2/75 mismatch
        - python3 -m pytest ./tests/ -k "not ({{ (failing_tests + slow_tests)|join(' or ') }})" --ignore={{ ignored_files|join(' --ignore=') }}
        - python3 -c "import mmcv; print(mmcv.__version__)"


about:
  home: https://github.com/open-mmlab/mmcv
  summary: 'Foundational library for computer vision research'
  description: |
    MMCV is a foundational library for computer vision research and supports many research projects.
  license: Apache-2.0
  license_family: Apache
  license_file: LICENSE.txt
  dev_url: https://github.com/open-mmlab/mmcv<commit_msg>Update recipes/mmcv/meta.yaml<commit_after>{% set version = "1.5.3" %}
{% set number = 0 %}
{% set proc_type = "cuda" if cuda_compiler_version != "None" else "cpu" %}
{% if cuda_compiler_version != "None" %}
{% set number = number + 200 %}
{% endif %}

package:
  name: mmcv-recipe
  version: {{ version }}

source:
  url: https://github.com/open-mmlab/mmcv/archive/refs/tags/v{{ version }}.tar.gz
  sha256: 650929f52f1d0b2bae1bdaaa874e1e6dfdfa15f40bab5c366330488a9949ddd0
build:
  number: {{ number }}
  skip: true  # [win]

outputs:
  - name: mmcv-full
    build:
      string: cuda{{ cuda_compiler_version | replace('.', '') }}py{{ CONDA_PY }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}  # [cuda_compiler_version != "None"]
      string: cpu_py{{ CONDA_PY }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}                                      # [cuda_compiler_version == "None"]
      detect_binary_files_with_prefix: false
      run_exports:
        - {{ pin_subpackage('mmcv-full', max_pin='x.x') }}
      missing_dso_whitelist:
        # conda-forge::pytorch provides these libs
        - "$RPATH/libc10_cuda.so"
        - "$RPATH/libtorch_python.so"
        - "$RPATH/libtorch_cpu.so"
        - "$RPATH/libc10.so"
        - "$RPATH/libc10_cuda.dylib"
        - "$RPATH/libtorch_python.dylib"
        - "$RPATH/libtorch_cpu.dylib"
        - "$RPATH/libc10.dylib"
    script: build_mmcv.sh  # [not win]
    requirements:
      build:
        - python                                 # [build_platform != target_platform]
        - cross-python_{{ target_platform }}     # [build_platform != target_platform]
        - {{ compiler('c') }}
        - {{ compiler('cxx') }}
        # this adds matching cuda requirement to run deps using __cuda package
        - {{ compiler('cuda') }}    # [cuda_compiler_version != "None"]
        - ninja
      host:
        - python
        - pip
        - requests
        - future
        - six
        - typing
        - pkg-config  # [unix]
        - typing_extensions
        - pytorch ={{ pytorch }}={{ proc_type }}*
        - torchvision
        - setuptools
      run:
        # intentionally skipping opencv and pytorch (following upstream vendor)
        - addict
        - packaging
        - Pillow
        - pyyaml
        - yapf
        - {{ pin_compatible('numpy') }}
        - typing_extensions
      run_constrained:
        - pytorch =*={{ proc_type }}*
    test:
      requires:
        - pytest
        - requests
        - scipy
        - libopencv
        - py-opencv
        - opencv
        - python-lmdb
        - libiconv
        - tifffile
        - python-dateutil
        - torchvision
      imports:
        - mmcv
      source_files:
        - tests
      commands:
        {% set failing_tests = ["test_imcrop",
                                "test_tensor2imgs",
                                "test_imwrite",
                                "test_imfrombytes",
                                "test_imread"] %}
        {% set slow_tests = ["test_eval_hook",
                             "test_start_param",
                             "test_flat_cosine_runner_hook",
                             "test_momentum_runner_hook",
                             "test_step_runner_hook",
                             "test_adjust_sharpness",
                             "test_adjust_contrast",
                             "test_adjust_brightness",
                             "test_gradient_cumulative_optimizer_hook",
                             "test_auto_contrast"] %}
        {% set ignored_files = ["./tests/test_ops/test_onnx.py",
                                "./tests/test_ops/test_tensorrt.py",
                                "./tests/test_ops/test_tensorrt_preprocess.py",
                                "./tests/test_utils/test_timer.py",
                                "./tests/test_utils/test_progressbar.py"] %}
        # ignored tests:
        # test_onnx.py,test_tensorrt.py,test_tensorrt_preprocess.py - mccv currently compiled without onnx runtime
        # test_geometric.py:test_imcrop - depending on what backend opencv uses it produces diff results (lipjpeg vs libturbojpeg)
        # test_io.py - tries to import libturbojpeg that we don't install (conflicts with opencv that uses libjpeg)
        # test_progressbar.py, test_timer.py - on OSX sleep(1) takes 1.1sec, so all related tests fail
        # test_image_misc.py::test_tensor2imgs - need to investigate 2/75 mismatch
        - python3 -m pytest ./tests/ -k "not ({{ (failing_tests + slow_tests)|join(' or ') }})" --ignore={{ ignored_files|join(' --ignore=') }}
        - python3 -c "import mmcv; print(mmcv.__version__)"


about:
  home: https://github.com/open-mmlab/mmcv
  summary: 'Foundational library for computer vision research'
  description: |
    MMCV is a foundational library for computer vision research and supports many research projects.
  license: Apache-2.0
  license_family: Apache
  license_file: LICENSE
  dev_url: https://github.com/open-mmlab/mmcv
{'fraction_non_alphanumeric': 0.11304521808723489, 'fraction_numerical': 0.013205282112845138, 'mean_word_length': 1.7646570796460177, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2845645', 'n_tokens_mistral': 3213, 'n_tokens_neox': 3046, 'n_words': 592}