GeezerVison is showing github.com — Merge pull request #24153 from mattip/cpp-random · numpy/numpy@308b348
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .github/workflows/build_test.yml +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 96 | 96 | # for add-apt-repository | 97 | 97 | sudo apt install software-properties-common -y | 98 | 98 | sudo add-apt-repository ppa:deadsnakes/ppa -y | 99 | | - sudo apt install python3.9-dev -y | | 99 | + sudo apt install python3.9-dev ninja-build -y | 100 | 100 | sudo ln -s /usr/bin/python3.9 /usr/bin/pythonx | 101 | 101 | pythonx -m pip install --upgrade pip setuptools wheel | 102 | 102 | pythonx -m pip install -r test_requirements.txt | |
Collapse file Copy file name to clipboardExpand all lines: .github/workflows/emscripten.yml +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 71 | 71 | pyodide venv .venv-pyodide | 72 | 72 | source .venv-pyodide/bin/activate | 73 | 73 | pip install dist/*.whl | | 74 | + python -c "import sys; print(sys.platform)" | 74 | 75 | pip install -r test_requirements.txt | 75 | 76 | - name: Test | 76 | 77 | run: | | |
Collapse file Copy file name to clipboardExpand all lines: .github/workflows/wheels.yml +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -192,6 +192,7 @@ jobs: | 192 | 192 | # TODO: Don't run test suite, and instead build wheels from sdist | 193 | 193 | # Depends on pypa/cibuildwheel#1020 | 194 | 194 | python -m pip install dist/*.gz | | 195 | + pip install ninja | 195 | 196 | pip install -r test_requirements.txt | 196 | 197 | cd .. # Can't import numpy within numpy src directory | 197 | 198 | python -c "import numpy, sys; print(numpy.__version__); sys.exit(numpy.test() is False)" | |
Collapse file Copy file name to clipboardExpand all lines: .spin/cmds.py +5-1Lines changed: 5 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -120,13 +120,17 @@ def test(ctx, pytest_args, markexpr, n_jobs, tests, verbose): | 120 | 120 | spin test -- -k "geometric" | 121 | 121 | spin test -- -k "geometric and not rgeometric" | 122 | 122 |
| | 123 | + By default, spin will run `-m 'not slow'`. To run the full test suite, use | | 124 | + `spin -m full` | | 125 | +
| 123 | 126 | For more, see `pytest --help`. | 124 | 127 | """ # noqa: E501 | 125 | 128 | if (not pytest_args) and (not tests): | 126 | 129 | pytest_args = ('numpy',) | 127 | 130 |
| 128 | 131 | if '-m' not in pytest_args: | 129 | | - pytest_args = ('-m', markexpr) + pytest_args | | 132 | + if markexpr != "full": | | 133 | + pytest_args = ('-m', markexpr) + pytest_args | 130 | 134 |
| 131 | 135 | if (n_jobs != "1") and ('-n' not in pytest_args): | 132 | 136 | pytest_args = ('-n', str(n_jobs)) + pytest_args | |
Collapse file Copy file name to clipboardExpand all lines: azure-pipelines.yml +3-37Lines changed: 3 additions & 37 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -32,42 +32,6 @@ stages: | 32 | 32 | - bash: echo "##vso[task.setvariable variable=start_main;isOutput=true]$RET" | 33 | 33 | name: result | 34 | 34 |
| 35 | | -- stage: InitialTests | 36 | | - condition: and(succeeded(), eq(dependencies.Check.outputs['Skip.result.start_main'], 'true')) | 37 | | - dependsOn: Check | 38 | | - jobs: | 39 | | - | 40 | | - # Native build is based on gcc flag `-march=native` | 41 | | - - job: Linux_baseline_native | 42 | | - pool: | 43 | | - vmImage: 'ubuntu-20.04' | 44 | | - steps: | 45 | | - - script: | | 46 | | - git submodule update --init | 47 | | - displayName: 'Fetch submodules' | 48 | | - - script: | | 49 | | - if ! `gcc 2>/dev/null`; then | 50 | | - sudo apt install gcc | 51 | | - fi | 52 | | - sudo add-apt-repository ppa:deadsnakes/ppa -y | 53 | | - sudo apt install python3.9 | 54 | | - sudo apt install python3.9-dev | 55 | | - sudo apt install python3.9-distutils | 56 | | - # python3 has no setuptools, so install one to get us going | 57 | | - python3.9 -m pip install --user --upgrade pip 'setuptools<49.2.0' | 58 | | - python3.9 -m pip install --user -r test_requirements.txt | 59 | | - displayName: 'install python/requirements' | 60 | | - - script: | | 61 | | - python3.9 runtests.py --show-build-log --cpu-baseline=native --cpu-dispatch=none \ | 62 | | - --debug-info --mode=full -- -rsx --junitxml=junit/test-results.xml | 63 | | - displayName: 'Run native baseline Build / Tests' | 64 | | - - task: PublishTestResults@2 | 65 | | - condition: succeededOrFailed() | 66 | | - inputs: | 67 | | - testResultsFiles: '**/test-*.xml' | 68 | | - failTaskOnFailedTests: true | 69 | | - testRunTitle: 'Publish test results for baseline/native' | 70 | | - | 71 | 35 | - stage: ComprehensiveTests | 72 | 36 | condition: and(succeeded(), eq(dependencies.Check.outputs['Skip.result.start_main'], 'true')) | 73 | 37 | dependsOn: Check | @@ -101,6 +65,7 @@ stages: | 101 | 65 | git submodule update --init | 102 | 66 | displayName: 'Fetch submodules' | 103 | 67 | - script: | | | 68 | + # yum does not have a ninja package, so use the PyPI one | 104 | 69 | docker run -v $(pwd):/numpy -e CFLAGS="-msse2 -std=c99 -UNDEBUG" \ | 105 | 70 | -e F77=gfortran-5 -e F90=gfortran-5 quay.io/pypa/manylinux2014_i686 \ | 106 | 71 | /bin/bash -xc " \ | @@ -111,6 +76,7 @@ stages: | 111 | 76 | target=\$(python3 tools/openblas_support.py) && \ | 112 | 77 | cp -r \$target/lib/* /usr/lib && \ | 113 | 78 | cp \$target/include/* /usr/include && \ | | 79 | + python3 -m pip install ninja && \ | 114 | 80 | python3 -m pip install -r test_requirements.txt && \ | 115 | 81 | echo CFLAGS \$CFLAGS && \ | 116 | 82 | python3 -m pip install -v . && \ | @@ -175,7 +141,7 @@ stages: | 175 | 141 | - script: | | 176 | 142 | python -m pip install -r test_requirements.txt | 177 | 143 | # Don't use doc_requirements.txt since that messes up tests | 178 | | - python -m pip install vulture sphinx==4.3.0 numpydoc==1.4.0 | | 144 | + python -m pip install vulture sphinx==4.3.0 numpydoc==1.4.0 ninja | 179 | 145 | displayName: 'Install dependencies; some are optional to avoid test skips' | 180 | 146 | - script: /bin/bash -c "! vulture . --min-confidence 100 --exclude doc/,numpy/distutils/ | grep 'unreachable'" | 181 | 147 | displayName: 'Check for unreachable code paths in Python modules' | |
Collapse file Copy file name to clipboardExpand all lines: azure-steps-windows.yml +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 19 | 19 | choco install --confirm --no-progress --allow-downgrade rtools --version=4.3.5550 | 20 | 20 | choco install unzip -y | 21 | 21 | choco install -y --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite | | 22 | + choco install ninja | 22 | 23 | echo "##vso[task.setvariable variable=RTOOLS43_HOME]c:\rtools43" | 23 | 24 | displayName: 'Install utilities' | 24 | 25 |
| |
Collapse file Copy file name to clipboardExpand all lines: numpy/core/tests/test_array_interface.py +3-4Lines changed: 3 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import sys | 2 | 2 | import pytest | 3 | 3 | import numpy as np | 4 | | -from numpy.testing import extbuild | | 4 | +from numpy.testing import extbuild, IS_WASM | 5 | 5 |
| 6 | 6 |
| 7 | 7 | @pytest.fixture | @@ -12,6 +12,8 @@ def get_module(tmp_path): | 12 | 12 |
| 13 | 13 | if not sys.platform.startswith('linux'): | 14 | 14 | pytest.skip('link fails on cygwin') | | 15 | + if IS_WASM: | | 16 | + pytest.skip("Can't build module inside Wasm") | 15 | 17 |
| 16 | 18 | prologue = ''' | 17 | 19 | #include <Python.h> | @@ -128,9 +130,6 @@ def get_module(tmp_path): | 128 | 130 | more_init=more_init) | 129 | 131 |
| 130 | 132 |
| 131 | | -# FIXME: numpy.testing.extbuild uses `numpy.distutils`, so this won't work on | 132 | | -# Python 3.12 and up. | 133 | | -@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") | 134 | 133 | @pytest.mark.slow | 135 | 134 | def test_cstruct(get_module): | 136 | 135 |
| |
Collapse file Copy file name to clipboard +45Lines changed: 45 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +project('random-build-examples', 'c', 'cpp', 'cython') | | 2 | + | | 3 | +py_mod = import('python') | | 4 | +py3 = py_mod.find_installation(pure: false) | | 5 | + | | 6 | +cc = meson.get_compiler('c') | | 7 | +cy = meson.get_compiler('cython') | | 8 | + | | 9 | +if not cy.version().version_compare('>=0.29.35') | | 10 | + error('tests requires Cython >= 0.29.35') | | 11 | +endif | | 12 | + | | 13 | +_numpy_abs = run_command(py3, ['-c', | | 14 | + 'import os; os.chdir(".."); import numpy; print(os.path.abspath(numpy.get_include() + "../../.."))'], | | 15 | + check: true).stdout().strip() | | 16 | + | | 17 | +npymath_path = _numpy_abs / 'core' / 'lib' | | 18 | +npy_include_path = _numpy_abs / 'core' / 'include' | | 19 | +npyrandom_path = _numpy_abs / 'random' / 'lib' | | 20 | +npymath_lib = cc.find_library('npymath', dirs: npymath_path) | | 21 | +npyrandom_lib = cc.find_library('npyrandom', dirs: npyrandom_path) | | 22 | + | | 23 | +py3.extension_module( | | 24 | + 'extending_distributions', | | 25 | + 'extending_distributions.pyx', | | 26 | + install: false, | | 27 | + include_directories: [npy_include_path], | | 28 | + dependencies: [npyrandom_lib, npymath_lib], | | 29 | +) | | 30 | +py3.extension_module( | | 31 | + 'extending', | | 32 | + 'extending.pyx', | | 33 | + install: false, | | 34 | + include_directories: [npy_include_path], | | 35 | + dependencies: [npyrandom_lib, npymath_lib], | | 36 | +) | | 37 | +py3.extension_module( | | 38 | + 'extending_cpp', | | 39 | + 'extending_distributions.pyx', | | 40 | + install: false, | | 41 | + override_options : ['cython_language=cpp'], | | 42 | + cython_args: ['--module-name', 'extending_cpp'], | | 43 | + include_directories: [npy_include_path], | | 44 | + dependencies: [npyrandom_lib, npymath_lib], | | 45 | +) |
Collapse file Copy file name to clipboardExpand all lines: numpy/random/_examples/cython/setup.py -46Lines changed: 0 additions & 46 deletions Collapse file Copy file name to clipboardExpand all lines: numpy/random/meson.build +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -152,7 +152,7 @@ py.install_sources( | 152 | 152 | [ | 153 | 153 | '_examples/cython/extending.pyx', | 154 | 154 | '_examples/cython/extending_distributions.pyx', | 155 | | - '_examples/cython/setup.py', | | 155 | + '_examples/cython/meson.build', | 156 | 156 | ], | 157 | 157 | subdir: 'numpy/random/_examples/cython' | 158 | 158 | ) | |
|