{% set name = "ipykernel" %}
{% set version = "6.29.5" %}

{% set migrating = false %}

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

source:
  url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
  sha256: f093a22c4a40f8828f8e330a9c297cb93dcab13bd9678ded6de8e5cf81c56215
  patches:
    - patches/0001-test-conf.patch

build:
  number: 1
  skip: true  # [py<38]
  script:
    - {{ PYTHON }} -m pip install . --no-deps --no-build-isolation -vv
    - {{ PYTHON }} -m ipykernel install --sys-prefix
    # TODO: this may be needed/desirable at some point
    # - cd {{ RECIPE_DIR }} && {{ PYTHON }} fix_kernelspec.py

requirements:
  build:
    - patch # [unix]
    - m2-patch # [win]
  host:
    - python
    - pip
    - hatchling >=1.4
    - jupyter_client >=6.1.12
    - comm >=0.1.1
    - ipython >=7.23.1
    - psutil
  run:
    - python
    - debugpy >=1.6.5
    - ipython >=7.23.1
    - comm >=0.1.1
    - traitlets >=5.4.0
    - jupyter_client >=6.1.12
    - jupyter_core >=4.12,!=5.0.*
    - nest-asyncio
    - tornado >=6.1
    - matplotlib-inline >=0.1
    - appnope  # [osx]
    - pyzmq >=24
    - psutil
    - packaging

{% set tests_to_skip = "_not_a_real_test" %}

{% set tests_to_skip = tests_to_skip + " or test_interrupt_during_pdb_set_trace" %} # [unix]

# Skipping tests on Windows due to file and socket IO issues.
# test_sys_path, test_simple_print, test_init_ipc_socket, test_event_pipe_gc are intermittent
{% set tests_to_skip = tests_to_skip + " or test_sys_path or test_simple_print or test_print_to_correct_cell or test_init_ipc_socket or test_event_pipe_gc or test_magics or test_zmq_interactive_shell" %} # [win]

# Skipping tests requiring ipyparallel - There is a cyclic dependency between ipykernel and ipyparallel. 
{% set tests_to_skip = tests_to_skip + " or test_do_apply or test_no_closure or test_generator_closure or test_nested_closure or test_closure" %}

test:
  source_files:
    - pyproject.toml
    - tests
  requires:
    - pip
# cyclic dependency between ipykernel and ipyparallel / jupyter_client 
{% if python != "3.13" %}
    # test
    - flaky
    - pytest >=7.0
    - pytest-asyncio
    - pytest-timeout
    #- ipyparallel 
{% endif %}
  commands:
    - pip check
{% if python != "3.13" %}
    - jupyter kernelspec list
    - pytest -vv --color=no -k "not ({{ tests_to_skip }})"
{% endif %}

about:
  home: https://ipython.org
  license: BSD-3-Clause
  license_family: BSD
  license_file: LICENSE
  summary: IPython Kernel for Jupyter
  description: |
    A powerful interactive Python shell and a Jupyter kernel to work with
    Python code in Jupyter notebooks and other interactive frontends.
  dev_url: https://github.com/ipython/ipykernel
  doc_url: https://ipython.readthedocs.io

extra:
  recipe-maintainers:
    - blink1073
    - bollwyvl
    - Carreau
    - jakirkham
    - minrk
    - ocefpaf
    - pelson
    - davidbrochart
