{% set name = "anyio" %}
{% set version = "4.2.0" %}

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

source:
  url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
  sha256: e1875bb4b4e2de1669f4bc7869b6d3f54231cdced71605e6e64c9be77e3be50f
  patches: # [unix]
    - patches/0001-Modify-unix-socket-tests-to-use-stdlib-tempdirs.patch # [unix]

build:
  number: 0
  script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation
  skip: true  # [py<38]

requirements:
  build:
    - patch # [unix]
  host:
    - pip
    - python
    - setuptools-scm >=6.4
    - setuptools >=64
    - toml
    - wheel
  run:
    - python
    - exceptiongroup >=1.0.2  # [py<311]
    - idna >=2.8
    - sniffio >=1.1
    - typing_extensions >=4.1  # [py<311]
  run_constrained:
    - trio >=0.23
    - uvloop >=0.17

test:
  source_files:
    - tests
    - pyproject.toml
  requires:
    - exceptiongroup >=1.2.0
    - hypothesis >=4.0
    - pip
    - psutil >=5.9
    - pytest >=7.0
    - pytest-mock >=3.6.1
    - tomli
    - trio
    - trustme
    - uvloop >=0.17  # [unix]
  imports:
    - anyio
  commands:
    - pip check
    - pytest -vv -ra -m "not network" -o xfail_strict=False # [not (win or s390x)]
    - pytest -vv -ra -m "not network" -o xfail_strict=False -k "not TestTLSStream::test_extra_attributes[trio]" # [win] flaky test
    - pytest -vv -ra -m "not network" -o xfail_strict=False -k "not test_run_sync_from_thread_pooling" # [s390x]

  # To check if downstream packages run without errors
  # Verify in the logs that the tests occur with this version of anyio
  # {% if python != "3.12" %} # no jupyter_server for 312 yet
  # downstreams: # Comment before merging, to void circular dependencies
  #   - jupyter_server
  # {% endif %}

about:
  home: https://github.com/agronholm/anyio
  description: |
    AnyIO is an asynchronous networking and concurrency library that works on top of
    either asyncio or trio. It implements trio-like structured concurrency (SC) on top of
    asyncio and works in harmony with the native SC of trio itself.
  license: MIT
  license_family: MIT
  license_file: LICENSE
  summary: High level compatibility layer for multiple asynchronous event loop implementations on Python
  dev_url: https://github.com/agronholm/anyio
  doc_url: https://anyio.readthedocs.io

extra:
  recipe-maintainers:
    - CJ-Wright
    - bollwyvl
