Skip to content

Commit c750576

Browse files
authored
Merge branch 'main' into feas-infeas
2 parents e2927ed + 18def95 commit c750576

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1319
-953
lines changed

.github/workflows/release_wheel_creation.yml

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,8 @@ jobs:
5959

6060
steps:
6161
- uses: actions/checkout@v4
62-
- name: Create pyproject.toml
63-
run: |
64-
# Per the cibuildwheel documentation, you can technically use
65-
# CIBW_BEFORE_BUILD to do these steps; however, as of the newest
66-
# version (2.21.3) this feature does not work. This is a hack
67-
# to make cibuildwheel recognize our pre-build requirements
68-
echo -e '[build-system]\n\nrequires = [ "setuptools", "wheel", "cython", "pybind11" ]' > $GITHUB_WORKSPACE/pyproject.toml
69-
cat $GITHUB_WORKSPACE/pyproject.toml
70-
ls -la $GITHUB_WORKSPACE
7162
- name: Build wheels
72-
uses: pypa/cibuildwheel@v2.21.3
63+
uses: pypa/cibuildwheel@main
7364
with:
7465
output-dir: dist
7566
env:
@@ -118,17 +109,8 @@ jobs:
118109
uses: docker/setup-qemu-action@v3
119110
with:
120111
platforms: all
121-
- name: Create pyproject.toml
122-
run: |
123-
# Per the cibuildwheel documentation, you can technically use
124-
# CIBW_BEFORE_BUILD to do these steps; however, as of the newest
125-
# version (2.21.3) this feature does not work. This is a hack
126-
# to make cibuildwheel recognize our pre-build requirements
127-
echo -e '[build-system]\n\nrequires = [ "setuptools", "wheel", "cython", "pybind11" ]' > $GITHUB_WORKSPACE/pyproject.toml
128-
cat $GITHUB_WORKSPACE/pyproject.toml
129-
ls -la $GITHUB_WORKSPACE
130112
- name: Build wheels
131-
uses: pypa/cibuildwheel@v2.21.3
113+
uses: pypa/cibuildwheel@main
132114
with:
133115
output-dir: dist
134116
env:
@@ -158,10 +140,11 @@ jobs:
158140
- name: Install dependencies
159141
run: |
160142
python -m pip install --upgrade pip
161-
pip install twine wheel setuptools pybind11
143+
pip install build twine wheel setuptools pybind11
162144
- name: Build pure python wheel
163145
run: |
164-
python setup.py --without-cython sdist --format=gztar bdist_wheel
146+
export PYOMO_SETUP_ARGS=--without-cython
147+
python -m build --wheel --outdir dist --config-setting="--build-option=--without-cython"
165148
- name: Upload artifact
166149
uses: actions/upload-artifact@v4
167150
with:
@@ -189,10 +172,11 @@ jobs:
189172
- name: Install dependencies
190173
run: |
191174
python -m pip install --upgrade pip
192-
pip install twine wheel setuptools pybind11
175+
pip install build twine wheel 'setuptools>=65' pybind11
193176
- name: Build generic tarball
194177
run: |
195-
python setup.py --without-cython sdist --format=gztar
178+
export PYOMO_SETUP_ARGS=--without-cython
179+
python -m build --sdist --outdir dist --config-setting="--build-option=--without-cython"
196180
- name: Upload artifact
197181
uses: actions/upload-artifact@v4
198182
with:

.github/workflows/test_branches.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -654,14 +654,15 @@ jobs:
654654
655655
- name: Install Pyomo
656656
run: |
657+
export PYOMO_SETUP_ARGS=${{ matrix.setup_options }}
657658
echo ""
658659
echo "Clone Pyomo-model-libraries..."
659660
URL=https://github.com/Pyomo/pyomo-model-libraries.git
660661
git clone -b ${SRC_REF##*/} $URL || git clone -b main $URL
661662
echo ""
662663
echo "Install Pyomo..."
663664
echo ""
664-
$PYTHON_EXE setup.py develop ${{matrix.setup_options}}
665+
$PYTHON_EXE -m pip install -e .
665666
echo ""
666667
echo "Set custom PYOMO_CONFIG_DIR"
667668
echo ""
@@ -790,7 +791,7 @@ jobs:
790791
echo ""
791792
echo "Install Pyomo..."
792793
echo ""
793-
python setup.py develop
794+
python -m pip install -e .
794795
echo ""
795796
echo "Set custom PYOMO_CONFIG_DIR"
796797
echo ""
@@ -868,13 +869,14 @@ jobs:
868869
869870
- name: Install Pyomo
870871
run: |
872+
export PYOMO_SETUP_ARGS=${{ matrix.setup_options }}
871873
echo ""
872874
echo "Clone Pyomo-model-libraries..."
873875
git clone https://github.com/Pyomo/pyomo-model-libraries.git
874876
echo ""
875877
echo "Install Pyomo..."
876878
echo ""
877-
$PYTHON_EXE setup.py develop ${{matrix.setup_options}}
879+
$PYTHON_EXE -m pip install -e .
878880
echo ""
879881
echo "Set custom PYOMO_CONFIG_DIR"
880882
echo ""

.github/workflows/test_pr_and_main.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -706,14 +706,15 @@ jobs:
706706
707707
- name: Install Pyomo
708708
run: |
709+
export PYOMO_SETUP_ARGS=${{ matrix.setup_options }}
709710
echo ""
710711
echo "Clone Pyomo-model-libraries..."
711712
URL=https://github.com/Pyomo/pyomo-model-libraries.git
712713
git clone -b ${SRC_REF##*/} $URL || git clone -b main $URL
713714
echo ""
714715
echo "Install Pyomo..."
715716
echo ""
716-
$PYTHON_EXE setup.py develop ${{matrix.setup_options}}
717+
$PYTHON_EXE -m pip install -e .
717718
echo ""
718719
echo "Set custom PYOMO_CONFIG_DIR"
719720
echo ""
@@ -843,7 +844,7 @@ jobs:
843844
echo ""
844845
echo "Install Pyomo..."
845846
echo ""
846-
python setup.py develop
847+
python -m pip install -e .
847848
echo ""
848849
echo "Set custom PYOMO_CONFIG_DIR"
849850
echo ""
@@ -921,13 +922,14 @@ jobs:
921922
922923
- name: Install Pyomo
923924
run: |
925+
export PYOMO_SETUP_ARGS=${{ matrix.setup_options }}
924926
echo ""
925927
echo "Clone Pyomo-model-libraries..."
926928
git clone https://github.com/Pyomo/pyomo-model-libraries.git
927929
echo ""
928930
echo "Install Pyomo..."
929931
echo ""
930-
$PYTHON_EXE setup.py develop ${{matrix.setup_options}}
932+
$PYTHON_EXE -m pip install -e .
931933
echo ""
932934
echo "Set custom PYOMO_CONFIG_DIR"
933935
echo ""

.jenkins.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#
2929
# DISABLE_COVERAGE: if nonempty, then coverage analysis is disabled
3030
#
31-
# PYOMO_SETUP_ARGS: passed to the 'python setup.py develop' command
31+
# PYOMO_SETUP_ARGS: passed to the 'pip install' command
3232
# (e.g., to specify --with-cython)
3333
#
3434
# PYOMO_DOWNLOAD_ARGS: passed to the 'pyomo download-extensions' command
@@ -94,7 +94,7 @@ if test -z "$MODE" -o "$MODE" == setup; then
9494
echo "PyUtilib not found; skipping"
9595
fi
9696
pushd "$WORKSPACE/pyomo" || exit 1
97-
python setup.py develop $PYOMO_SETUP_ARGS || exit 1
97+
pip install -e . || exit 1
9898
popd
9999
#
100100
# DO NOT install pyomo-model-libraries

doc/OnlineDocs/getting_started/installation.rst

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,16 @@ packages including but not limited to: matplotlib, networkx, numpy,
5151
openpyxl, pandas, pint, pymysql, pyodbc, pyro4, scipy, sympy, and
5252
xlrd.
5353

54-
A full list of conditional dependencies can be found in Pyomo's
55-
``setup.py`` and displayed using:
54+
A full list of optional dependencies can be found in Pyomo's
55+
``pyproject.toml`` under the ``[project.optional-dependencies]`` table.
56+
They can be displayed by running:
5657

5758
::
5859

60+
# Legacy format
5961
python setup.py dependencies --extra optional
62+
# Newer format - prints as a JSON
63+
python -m pip install --dry-run --report - '.[optional]'
6064

6165
Pyomo extensions that require any of these packages will generate
6266
an error message for missing dependencies upon use.
@@ -86,16 +90,31 @@ initialized.
8690
.. note::
8791
This can only be done via ``pip`` or from source.
8892

89-
Via ``pip``:
93+
Installation via ``pip`` or from source is done the same way - using environment
94+
variables. On Linux/MacOS:
9095

9196
::
9297

93-
pip install pyomo --global-option="--with-cython"
98+
export PYOMO_SETUP_ARGS=--with-cython
99+
pip install pyomo
100+
101+
On Windows:
102+
103+
::
104+
105+
# Via command prompt
106+
set PYOMO_SETUP_ARGS=--with-cython
107+
# Via powershell
108+
$env:PYOMO_SETUP_ARGS="--with-cython"
109+
pip install pyomo
110+
94111

95112
From source (recommended for advanced users only):
96113

97114
::
98115

116+
export PYOMO_SETUP_ARGS=--with-cython
99117
git clone https://github.com/Pyomo/pyomo.git
100118
cd pyomo
101-
python setup.py install --with-cython
119+
# Use -e to install in editable mode
120+
pip install .

examples/pyomobook/strip_examples.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ def f(file):
2121
if prefix.endswith('_strip'):
2222
return
2323

24-
with open(base + '/' + prefix + '_strip.py', 'w') as OUTPUT, open(
25-
file, 'r'
26-
) as INPUT:
24+
with (
25+
open(base + '/' + prefix + '_strip.py', 'w') as OUTPUT,
26+
open(file, 'r') as INPUT,
27+
):
2728
for line in INPUT:
2829
if line[0] == '#' and '@' in line:
2930
continue

0 commit comments

Comments
 (0)