Skip to content

Use pipenv to create venv for development #30371

@mkoeppe

Description

@mkoeppe

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):

Previous tickets on in-place builds, editable installs:

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions