-
-
Notifications
You must be signed in to change notification settings - Fork 660
Description
We modify src/setup.py
to support editable installs via pipenv (pipenv install -e .
, which invokes pip install --editable
). Since distribution continues using build/pkgs/sagelib/src/setup.py, the changes to src/setup.py made in this ticket do not affect the existing build process of the Sage library.
With this ticket, the following code works:
./bootstrap
./configure --enable-editable
make build-local
cd src
mkdir .venv
pipenv install --dev --ignore-pipfile
pipenv run pip install -e . --upgrade --exists-action=i --no-build-isolation
pipenv run sage-runtests --all
Instead of the first three commands, one can of course also use tox -e local-sudo-standard build-local
.
It generates a virtual env in src/.venv
that contains all necessary Python packages, and an editable install of sage.
Moreover, the installation of some packages might fail (depending on your system configuration). In this case one can manually build it using sage and then install the sage-built wheel in the pipenv. For example,
make fpylll
cd src && pipenv run pip install <sage>/local/var/lib/sage/venv-python3.8/var/lib/sage/wheels/fpylll-0.5.6-cp38-cp38-linux_x86_64.whl
The output of the added GH workflow is available here: https://github.com/sagemath/sagetrac-mirror/actions?query=workflow%3A%22Build+%26+Test+using+pipenv%22+branch%3Apublic%2Fbuild%2Finplace
Most tests are working, but a few are failing. Only a few tests are failing:
sage -t --random-seed=0 sage/misc/sagedoc.py # 4 doctests failed
sage -t --random-seed=0 sage/docs/conf.py # 1 doctest failed
sage -t --random-seed=0 sage/matrix/matrix_integer_dense.pyx # 1 doctest failed
sage -t --random-seed=0 sage/cpython/dict_del_by_value.pyx # 2 doctests failed
sage -t --random-seed=0 sage/tests/cmdline.py # 8 doctests failed
TODO (as followup tickets):
- Expand on the added documentation on how to set up the virtual environment, using either plain
python -m venv
,virtualenv
(20.x), orpipenv
. This is Extend documentation on how to set up the virtual environment #31342. - Consider not commit pipfile.lock but instead generate it as build artifact on ci (so that build errors can be easily reproduced by downloading the lock file, and re-creating the exact venv locally): Proposal:
pipenv
patterns and antipatterns for python library project pypa/pipenv#1911 (comment). However, normally you want to put the lock file under version control for the reasons described in https://trac.sagemath.org/timeline?from=2021-02-03T13%3A15%3A22Z. The official statement is "always include in version control", see git - Should Pipfile.lock be committed to version control? pypa/pipenv#598. - Replace manual definition of build variables (PKG_CONFIG_PATH, LIBRARY_PATH etc) by
sage-env
. - Fix failing doctests.
Previous tickets on in-place builds, editable installs:
- build the sage library in place #12659
- Make src/setup.py respect --build-base and --inplace, independent of SAGE_CYTHONIZED #21535
Depends on #30779
Depends on #30672
Depends on #30673
Depends on #30709
Depends on #30706
Depends on #30901
Depends on #31080
Depends on #29850
Depends on #29314
Depends on #30937
Depends on #30935
Depends on #30731
Depends on #30859
Depends on #30923
Depends on #30910
Depends on #30944
Depends on #30770
Depends on #31216
Depends on #31029
Depends on #30912
Depends on #31357
Depends on #31362
Depends on #31365
Depends on #31377
CC: @tobiasdiez @kiwifb @jhpalmieri @isuruf
Component: build
Keywords: sd111
Author: Tobias Diez
Branch/Commit: public/build/inplace @ c736e0c
Issue created by migration from https://trac.sagemath.org/ticket/30371