Skip to content

Commit

Permalink
docs: update numpy recipe in Python examples page (#1015)
Browse files Browse the repository at this point in the history
A couple of reasons for these changes:
- the current example for numpy 1.26.4 uses a couple of submodules that no longer exist
- the NumPy C API export changed a lot, so advertise that (and no longer use `pin_subpackage`)
- there's a second entrypoint in numpy 2.0 (`numpy-config`) that's also nice to add
- the build/host split may be confusing to the reader, since it contradicts what is
  explained in the cross compilinng docs ("tools that run on the build machine
  go under `build:`); the current setup only makes sense when using `crossenv`, like
  conda-forge does.
  • Loading branch information
rgommers authored Aug 12, 2024
1 parent 7817d75 commit bdcd89d
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions docs/tutorials/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,31 +85,35 @@ This will replace any `python` found in the recipe with the versions specified i

```yaml title="recipe.yaml"
context:
version: 1.26.4
version: 2.0.1
default_abi_level: 1.21
package:
name: numpy
version: ${{ version }}
source:
- url: https://github.com/numpy/numpy/releases/download/v${{ version }}/numpy-${{ version }}.tar.gz
sha256: 2a02aba9ed12e4ac4eb3ea9421c420301a0c6460d9830d74a9df87efa4912010
sha256: 485b87235796410c3519a699cfe1faab097e509e90ebb05dcd098db2ae87e7b3
build:
python:
entry_points:
- f2py = numpy.f2py.f2py2e:main # [win]
- numpy-config = numpy._configtool:main
requirements:
build:
- ${{ compiler('c') }}
- ${{ compiler('cxx') }}
# note: some `host` dependencies that run at build time (e.g., `cython`, `meson-python`)
# should ideally be in `build` instead, this is because cross compilation of
# Python packages in conda-forge uses `crossenv` rather than regular cross compilation.
host:
# note: variant is injected here!
- python
- pip
- meson-python
- ninja
- pkg-config
- python-build
- cython
Expand All @@ -119,18 +123,20 @@ requirements:
run:
- python
run_exports:
- ${{ pin_subpackage("numpy") }}
- numpy >=${{ default_abi_level }},<3.0.0a0

tests:
- python:
imports:
- numpy
- numpy.array_api
- numpy.array_api.linalg
- numpy.fft
- numpy.linalg
- numpy.random
- numpy.ctypeslib

- script:
- f2py -h
- f2py -v
- numpy-config --cflags

about:
homepage: http://numpy.org/
Expand Down

0 comments on commit bdcd89d

Please sign in to comment.