Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge #32716
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed May 7, 2022
2 parents 064f453 + 9db6b2f commit b87f813
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 21 deletions.
10 changes: 8 additions & 2 deletions pkgs/sage-setup/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
#
# To build and test in the tox environment:
#
# ./sage -sh -c '(cd pkgs/sage-setup && tox)'
# ./sage -sh -c '(cd pkgs/sage-setup && tox -e sagepython)'
#
# To test interactively:
#
# pkgs/sage-setup/.tox/python/bin/python
# pkgs/sage-setup/.tox/sagepython/bin/python
#
[tox]

Expand All @@ -28,3 +28,9 @@ commands =

# TODO: Test importing sage_setup.library_order -- when that can handle missing pkgconfig libraries...
# TODO: Test more modules -- when the dependency on sage.env has been removed...

[testenv:sagepython]
passenv =
SAGE_VENV

basepython = {env:SAGE_VENV}/bin/python3
10 changes: 8 additions & 2 deletions pkgs/sagemath-categories/tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# To build and test in the tox environment:
#
# ./sage -sh -c '(cd pkgs/sagemath-categories/src && tox -v -v -v)'
# ./sage -sh -c '(cd pkgs/sagemath-categories/src && tox -v -v -v -e sagepython)'
#
# To test interactively:
#
# pkgs/sagemath-categories/.tox/python/bin/python
# pkgs/sagemath-categories/.tox/sagepython/bin/python
#
[tox]

Expand All @@ -31,3 +31,9 @@ commands =
python -c 'import sys; "" in sys.path and sys.path.remove(""); from sage.categories.all import *; SimplicialComplexes(); FunctionFields()'

bash -c 'cd bin && SAGE_SRC=$(python -c "from sage.env import SAGE_SRC; print(SAGE_SRC)") && sage-runtests --environment=sage.all__sagemath_categories --optional=sage $SAGE_SRC/sage/structure || echo "(lots of doctest failures are expected)"'

[testenv:sagepython]
passenv =
SAGE_VENV

basepython = {env:SAGE_VENV}/bin/python3
10 changes: 8 additions & 2 deletions pkgs/sagemath-objects/tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# To build and test in the tox environment:
#
# ./sage -sh -c '(cd pkgs/sagemath-objects && tox -v -v)'
# ./sage -sh -c '(cd pkgs/sagemath-objects && tox -v -v -e sagepython)'
#
# To test interactively:
#
# pkgs/sagemath-objects/.tox/python/bin/python
# pkgs/sagemath-objects/.tox/sagepython/bin/python
#
[tox]

Expand All @@ -29,3 +29,9 @@ commands =
python -c 'import sys; "" in sys.path and sys.path.remove(""); from sage.all__sagemath_objects import *'

bash -c 'cd bin && SAGE_SRC=$(python -c "from sage.env import SAGE_SRC; print(SAGE_SRC)") && sage-runtests --environment=sage.all__sagemath_objects --optional=sage $SAGE_SRC/sage/structure || echo "(lots of doctest failures are expected)"'

[testenv:sagepython]
passenv =
SAGE_VENV

basepython = {env:SAGE_VENV}/bin/python3
27 changes: 17 additions & 10 deletions pkgs/sagemath-standard/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
#
# To build and test in the tox environment using the concrete Python dependencies specified
# by requirements.txt, using the wheels built and stored by the Sage distribution:
# (Using 'sage -sh' ensures that we use the same Python as the one that we built the wheels
# (Using 'sage -sh' in combination with 'sagepython-...' tox environments
# ensures that we use the same Python as the one that we built the wheels
# for. This can also be done ensured manually by using the tox environment py38-sagewheels etc.)
#
# Afterwards, to test interactively:
Expand All @@ -25,17 +26,17 @@ envlist =
# Build dependencies according to requirements.txt (all versions fixed).
# Use ONLY the wheels built and stored by the Sage distribution (no PyPI):
#
# ./sage -sh -c '(cd pkgs/sagemath-standard && tox -v -v -v -e python-sagewheels-nopypi)'
# ./sage -sh -c '(cd pkgs/sagemath-standard && tox -v -v -v -e sagepython-sagewheels-nopypi)'
#
python-sagewheels-nopypi,
sagepython-sagewheels-nopypi,
#
# Build and test without using the concrete dependencies specified by requirements.txt,
# using the dependencies declared in pyproject.toml and setup.cfg (install-requires) only:
# Still use ONLY the wheels built and stored by the Sage distribution (no PyPI).
#
# ./sage -sh -c '(cd pkgs/sagemath-standard && tox -v -v -v -e python-sagewheels-nopypi-norequirements)'
# ./sage -sh -c '(cd pkgs/sagemath-standard && tox -v -v -v -e sagepython-sagewheels-nopypi-norequirements)'
#
python-sagewheels-nopypi-norequirements,
sagepython-sagewheels-nopypi-norequirements,
#
# EXPERIMENTAL ENVIRONMENTS:
#
Expand All @@ -44,14 +45,14 @@ envlist =
# and additionally allow packages from PyPI.
# Because all versions are fixed, we "should" end up using the prebuilt wheels.
#
# ./sage -sh -c '(cd pkgs/sagemath-standard && tox -v -v -v -e python-sagewheels)'
# ./sage -sh -c '(cd pkgs/sagemath-standard && tox -v -v -v -e sagepython-sagewheels)'
#
python-sagewheels,
sagepython-sagewheels,
#
# Likewise, but using pipenv using Pipfile-dist (= SAGE_ROOT/Pipfile).
# This also fixes the concrete dependencies (at least for some packages).
#
python-sagewheels-pipenv-dist,
sagepython-sagewheels-pipenv-dist,
#
# Build using the dependencies declared in pyproject.toml and setup.cfg (install-requires) only.
# Use the wheels built and stored by the Sage distribution,
Expand All @@ -60,11 +61,11 @@ envlist =
# Because the version ranges will allow for packages to come in from PyPI (in source or wheel form),
# this is likely to fail because we do not have control over the configuration of these packages.
#
python-sagewheels-norequirements,
sagepython-sagewheels-norequirements,
#
# Likewise, but using pipenv
#
python-sagewheels-pipenv
sagepython-sagewheels-pipenv

[testenv]
deps =
Expand Down Expand Up @@ -129,3 +130,9 @@ commands =
sage -c 'import sys; print("sys.path =", sys.path); import sage.all; print(sage.all.__file__)'

sage -t -p --all

[testenv:sagepython]
passenv =
SAGE_VENV

basepython = {env:SAGE_VENV}/bin/python3
10 changes: 5 additions & 5 deletions src/doc/en/developer/packaging_sage_library.rst
Original file line number Diff line number Diff line change
Expand Up @@ -545,19 +545,19 @@ Following the comments in the file
``SAGE_ROOT/pkgs/sagemath-standard/tox.ini``, we can try the following
command::

$ ./bootstrap && ./sage -sh -c '(cd pkgs/sagemath-standard && SAGE_NUM_THREADS=16 tox -v -v -v -e py39-sagewheels-nopypi)'
$ ./bootstrap && ./sage -sh -c '(cd pkgs/sagemath-standard && SAGE_NUM_THREADS=16 tox -v -v -v -e sagepython-sagewheels-nopypi)'

This command does not make any changes to the normal installation of
Sage. The virtual environment is created in a subdirectory of
``SAGE_ROOT/pkgs/sagemath-standard-no-symbolics/.tox/``. After the command
finishes, we can start the separate installation of the Sage library
in its virtual environment::

$ pkgs/sagemath-standard/.tox/py39-sagewheels-nopypi/bin/sage
$ pkgs/sagemath-standard/.tox/sagepython-sagewheels-nopypi/bin/sage

We can also run parts of the testsuite::

$ pkgs/sagemath-standard/.tox/py39-sagewheels-nopypi/bin/sage -tp 4 src/sage/graphs/
$ pkgs/sagemath-standard/.tox/sagepython-sagewheels-nopypi/bin/sage -tp 4 src/sage/graphs/

The whole ``.tox`` directory can be safely deleted at any time.

Expand All @@ -570,15 +570,15 @@ without depending on optional packages, but without the packages

Again we can run the test with ``tox`` in a separate virtual environment::

$ ./bootstrap && ./sage -sh -c '(cd pkgs/sagemath-standard-no-symbolics && SAGE_NUM_THREADS=16 tox -v -v -v -e py39-sagewheels-nopypi)'
$ ./bootstrap && ./sage -sh -c '(cd pkgs/sagemath-standard-no-symbolics && SAGE_NUM_THREADS=16 tox -v -v -v -e sagepython-sagewheels-nopypi)'

Some small distributions, for example the ones providing the two
lowest levels, `sagemath-objects <https://pypi.org/project/sagemath-objects/>`_
and `sagemath-categories <https://pypi.org/project/sagemath-categories/>`_
(from :trac:`29865`), can be installed and tested
without relying on the wheels from the Sage build::

$ ./bootstrap && ./sage -sh -c '(cd pkgs/sagemath-objects && SAGE_NUM_THREADS=16 tox -v -v -v -e py39)'
$ ./bootstrap && ./sage -sh -c '(cd pkgs/sagemath-objects && SAGE_NUM_THREADS=16 tox -v -v -v -e sagepython)'

This command finds the declared build-time and run-time dependencies
on PyPI, either as source tarballs or as prebuilt wheels, and builds
Expand Down

0 comments on commit b87f813

Please sign in to comment.