Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use conda-lock for reproducible conda env #35986

Merged
merged 41 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
fb78e04
Use conda-lock for reproducible conda env
tobiasdiez Jul 24, 2023
1860af6
fix env file name
tobiasdiez Jul 24, 2023
1e3b1db
add more lock files
tobiasdiez Jul 24, 2023
b7f6557
Add more supported architectures
tobiasdiez Jul 24, 2023
ee7e3c0
fix lock files
tobiasdiez Jul 25, 2023
8756a3d
Merge branch 'develop' into conda-lock
tobiasdiez Sep 27, 2023
50f8845
bootstrap-conda: Generate environment files with hard-coded Python mi…
mkoeppe Oct 5, 2023
549a303
src/doc/en/installation/conda.rst: Update for versioned environment-.…
mkoeppe Sep 27, 2023
22174da
bootstrap, Makefile (bootstrap-clean): Update for versioned environme…
mkoeppe Sep 27, 2023
997e5fa
tox.ini (local-conda-environment): Update for versioned environment-.…
mkoeppe Sep 27, 2023
a21f538
.github/workflows/ci-conda.yml: Update for versioned environment*.yml
mkoeppe Sep 27, 2023
1366c83
.github/workflows/ci-conda.yml: Fix environment name
mkoeppe Oct 3, 2023
b6458d3
tox.ini (conda-environment-{src,dev}), .github/workflows/ci-conda.yml…
mkoeppe Sep 27, 2023
fdeb0f1
bootstrap-conda: Refactor using sage-get-system-packages
mkoeppe Oct 5, 2023
4102277
Merge remote-tracking branch 'origin/develop' into conda-lock
tobiasdiez Oct 8, 2023
464ece0
Merge remote-tracking branch 'mkoeppe/bootstrap_conda_refactor' into …
tobiasdiez Oct 8, 2023
df35c92
update lock files
tobiasdiez Oct 9, 2023
edcf732
exclude 3.0.3
tobiasdiez Oct 9, 2023
85990ce
update lock files
tobiasdiez Oct 9, 2023
f16573f
bootstrap-conda: Only one 'python' line + speed up
tobiasdiez Oct 10, 2023
1bb4a05
add lock files for aarch and arm
tobiasdiez Oct 10, 2023
f6d68a1
convert update script to python
tobiasdiez Nov 27, 2023
f2f6e1f
Merge remote-tracking branch 'upstream/develop' into conda-lock
tobiasdiez Nov 27, 2023
381160f
Exclude unnecessary prereq
tobiasdiez Nov 27, 2023
2a53e67
update arm names
tobiasdiez Nov 27, 2023
328da2d
readd python to env
tobiasdiez Nov 27, 2023
9e23573
correct print output
tobiasdiez Nov 27, 2023
40e2c22
update lock files
tobiasdiez Nov 27, 2023
ed1613d
revert changes to prereq
tobiasdiez Dec 7, 2023
b1bc95e
Limit to older compilers to fix ci issues on macos
tobiasdiez Dec 7, 2023
f17a170
fix name of lock file update script in docs
tobiasdiez Dec 7, 2023
1936aeb
install conda-lock in conda dev env
tobiasdiez Dec 7, 2023
8915be4
rerender lock files
tobiasdiez Dec 7, 2023
378683d
Merge remote-tracking branch 'upstream/develop' into pr/tobiasdiez/35986
tobiasdiez Dec 7, 2023
234dd3b
add arb explicitly
tobiasdiez Dec 7, 2023
58b53cd
Remove arb again
tobiasdiez Dec 8, 2023
b54a207
compilers is not a macos issue
tobiasdiez Dec 9, 2023
036fae0
Merge remote-tracking branch 'tobiasdiez/conda_maxparallel' into cond…
tobiasdiez Dec 9, 2023
17ff143
Merge remote-tracking branch 'upstream/develop' into conda-lock
tobiasdiez Dec 21, 2023
215bebd
update conda lock files
tobiasdiez Dec 21, 2023
bc91e96
Merge branch 'develop' into conda-lock
tobiasdiez Dec 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .devcontainer/onCreate-conda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
set -e

# Create conda environment
./bootstrap-conda
conda install mamba -n base -c conda-forge -y
mamba env create --file src/environment-dev.yml || mamba env update --file src/environment-dev.yml
mamba env create --file src/environment-dev-3.11-linux.yml || mamba env update --file src/environment-dev-3.11-linux.yml
conda init bash

# Build sage
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/ci-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ concurrency:
jobs:
test:
name: Conda
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest

# Run on push, workflow dispatch and when certain labels are added
if: |
Expand All @@ -32,7 +32,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu, macos]
python: ['3.9', '3.10', '3.11']
# Optional environment is disabled for now as its not yet working
# environment: [environment, environment-optional]
Expand All @@ -53,9 +53,6 @@ jobs:
bash ~/miniconda.sh -b -p $HOME/miniconda
echo "CONDA=$HOME/miniconda" >> $GITHUB_ENV

- name: Create conda environment files
run: ./bootstrap-conda

- name: Cache conda packages
uses: actions/cache@v3
with:
Expand All @@ -71,7 +68,7 @@ jobs:
channels: conda-forge,defaults
channel-priority: true
activate-environment: sage-build
environment-file: src/${{ matrix.conda-env }}.yml
environment-file: src/${{ matrix.conda-env }}-${{ matrix.python }}-${{ matrix.os }}.yml

- name: Print Conda environment
shell: bash -l {0}
Expand Down
20 changes: 15 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,21 @@
# no longer generated, but may still be in user worktrees
/src/lib/pkgconfig

/environment.yml
/environment-optional.yml
/src/environment.yml
/src/environment-dev.yml
/src/environment-optional.yml
/environment-3.9.yml
/environment-3.10.yml
/environment-3.11.yml
/environment-optional-3.9.yml
/environment-optional-3.10.yml
/environment-optional-3.11.yml
/src/environment-3.9.yml
/src/environment-3.10.yml
/src/environment-3.11.yml
/src/environment-dev-3.9.yml
/src/environment-dev-3.10.yml
/src/environment-dev-3.11.yml
/src/environment-optional-3.9.yml
/src/environment-optional-3.10.yml
/src/environment-optional-3.11.yml

/src/setup.cfg
/src/requirements.txt
Expand Down
3 changes: 1 addition & 2 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ tasks:
- name: Setup
# Create conda environment, then configure and build sage
init: >-
./bootstrap-conda
&& mamba env create --file src/environment-dev.yml --prefix venv
&& mamba env create --file src/environment-dev-3.11-linux.yml --prefix venv
&& conda config --append envs_dirs $(pwd)
&& conda activate $(pwd)/venv
&& ./bootstrap
Expand Down
136 changes: 70 additions & 66 deletions bootstrap-conda
Original file line number Diff line number Diff line change
Expand Up @@ -51,72 +51,76 @@ for PKG_BASE in $(sage-package list --has-file distros/conda.txt --exclude _sage
fi
done
echo >&2 $0:$LINENO: generate conda environment files
(
echo "name: sage-build"
echo "channels:"
echo " - conda-forge"
echo " - nodefaults"
echo "dependencies:"
for pkg in $SYSTEM_PACKAGES; do
echo " - $pkg"
done
echo " # Packages needed for ./bootstrap"
for pkg in $BOOTSTRAP_PACKAGES; do
echo " - $pkg"
done
) > environment.yml
for python_version in 3.9 3.10 3.11; do
(
echo "name: sage-build"
echo "channels:"
echo " - conda-forge"
echo " - nodefaults"
echo "dependencies:"
echo " - python=$python_version"
for pkg in $SYSTEM_PACKAGES; do
echo " - $pkg"
done
echo " # Packages needed for ./bootstrap"
for pkg in $BOOTSTRAP_PACKAGES; do
echo " - $pkg"
done
) > environment-$python_version.yml
(
sed 's/name: sage-build/name: sage/' environment-$python_version.yml
echo " # Additional packages providing all dependencies for the Sage library"
for pkg in $SAGELIB_SYSTEM_PACKAGES; do
echo " - $pkg"
done
) > src/environment-$python_version.yml
(
sed 's/name: sage/name: sage-dev/' src/environment-$python_version.yml
echo " # Additional dev tools"
for pkg in $DEVELOP_SYSTEM_PACKAGES; do
echo " - $pkg"
done
) > src/environment-dev-$python_version.yml

(
sed 's/name: sage-build/name: sage/' environment.yml
echo " # Additional packages providing all dependencies for the Sage library"
for pkg in $SAGELIB_SYSTEM_PACKAGES; do
echo " - $pkg"
done
) > src/environment.yml
(
cat environment-$python_version.yml
echo " # optional packages"
for pkg in $OPTIONAL_SYSTEM_PACKAGES; do
echo " - $pkg"
done
) > environment-optional-$python_version.yml

(
sed 's/name: sage/name: sage-dev/' src/environment.yml
echo " # Additional dev tools"
for pkg in $DEVELOP_SYSTEM_PACKAGES; do
echo " - $pkg"
done
) > src/environment-dev.yml

(
cat environment.yml
echo " # optional packages"
for pkg in $OPTIONAL_SYSTEM_PACKAGES; do
echo " - $pkg"
done
) > environment-optional.yml
(
cat src/environment-$python_version.yml
echo " # optional packages"
for pkg in $OPTIONAL_SYSTEM_PACKAGES $SAGELIB_OPTIONAL_SYSTEM_PACKAGES; do
echo " - $pkg"
done
) > src/environment-optional-$python_version.yml
(
echo >&4 " - pip:"
echo >&5 " - pip:"
for PKG_BASE in $((sage-package list :standard: :optional: --has-file requirements.txt --no-file distros/conda.txt --no-file src; sage-package list :standard: :optional: --has-file install-requires.txt --no-file requirements.txt --no-file distros/conda.txt --no-file src) | sort); do
PKG_SCRIPTS=build/pkgs/$PKG_BASE
SYSTEM_PACKAGES_FILE=$PKG_SCRIPTS/requirements.txt
if [ ! -f $SYSTEM_PACKAGES_FILE ]; then
SYSTEM_PACKAGES_FILE=$PKG_SCRIPTS/install-requires.txt
fi
PKG_TYPE=$(cat $PKG_SCRIPTS/type)
if grep -q SAGERUNTIME $PKG_SCRIPTS/dependencies $PKG_SCRIPTS/dependencies_order_only 2>/dev/null; then
: # cannot install packages that depend on the Sage library
else
case "$PKG_BASE:$PKG_TYPE" in
$DEVELOP_SPKG_PATTERN:*) FD=4;;
*) FD=5;;
esac
${STRIP_COMMENTS} $SYSTEM_PACKAGES_FILE | while read -r line; do
[ -n "$line" ] && echo >&$FD " - $line"
done
fi
done
# Currently, there are no dev-python packages, so we do not write an empty pip section
#) 4>> src/environment-dev-$python_version.yml 5>> src/environment-optional-$python_version.yml
) 4>> /dev/null 5>> src/environment-optional-$python_version.yml
done

(
cat src/environment.yml
echo " # optional packages"
for pkg in $OPTIONAL_SYSTEM_PACKAGES $SAGELIB_OPTIONAL_SYSTEM_PACKAGES; do
echo " - $pkg"
done
) > src/environment-optional.yml
(
echo >&4 " - pip:"
echo >&5 " - pip:"
for PKG_BASE in $((sage-package list :standard: :optional: --has-file requirements.txt --no-file distros/conda.txt --no-file src; sage-package list :standard: :optional: --has-file install-requires.txt --no-file requirements.txt --no-file distros/conda.txt --no-file src) | sort); do
PKG_SCRIPTS=build/pkgs/$PKG_BASE
SYSTEM_PACKAGES_FILE=$PKG_SCRIPTS/requirements.txt
if [ ! -f $SYSTEM_PACKAGES_FILE ]; then
SYSTEM_PACKAGES_FILE=$PKG_SCRIPTS/install-requires.txt
fi
PKG_TYPE=$(cat $PKG_SCRIPTS/type)
if grep -q SAGERUNTIME $PKG_SCRIPTS/dependencies $PKG_SCRIPTS/dependencies_order_only 2>/dev/null; then
: # cannot install packages that depend on the Sage library
else
case "$PKG_BASE:$PKG_TYPE" in
$DEVELOP_SPKG_PATTERN:*) FD=4;;
*) FD=5;;
esac
${STRIP_COMMENTS} $SYSTEM_PACKAGES_FILE | while read -r line; do
[ -n "$line" ] && echo >&$FD " - $line"
done
fi
done
) 4>> src/environment-dev.yml 5>> src/environment-optional.yml
2 changes: 1 addition & 1 deletion build/pkgs/cython/distros/conda.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cython
cython<3.0.0
2 changes: 1 addition & 1 deletion build/pkgs/matplotlib/distros/conda.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Trac #33642: For unknown reasons, without the version constraint, conda installs only 3.3.2
"matplotlib>=3.5.1"
matplotlib>=3.5.1
2 changes: 1 addition & 1 deletion build/pkgs/setuptools/distros/conda.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Set this bound until https://github.com/sagemath/sage/issues/34209 adds support for PEP660 editable builds
# By setting this version bound, we avoid having to include the following in our installation instructions.
# export SETUPTOOLS_ENABLE_FEATURES=legacy-editable
"setuptools<64"
setuptools<64
2 changes: 1 addition & 1 deletion build/pkgs/sphinx/distros/conda.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sphinx<8,>=5.2
sphinx>=5.2
Loading