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

Refactor sagemath-standard through sagemath-{categories,environment,repl} #35143

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
4f94fdd
src/sage_setup/command/sage_install.py: Do not attempt to clean the i…
mkoeppe Sep 26, 2022
a6b92b0
build/pkgs/sagemath_{objects,categories,environment,repl}: Install th…
mkoeppe Sep 26, 2022
7a0f88f
build/pkgs/sagelib, pkgs/sagemath-standard: Factor through sagemath-{…
mkoeppe Sep 26, 2022
40fc2f6
build/pkgs/sagelib: Use python-build
mkoeppe Sep 27, 2022
0de8dc3
src/sage/cpython/python_debug.pxd: Fix path of "python_debug.h"
mkoeppe Sep 29, 2022
6ffd02e
src/MANIFEST.in: Add missing files in sage.misc
mkoeppe Sep 29, 2022
ae4241a
build/pkgs/sagelib/spkg-install: Add TODO
mkoeppe Oct 3, 2022
d159c87
Merge remote-tracking branch 'upstream/develop' into t/34587/refactor…
mkoeppe Feb 15, 2023
c8f5d5c
build/pkgs/sagemath_objects/spkg-install: Fix determining wheel file …
mkoeppe Feb 15, 2023
fcd6a3a
Merge remote-tracking branch 'upstream/develop' into t/34587/refactor…
mkoeppe Feb 25, 2023
ff1895e
pkgs/sagemath-standard/setup.cfg.m4: Separate copy of src/setup.cfg.m4
mkoeppe Feb 25, 2023
af97d23
build/pkgs/sagelib/dependencies: Conditionalize dependency on modular…
mkoeppe Feb 25, 2023
ddc3772
pkgs/sagemath-standard/setup.cfg.m4: Do not install scripts installed…
mkoeppe Feb 25, 2023
f6dd5c6
pkgs/sagemath-standard/setup.cfg.m4: Do not install package data inst…
mkoeppe Feb 25, 2023
c014755
pkgs/sagemath-standard/MANIFEST.in: Separate copy of src/MANIFEST.in
mkoeppe Feb 25, 2023
09bfd32
build/pkgs/sagelib/spkg-install [SAGE_EDITABLE=yes, SAGE_WHEEL=yes]: …
mkoeppe Feb 25, 2023
a3cf803
Merge remote-tracking branch 'upstream/develop' into t/34587/refactor…
mkoeppe Mar 23, 2023
efb7fb2
Merge tag '10.0.beta6' into t/34587/refactor_sagemath_standard_throug…
mkoeppe Mar 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ build/bin/sage-build-env-config
/pkgs/sagemath-objects/setup.cfg
/pkgs/sagemath-categories/setup.cfg
/pkgs/sagemath-environment/setup.cfg
/pkgs/sagemath-standard/setup.cfg
/pkgs/sagemath-repl/setup.cfg
/pkgs/sagemath-objects/pyproject.toml
/pkgs/sagemath-categories/pyproject.toml
Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/sagelib/dependencies
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FORCE $(SCRIPTS) arb boost_cropped $(BLAS) brial cliquer cypari cysignals cython ecl eclib ecm flint libgd gap giac givaro glpk gmpy2 gsl iml importlib_metadata importlib_resources jinja2 jupyter_core lcalc lrcalc_python libbraiding libhomfly libpng linbox m4ri m4rie memory_allocator mpc mpfi mpfr $(MP_LIBRARY) ntl numpy pari pip pkgconfig planarity ppl pplpy primesieve primecount primecountpy pycygwin $(PYTHON) requests rw sage_conf singular symmetrica typing_extensions $(PCFILES) | $(PYTHON_TOOLCHAIN) sage_setup
FORCE $(SCRIPTS) arb boost_cropped $(BLAS) brial cliquer cypari cysignals cython ecl eclib ecm flint libgd gap giac givaro glpk gmpy2 gsl iml importlib_metadata importlib_resources jinja2 jupyter_core lcalc lrcalc_python libbraiding libhomfly libpng linbox m4ri m4rie memory_allocator mpc mpfi mpfr $(MP_LIBRARY) ntl numpy pari pip pkgconfig planarity ppl pplpy primesieve primecount primecountpy pycygwin $(PYTHON) requests rw sage_conf $(and $(or $(findstring yes,$(SAGE_WHEELS)),$(findstring no,$(SAGE_EDITABLE))), sagemath_objects sagemath_categories sagemath_environment sagemath_repl) singular symmetrica typing_extensions $(PCFILES) | $(PYTHON_TOOLCHAIN) python_build sage_setup

----------
All lines of this file are ignored except the first.
Expand Down
14 changes: 12 additions & 2 deletions build/pkgs/sagelib/spkg-install
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ if [ "$SAGE_EDITABLE" = yes ]; then

if [ "$SAGE_WHEELS" = yes ]; then
# Additionally build a wheel (for use in other venvs)
cd $SAGE_PKGS/sagelib/src && time sdh_setup_bdist_wheel && sdh_store_wheel .
cd $SAGE_PKGS/sagelib/src
DIST_DIR="$(mktemp -d)"
python3 -m build --no-isolation --outdir "$DIST_DIR"/dist . || sdh_die "Failure building sdist and wheel"
wheel=$(cd "$DIST_DIR" && sdh_store_and_pip_install_wheel . && echo $wheel)
fi
else
# Make sure that an installed old version of sagelib in which sage is an ordinary package
Expand All @@ -75,10 +78,17 @@ else
(cd "$SITEPACKAGESDIR" && rm -f sagemath-standard.egg-link)

if [ "$SAGE_WHEELS" = yes ]; then
# First build the sdist, then build the wheel from the sdist.
# https://pypa-build.readthedocs.io/en/latest/#python--m-build
# (Important because sagemath-objects uses MANIFEST.in for filtering.)
DIST_DIR="$(mktemp -d)"
# Use --no-build-isolation to avoid rebuilds because of dependencies:
# Compiling sage/interfaces/sagespawn.pyx because it depends on /private/var/folders/38/wnh4gf1552g_crsjnv2vmmww0000gp/T/pip-build-env-609n5985/overlay/lib/python3.10/site-packages/Cython/Includes/posix/unistd.pxd
time sdh_pip_install --no-build-isolation .
python3 -m build --no-isolation --outdir "$DIST_DIR"/dist . || sdh_die "Failure building sdist and wheel"
wheel=$(cd "$DIST_DIR" && sdh_store_and_pip_install_wheel . && echo $wheel)
else
# TODO: Deprecate this installation mode.
# Note this no longer does any cleaning!
time python3 -u setup.py --no-user-cfg build install || exit 1
fi
fi
Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/sagemath_categories/type
Original file line number Diff line number Diff line change
@@ -1 +1 @@
experimental
standard
2 changes: 1 addition & 1 deletion build/pkgs/sagemath_environment/type
Original file line number Diff line number Diff line change
@@ -1 +1 @@
experimental
standard
3 changes: 1 addition & 2 deletions build/pkgs/sagemath_objects/spkg-install
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ export PIP_FIND_LINKS="file://$SAGE_SPKG_WHEELS"
# First build the sdist, then build the wheel from the sdist.
# https://pypa-build.readthedocs.io/en/latest/#python--m-build
# (Important because sagemath-objects uses MANIFEST.in for filtering.)
# Do not install the wheel.
DIST_DIR="$(mktemp -d)"
python3 -m build --outdir "$DIST_DIR"/dist . || sdh_die "Failure building sdist and wheel"

wheel=$(cd "$DIST_DIR" && sdh_store_wheel . && echo $wheel)
wheel=$(cd "$DIST_DIR" && sdh_store_and_pip_install_wheel . 1>&2 && echo $wheel)
ls -l "$wheel"

if [ "$SAGE_CHECK" != no ]; then
Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/sagemath_objects/type
Original file line number Diff line number Diff line change
@@ -1 +1 @@
experimental
standard
2 changes: 1 addition & 1 deletion build/pkgs/sagemath_repl/type
Original file line number Diff line number Diff line change
@@ -1 +1 @@
experimental
standard
1 change: 0 additions & 1 deletion pkgs/sagemath-standard/MANIFEST.in

This file was deleted.

85 changes: 85 additions & 0 deletions pkgs/sagemath-standard/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
include VERSION.txt

global-include *.pxi *.pxd *.h *.hpp

prune sage/ext/interpreters # In particular, __init__.py must not be present in the distribution; or sage_setup.autogen.interpreters.rebuild will not generate the code
prune sage_setup
prune sage_docbuild
prune doc

#
# Most C and C++ files are generated by Cython and should not
# be included in the sdist.
#
global-exclude *.c
global-exclude *.cpp

#
# List of C and C++ files that are actual source files,
# NOT generated by Cython. The same list appears in SAGE_ROOT/.gitignore
#
include sage/cpython/debugimpl.c
include sage/graphs/base/boost_interface.cpp
include sage/graphs/cliquer/cl.c
include sage/graphs/graph_decompositions/sage_tdlib.cpp
include sage/libs/eclib/wrap.cpp
include sage/libs/linkages/padics/relaxed/flint_helper.c
include sage/misc/inherit_comparison_impl.c
include sage/modular/arithgroup/farey.cpp
include sage/modular/arithgroup/sl2z.cpp
include sage/rings/bernmm/bern_modp.cpp
include sage/rings/bernmm/bern_modp_util.cpp
include sage/rings/bernmm/bern_rat.cpp
include sage/rings/bernmm/bernmm-test.cpp
include sage/rings/padics/transcendantal.c
include sage/rings/polynomial/weil/power_sums.c
include sage/schemes/hyperelliptic_curves/hypellfrob/hypellfrob.cpp
include sage/schemes/hyperelliptic_curves/hypellfrob/recurrences_ntl.cpp
include sage/stats/distributions/dgs_bern.c
include sage/stats/distributions/dgs_gauss_dp.c
include sage/stats/distributions/dgs_gauss_mp.c
include sage/symbolic/ginac/*.cpp
# Also actual C++ source files.
include sage/geometry/triangulation/triangulations.cc
include sage/geometry/triangulation/data.cc
include sage/geometry/triangulation/functions.cc

# Exclude what is already shipped in sagemath-objects, sagemath-categories, sagemath-environment, sagemath-repl
global-exclude all__*.py
prune sage/misc
include sage/misc/all.py
include sage/misc/allocator.pxd
include sage/misc/allocator.pyx
include sage/misc/binary_tree.pxd
include sage/misc/binary_tree.pyx
include sage/misc/search.pxd
include sage/misc/search.pyx
# Exclude what is shipped in sagemath-objects
prune sage/cpython
prune sage/structure
prune sage/libs/gmp
# Exclude what is shipped in sagemath-categories
prune sage/categories
exclude sage/rings/ideal.*
exclude sage/rings/ring.*
prune sage/typeset
# Exclude what is shipped in sagemath-environment
exclude sage/env.py
exclude sage/version.py
prune sage/features
# Exclude what is shipped in sagemath-repl
prune sage/doctest
prune sage/repl
exclude sage/misc/banner.py
exclude sage/misc/sagedoc.py
exclude sage/misc/sage_input.py
exclude sage/misc/sage_eval.py

global-exclude __pycache__
global-exclude *.py[co]
global-exclude *.bak
global-exclude *.so
global-exclude *~
prune .tox
prune build
prune dist
1 change: 1 addition & 0 deletions pkgs/sagemath-standard/setup-monolithic.cfg.m4
1 change: 0 additions & 1 deletion pkgs/sagemath-standard/setup.cfg.m4

This file was deleted.

171 changes: 171 additions & 0 deletions pkgs/sagemath-standard/setup.cfg.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# -*- conf-unix -*-
[metadata]
name = sagemath-standard
version = file: VERSION.txt
description = Sage: Open Source Mathematics Software: Standard Python Library
long_description = file: README.rst
long_description_content_type = text/x-rst
license = GNU General Public License (GPL) v2 or later
license_files = LICENSE.txt
author = The Sage Developers
author_email = [email protected]
url = https://www.sagemath.org

classifiers =
Development Status :: 6 - Mature
Intended Audience :: Education
Intended Audience :: Science/Research
License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)
Operating System :: POSIX
Operating System :: MacOS :: MacOS X
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: Implementation :: CPython
Topic :: Scientific/Engineering :: Mathematics

[options]
python_requires = >=3.8, <3.12
install_requires =
esyscmd(`sage-get-system-packages install-requires \
sagemath_objects \
sagemath_categories \
sagemath_environment \
sagemath_repl \
sage_conf \
six \
| sed "2,\$s/^/ /;"')dnl'
dnl From build/pkgs/sagelib/dependencies
esyscmd(`sage-get-system-packages install-requires \
cypari \
cysignals \
cython \
gmpy2 \
jinja2 \
jupyter_core \
lrcalc_python \
memory_allocator \
numpy \
pkgconfig \
pplpy \
primecountpy \
requests \
| sed "2,\$s/^/ /;"')dnl'
dnl From Makefile.in: SAGERUNTIME
esyscmd(`sage-get-system-packages install-requires \
ipython \
pexpect \
| sed "2,\$s/^/ /;"')dnl'
dnl From Makefile.in: DOC_DEPENDENCIES
esyscmd(`sage-get-system-packages install-requires \
sphinx \
networkx \
scipy \
sympy \
matplotlib \
pillow \
mpmath \
ipykernel \
jupyter_client \
ipywidgets \
| sed "2,\$s/^/ /;"')dnl'
dnl Other Python packages that are standard spkg, used in doctests
esyscmd(`sage-get-system-packages install-requires \
fpylll \
| sed "2,\$s/^/ /;"')dnl'
dnl pycryptosat # Sage distribution installs it as part of cryptominisat. According to its README on https://pypi.org/project/pycryptosat/: "The pycryptosat python package compiles while compiling CryptoMiniSat. It cannot be compiled on its own, it must be compiled at the same time as CryptoMiniSat."
dnl Packages with important upper version bounds
esyscmd(`sage-get-system-packages install-requires \
ptyprocess \
| sed "2,\$s/^/ /;"')dnl'

scripts =
# The sage script
# bin/sage -- installed by sagemath-environment
# Other scripts that should be in the path also for OS packaging of sage:
# bin/sage-eval -- installed by sagemath-repl
# Included because it is useful for doctesting/coverage testing user scripts too:
# bin/sage-runtests -- installed by sagemath-repl
# bin/sage-fixdoctests -- installed by sagemath-repl
# bin/sage-coverage -- installed by sagemath-repl
# The following is deprecated but might still be used in user package install scripts
bin/sage-cython
# Helper scripts invoked by sage script
# (they would actually belong to something like libexec)
# bin/sage-cachegrind -- installed by sagemath-repl
# bin/sage-callgrind -- installed by sagemath-repl
# bin/sage-massif -- installed by sagemath-repl
# bin/sage-omega -- installed by sagemath-repl
# bin/sage-valgrind -- installed by sagemath-repl
# bin/sage-venv-config -- installed by sagemath-environment
# bin/sage-version.sh -- installed by sagemath-environment
# bin/sage-cleaner -- installed by sagemath-repl
# Only makes sense in sage-the-distribution. TODO: Move to another installation script.
bin/sage-list-packages
# Uncategorized scripts in alphabetical order
bin/math-readline
# bin/sage-env -- installed by sagemath-environment
# sage-env-config -- installed by sage_conf
# sage-env-config.in -- not to be installed
bin/sage-grep
bin/sage-grepdoc
# bin/sage-inline-fortran -- installed by sagemath-repl
# bin/sage-ipynb2rst -- installed by sagemath-repl
# bin/sage-ipython -- installed by sagemath-repl
# bin/sage-notebook -- installed by sagemath-repl
# bin/sage-num-threads.py -- installed by sagemath-environment
# bin/sage-preparse -- installed by sagemath-repl
# bin/sage-python -- installed by sagemath-environment
bin/sage-rebase.bat
bin/sage-rebase.sh
bin/sage-rebaseall.bat
bin/sage-rebaseall.sh
# bin/sage-run -- installed by sagemath-repl
# bin/sage-run-cython -- installed by sagemath-repl
# bin/sage-startuptime.py -- installed by sagemath-repl
bin/sage-update-version

[options.package_data]

sage.libs.gap =
sage.gaprc

sage.interfaces =
sage-maxima.lisp

# sage.doctest = -- installed by sagemath-repl
# tests/*

# sage.repl.rich_output = -- installed by sagemath-repl
# example*

sage =
ext_data/*
ext_data/kenzo/*
ext_data/singular/*
ext_data/singular/function_field/*
ext_data/images/*
ext_data/doctest/*
ext_data/doctest/invalid/*
ext_data/gap/*
ext_data/gap/joyner/*
ext_data/mwrank/*
ext_data/notebook-ipython/*
ext_data/nbconvert/*
ext_data/graphs/*
ext_data/pari/*
ext_data/pari/dokchitser/*
ext_data/pari/buzzard/*
ext_data/pari/simon/*
ext_data/magma/*
ext_data/magma/latex/*
ext_data/magma/sage/*
ext_data/valgrind/*
ext_data/threejs/*

[options.extras_require]
R = esyscmd(`sage-get-system-packages install-requires \
rpy2 \
| sed "2,\$s/^/ /;"')dnl'
3 changes: 3 additions & 0 deletions src/pyproject.toml.m4
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ requires = [
# Note that PEP517/518 have no notion of optional sage_spkg dependencies:
# https://github.com/pypa/pip/issues/6144
esyscmd(`sage-get-system-packages install-requires-toml \
sagemath_environment \
sagemath_objects \
sagemath_categories \
sage_conf \
setuptools \
wheel \
Expand Down
2 changes: 1 addition & 1 deletion src/sage/cpython/python_debug.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from cpython.ref cimport PyObject, PyTypeObject

cdef extern from "sage/cpython/python_debug.h":
cdef extern from "python_debug.h":

# This is what is generally meant by "a debug build" of Python.
# Implies Py_REF_DEBUG, Py_TRACE_REFS, and PYMALLOC_DEBUG (if
Expand Down
5 changes: 2 additions & 3 deletions src/sage_setup/command/sage_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@ def clean_stale_files(self):
nobase_data_files = [(src_dir, [os.path.join(src_dir, filename) for filename in filenames])
for package, src_dir, build_dir, filenames in cmd_build_py.data_files]

# Clean install directory (usually, purelib and platlib are the same)
# and build directory.
output_dirs = [self.install_purelib, self.install_platlib, self.build_lib]
# Clean build directory.
output_dirs = [self.build_lib]
from sage_setup.clean import clean_install_dir
for output_dir in set(output_dirs):
log.info('- cleaning {0}'.format(output_dir))
Expand Down