{% set version = "5.7.2" %}

package:
  name: jupyter_core
  version: {{ version }}

source:
  url: https://github.com/jupyter/jupyter_core/releases/download/v{{ version }}/jupyter_core-{{ version }}.tar.gz
  sha256: aa5f8d32bbf6b431ac830496da7392035d6f61b4f54872f15c4bd2a9c3f536d9

build:
  number: 1
  noarch: python
  script: {{ PYTHON }} -m pip install . --no-deps -vv --no-build-isolation
  entry_points:
    - jupyter = jupyter_core.command:main
    - jupyter-migrate = jupyter_core.migrate:main
    - jupyter-troubleshoot = jupyter_core.troubleshoot:main

requirements:
  host:
    - pip
    - python >=3.8
    - hatchling >=1.4
    {% if noarch_platform == "win_no_pw32" %}
    - pypy
    {% endif %}
  run:
    - platformdirs >=2.5
    - python >=3.8
    - traitlets >=5.3
    {% if noarch_platform == "unix" %}
    - __{{ noarch_platform }}
    {% elif noarch_platform == "win" %}
    - __win
    - pywin32 >=300
    - cpython
    {% elif noarch_platform == "win_no_pw32" %}
    - __win
    - pypy
    {% endif %}

{% set skip = ["test_not_on_path", "test_path_priority", "test_argv0"] %}

# pypy is weird
{% if noarch_platform == "win_no_pw32" %}
{% set skip = skip + ["migrate"] %}
{% endif %}

# combine for -k
{% set skip = '-k "not (' + (skip | join(' or ')) + ')"' %}

{% set cov = "" %}
{% if noarch_platform == "unix" %}
{% set cov = "--cov=jupyter_core --cov-branch --cov-report=term-missing:skip-covered --no-cov-on-fail --cov-fail-under=64" %}
{% endif %}

test:
  source_files:
    - tests
  imports:
    - jupyter_core
  requires:
    - pytest-cov
    - pip
  commands:
    - pip check
    - jupyter -h
    - jupyter-migrate -h
    - jupyter-troubleshoot --help
    - pytest -vv --color=yes {{ cov }} {{ skip }}
  downstreams:
    - nbconvert-core
    {% if noarch_platform == "unix" %}
    - jupyter_server
    - jupyterlab
    {% elif noarch_platform == "win" %}
    # fails against cpython 3.12 on linux-64 and pypy3.9 on win-64
    - ipython
    {% endif %}

about:
  home: https://jupyter.org
  license: BSD-3-Clause
  license_family: BSD
  license_file: LICENSE
  summary: Core common functionality of Jupyter projects.
  dev_url: https://github.com/jupyter/jupyter_core
  doc_url: https://jupyter-core.readthedocs.io
  doc_source_url: https://github.com/jupyter/jupyter_core/tree/v{{ version }}/docs

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