{% set version = "2.2.0" %}
{% set build_number = 0 %}

# List of jupyter_lsp py.tests ran for each known servers
{% set server_tests = ["serverextension", "start_known", "listeners"] %}

package:
  name: jupyter-lsp-meta
  version: {{ version }}

source:
  url: https://pypi.io/packages/source/j/jupyter-lsp/jupyter-lsp-{{ version }}.tar.gz
  sha256: 8ebbcb533adb41e5d635eb8fe82956b0aafbf0fd443b6c4bfa906edeeb8635a1

outputs:
  - name: jupyter-lsp
    script: build_base.bat  # [win]
    script: build_base.sh  # [unix]
    version: {{ version }}
    build:
      number: {{ build_number }}
      skip: true # [py<38]
    requirements:
      host:
        - pip
        - python
        - setuptools
        - wheel
      run:
        - importlib-metadata >=4.8.3 # [py<310]
        - jupyter_server >=1.1.2
        - python
    test:
      requires:
        - pip
        - m2-grep  # [win]
      commands:
        - pip check
        # print them all for debugging
        - jupyter server extension list
        # write out lists to grep
        - jupyter server extension list 1>server_extensions 2>&1
        # check files
        - grep -iE "jupyter_lsp.*OK" server_extensions
    about:
      home: https://github.com/jupyter-lsp/jupyterlab-lsp
      license: BSD-3-Clause
      license_family: BSD
      license_file: LICENSE
      summary: Multi-Language Server WebSocket proxy for Jupyter Server
      doc_url: https://jupyterlab-lsp.readthedocs.io
      dev_url: https://github.com/jupyter-lsp/jupyterlab-lsp

  - name: jupyter-lsp-latex
    version: {{ version }}
    build:
      number: {{ build_number }}
      skip: True # no texlab / chtex on anaconda main channel
    requirements:
      host:
        - python
      run:
        - python
        - {{ pin_subpackage("jupyter-lsp", exact=True) }}
        - texlab
        - chktex
    test:
      requires:
        - pip
        - pytest-asyncio
        - pytest-runner
      commands:
        - pip check
        # TODO add test for current ls by adding " or pyls" to -k option - but 1 test is failing
        - pytest -vv -p no:warnings --pyargs jupyter_lsp -k "not ({{ server_tests|join(' or ') }} or r_package_detection or test_io_failure)"
    about:
      home: https://github.com/jupyter-lsp/jupyterlab-lsp
      license: BSD-3-Clause
      license_family: BSD
      license_file: LICENSE
      summary: A metapackage for jupyter-lsp and texlab
      doc_url: https://jupyterlab-lsp.readthedocs.io
      dev_url: https://github.com/jupyter-lsp/jupyterlab-lsp

  - name: jupyter-lsp-python
    version: {{ version }}
    build:
      number: {{ build_number }}
    requirements:
      host:
        - python
      run:
        - python
        - {{ pin_subpackage("jupyter-lsp", exact=True) }}
        - python-lsp-server >=1
    test:
      requires:
        - pip
        - pytest-asyncio
        - pytest-runner
      commands:
        - pip check
        # TODO add test for current ls by adding " or pyls" to -k option - but 1 test is failing
        - pytest -vv -p no:warnings --pyargs jupyter_lsp -k "not ({{ server_tests|join(' or ') }} or r_package_detection or test_io_failure)"
    about:
      home: https://github.com/jupyter-lsp/jupyterlab-lsp
      license: BSD-3-Clause
      license_family: BSD
      license_file: LICENSE
      summary: A metapackage for jupyter-lsp and python-lsp-server
      doc_url: https://jupyterlab-lsp.readthedocs.io
      dev_url: https://github.com/jupyter-lsp/jupyterlab-lsp

  - name: jupyter-lsp-python-plugins
    version: {{ version }}
    build:
      number: {{ build_number }}
      skip: True  # no pyls on anaconda main at the moment
    requirements:
      host:
        - python
      run:
        - python
        - {{ pin_subpackage("jupyter-lsp-python", exact=True) }}
        - pyls-isort >=0.2.2
        - pylsp-mypy >=0.5.1,!=0.6.6=*_0
        # TODO: remove after https://github.com/conda-forge/pyls-memestra-feedstock/issues/18
        # - pyls-memestra >=0.0.13
      run_constrained:
        - ipython >=7.20
    test:
      requires:
        - pip
        - pytest-asyncio
        - pytest-runner
      commands:
        - pip check
        # TODO add test for current ls by adding " or pyls" to -k option - but 1 test is failing
        - pytest -vv -p no:warnings --pyargs jupyter_lsp -k "not ({{ server_tests|join(' or ') }} or r_package_detection or test_io_failure)"
    about:
      home: https://github.com/jupyter-lsp/jupyterlab-lsp
      license: BSD-3-Clause
      license_family: BSD
      license_file: LICENSE
      summary: A metapackage for jupyter-lsp, python-language-server, and all known plugins
      doc_url: https://jupyterlab-lsp.readthedocs.io
      dev_url: https://github.com/jupyter-lsp/jupyterlab-lsp

  - name: jupyter-lsp-r
    version: {{ version }}
    build:
      number: {{ build_number }}
      skip: True  # no r-languageserver on anaconda r channel at the moment
    requirements:
      host:
        - python
      run:
        - python
        - {{ pin_subpackage("jupyter-lsp", exact=True) }}
        # Snippets support https://github.com/jupyter-lsp/jupyterlab-lsp/issues/208
        - r-languageserver >=0.3.5
    test:
      requires:
        - pip
        - pytest-asyncio
        - pytest-runner
      commands:
        - pip check
        - pytest -vv -p no:warnings --pyargs jupyter_lsp -k "not ({{ server_tests|join(' or ') }} or test_io_failure)"
    about:
      home: https://github.com/jupyter-lsp/jupyterlab-lsp
      license: BSD-3-Clause
      license_family: BSD
      license_file: LICENSE
      summary: A metapackage jupyter-lsp and r-languageserver
      doc_url: https://jupyterlab-lsp.readthedocs.io
      dev_url: https://github.com/jupyter-lsp/jupyterlab-lsp


about:
  home: https://github.com/jupyter-lsp/jupyterlab-lsp
  license: BSD-3-Clause
  license_family: BSD
  license_file: LICENSE
  summary: Multi-Language Server WebSocket proxy for Jupyter Server
  doc_url: https://jupyterlab-lsp.readthedocs.io
  dev_url: https://github.com/jupyter-lsp/jupyterlab-lsp

extra:
  feedstock-name: jupyter-lsp
  recipe-maintainers:
    - bollwyvl
    - fcollonval
    - krassowski
