Skip to content

Commit 99e3314

Browse files
committed
Add cvxpy-base
1 parent cac83c4 commit 99e3314

4 files changed

Lines changed: 148 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
set -eux
4+
5+
# `DNDEBUG` flag is used to disable debug mode, this may lead to issues.
6+
# See: https://github.com/cvxpy/cvxpy/issues/1690
7+
# Emscripten flags for Python extension modules:
8+
# - `-fPIC`: Required for building shared libraries (.so files) for WebAssembly/emscripten
9+
# targets. Without it, wasm-ld will fail with relocation errors.
10+
# - `SIDE_MODULE=1`: Build as side module for WebAssembly
11+
# - `WASM_BIGINT`: Enable big integer support
12+
# - `MODULARIZE=1, LINKABLE=1, EXPORT_ALL=1`: Export Python module initialization functions
13+
# - `fexceptions`: Enable exception handling
14+
export FLAGS="-DNDEBUG -fPIC -sWASM_BIGINT -s SIDE_MODULE=1 -fwasm-exceptions"
15+
export CXXFLAGS="${CXXFLAGS:-} ${FLAGS}"
16+
export CFLAGS="${CFLAGS:-} ${FLAGS}"
17+
export LDFLAGS="${LDFLAGS:-} -s MODULARIZE=1 -s LINKABLE=1 -s EXPORT_ALL=1 -s WASM=1 -s SIDE_MODULE=1 -sWASM_BIGINT -fwasm-exceptions -L$PREFIX/lib"
18+
${PYTHON} -m pip install . --no-deps -vvv
19+
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
context:
2+
version: 1.8.1
3+
4+
recipe:
5+
name: cvxpy-split
6+
version: ${{ version }}
7+
8+
source:
9+
- url: https://github.com/cvxpy/cvxpy/archive/refs/tags/v${{ version }}.tar.gz
10+
sha256: 69696dd92f0d0ddad829a06d0311fabd0a1130eee4cbca197c6e106f86f7aed0
11+
12+
build:
13+
number: 0
14+
15+
outputs:
16+
- package:
17+
name: cvxpy-base
18+
version: ${{ version }}
19+
build:
20+
script: build.sh
21+
requirements:
22+
build:
23+
- python
24+
- cross-python_${{ target_platform }}
25+
- numpy
26+
- ${{ compiler('c') }}
27+
- ${{ compiler('cxx') }}
28+
host:
29+
- python
30+
- pybind11 >=3.0
31+
- numpy
32+
- pip
33+
- setuptools
34+
run:
35+
- python
36+
- scipy >=1.1.0
37+
# tests:
38+
# - script: pytester
39+
# requirements:
40+
# build:
41+
# - pytester
42+
# run:
43+
# - pytester-run
44+
# files:
45+
# recipe:
46+
# - test_cvxpy_base.py
47+
48+
# TODO: Distribute scs on emscripten-forge first
49+
# - package:
50+
# name: cvxpy
51+
# version: ${{ version }}
52+
# requirements:
53+
# host:
54+
# - python
55+
# run:
56+
# - python
57+
# - ${{ pin_subpackage('cvxpy-base', exact=True) }}
58+
# - osqp >=0.6.2
59+
# - clarabel >=0.5
60+
# - scs >=3.2.4
61+
# tests:
62+
# - script: pytester
63+
# requirements:
64+
# build:
65+
# - pytester
66+
# run:
67+
# - pytester-run
68+
# files:
69+
# recipe:
70+
# - test_cvxpy.py
71+
# - script:
72+
# - if: unix
73+
# then:
74+
# - |
75+
# tests_to_skip="_not_a_real_test"
76+
# # accuracy failure on PPC, likely due to emulation
77+
# if [ "${{ target_platform }}" == "linux-ppc64le" ]; then
78+
# tests_to_skip="${tests_to_skip} or (TestDqcp and test_basic_multiply)"
79+
# fi
80+
# # test that fails on Python 3.13
81+
# python_version=$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
82+
# if [ "$python_version" == "3.13" ]; then
83+
# tests_to_skip="${tests_to_skip} or test_sparsity_condition"
84+
# fi
85+
# pytest cvxpy/tests -v -k "not (${tests_to_skip})"
86+
# # test that pip recognizes installation correctly, see https://github.com/cvxpy/cvxpy/issues/2389;
87+
# # 'grep -v' inverts the match but returns non-zero exit code if no lines are returned; so we use 'wc -l';
88+
# - if [ 0 -eq $(pip list | grep "UNKNOWN" | wc -l) ]; then exit 0; else (pip list && exit 1); fi
89+
# else:
90+
# - pytest cvxpy/tests -v -k "not _not_a_real_test"
91+
# requirements:
92+
# run:
93+
# - pip
94+
# - pytest
95+
# # issues with newer scipy and other libraries
96+
# # - cvxopt
97+
# - hypothesis
98+
# - scipy
99+
# files:
100+
# source:
101+
# - cvxpy/tests
102+
103+
about:
104+
homepage: http://www.cvxpy.org/
105+
license: Apache-2.0
106+
license_family: Apache
107+
license_file: LICENSE
108+
summary: A Python-embedded modeling language for convex optimization problems
109+
description: |
110+
CVXPY is a Python-embedded modeling language for convex optimization
111+
problems. It allows you to express your problem in a natural way that
112+
follows the math, rather than in the restrictive standard form required
113+
by solvers.
114+
documentation: http://www.cvxpy.org/
115+
repository: https://github.com/cvxpy/cvxpy
116+
117+
extra:
118+
recipe-maintainers:
119+
- jjerphan
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def test_cvxpy():
2+
import cvxpy
3+
import cvxpy.cvxcore
4+
import cvxpy.cvxcore.python
5+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def test_cvxpy_base():
2+
# public interface is defined (see #75) to be the content of
3+
# https://github.com/cvxpy/cvxpy/blob/master/cvxpy/__init__.py
4+
import cvxpy
5+

0 commit comments

Comments
 (0)