From 8e26e8ecd912dff2ec47775d8cd24c4b5f82c0cb Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 5 Nov 2023 15:33:54 -0800 Subject: [PATCH 01/19] .github/workflows/ci-linux.yml: Fine-tune max-parallel for constructive clogging --- .github/workflows/ci-linux.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 7fd2064a108..b991fe11880 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -85,8 +85,9 @@ jobs: tox_packages_factors: >- ["standard"] docker_push_repository: ghcr.io/${{ github.repository }}/ - # Reduce from 30 to 25 because it runs in parallel with 'standard-sitepackages' below - max_parallel: 25 + # Reduce from 30 to 20 because it runs in parallel with 'standard-sitepackages' + # and 'minimal-pre' below + max_parallel: 20 standard-sitepackages: if: ${{ success() || failure() }} @@ -135,7 +136,7 @@ jobs: "opensuse-tumbleweed", "debian-bullseye-i386"] docker_push_repository: ghcr.io/${{ github.repository }}/ - max_parallel: 10 + max_parallel: 8 minimal-pre: if: ${{ success() || failure() }} @@ -148,9 +149,9 @@ jobs: tox_packages_factors: >- ["minimal"] docker_push_repository: ghcr.io/${{ github.repository }}/ - # Reduced from 30 because it may run in parallel with 'standard-sitepackages' above. + # Reduced from 30 because it may run in parallel with 'standard' and 'standard-sitepackages' above. # Calibrated for clogging the job pipeline until the "default" job has finished. - max_parallel: 20 + max_parallel: 24 minimal: if: ${{ success() || failure() }} @@ -169,6 +170,7 @@ jobs: tox_packages_factors: >- ["minimal"] docker_push_repository: ghcr.io/${{ github.repository }}/ + max_parallel: 24 maximal-pre: if: ${{ success() || failure() }} From 5a755e950d035edb48242409131dd31130071001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Fri, 10 Nov 2023 19:56:05 -0300 Subject: [PATCH 02/19] Fix ssl timeout in testing internet feature --- src/sage/features/internet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/features/internet.py b/src/sage/features/internet.py index f1eb000fe92..576b0136926 100644 --- a/src/sage/features/internet.py +++ b/src/sage/features/internet.py @@ -56,7 +56,7 @@ def _is_present(self): try: urlopen(req, timeout=1, context=default_context()) return FeatureTestResult(self, True) - except urllib.error.URLError: + except (urllib.error.URLError, TimeoutError): return FeatureTestResult(self, False) From fad25bbfe57cb0289a49f9d4eda25dccc4976c09 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 10 Nov 2023 16:55:54 -0800 Subject: [PATCH 03/19] tox.ini (conda-python{3.9,3.10,3.11,3.12}): Reorder so that the _python3.... package is actually installed --- tox.ini | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tox.ini b/tox.ini index c039103f422..438c1ca8763 100644 --- a/tox.ini +++ b/tox.ini @@ -559,22 +559,21 @@ setenv = CONFIG_CONFIGURE_ARGS_1=--with-system-python3=yes python3_spkg: CONFIG_CONFIGURE_ARGS_1=--without-system-python3 python3.9,python3.10,python3.11,python3.12: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=python{env:PYTHON_MAJOR}.{env:PYTHON_MINOR} - python3.9,python3.10,python3.11,python3.12: EXTRA_SAGE_PACKAGES_5=_python{env:PYTHON_MAJOR}.{env:PYTHON_MINOR} _bootstrap liblzma bzip2 libffi libpng zlib # As of 2023-9, Xcode 15.0.0, this is Python 3.9.6. macos-python3_xcode: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/usr/bin/python3 - macos-python3_xcode: EXTRA_SAGE_PACKAGES_5=_bootstrap liblzma bzip2 libffi libpng zlib macos-{python3_xcode,nohomebrew}-{python3.9}: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/{env:PYTHON_MAJOR}.{env:PYTHON_MINOR}/bin/python3 # Homebrew keg installs homebrew-{python3.9,python3.10,python3.11,python3.12}: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python={env:HOMEBREW}/opt/python@{env:PYTHON_MAJOR}.{env:PYTHON_MINOR}/bin/python3 # Installers from https://www.python.org/downloads/macos/ (must manually download and install) macos-python3_pythonorg: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/Library/Frameworks/Python.framework/Versions/{env:PYTHON_MAJOR}.{env:PYTHON_MINOR}/bin/python3 - macos-python3_pythonorg: EXTRA_SAGE_PACKAGES_5=_bootstrap liblzma bzip2 libffi libpng zlib # https://github.com/pypa/manylinux manylinux-standard: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/opt/python/cp{env:PYTHON_MAJOR}{env:PYTHON_MINOR}-cp{env:PYTHON_MAJOR}{env:PYTHON_MINOR}/bin/python3 - manylinux-{python3.9,python3.10,python3.11,python3.12}: EXTRA_SAGE_PACKAGES_5=_bootstrap liblzma bzip2 libffi libpng conda: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=python3 conda: EXTRA_SAGE_PACKAGES_5=_bootstrap liblzma bzip2 libffi libpng zlib - + python3.9,python3.10,python3.11,python3.12: EXTRA_SAGE_PACKAGES_5=_python{env:PYTHON_MAJOR}.{env:PYTHON_MINOR} _bootstrap liblzma bzip2 libffi libpng zlib + manylinux-{python3.9,python3.10,python3.11,python3.12}: EXTRA_SAGE_PACKAGES_5=_bootstrap liblzma bzip2 libffi libpng + macos-python3_pythonorg: EXTRA_SAGE_PACKAGES_5=_bootstrap liblzma bzip2 libffi libpng zlib + macos-python3_xcode: EXTRA_SAGE_PACKAGES_5=_bootstrap liblzma bzip2 libffi libpng zlib {centos-stream,almalinux}-8-python3.9: EXTRA_SYSTEM_PACKAGES=python39 python39-devel # # - toolchain From df0ca5b4a2f7f75b5e5c7c18de4890c829b5638a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 10 Nov 2023 16:57:49 -0800 Subject: [PATCH 04/19] build/pkgs/_python{3.9,3.10,3.11,3.12}/distros/conda.txt: Use = instead of ==, for fuzzy match --- build/pkgs/_python3.10/distros/conda.txt | 2 +- build/pkgs/_python3.11/distros/conda.txt | 2 +- build/pkgs/_python3.12/distros/conda.txt | 2 +- build/pkgs/_python3.9/distros/conda.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pkgs/_python3.10/distros/conda.txt b/build/pkgs/_python3.10/distros/conda.txt index 0e2312f6abf..3fe0755f28f 100644 --- a/build/pkgs/_python3.10/distros/conda.txt +++ b/build/pkgs/_python3.10/distros/conda.txt @@ -1 +1 @@ -python==3.10 +python=3.10 diff --git a/build/pkgs/_python3.11/distros/conda.txt b/build/pkgs/_python3.11/distros/conda.txt index 875818d94e8..b025c36b396 100644 --- a/build/pkgs/_python3.11/distros/conda.txt +++ b/build/pkgs/_python3.11/distros/conda.txt @@ -1 +1 @@ -python==3.11 +python=3.11 diff --git a/build/pkgs/_python3.12/distros/conda.txt b/build/pkgs/_python3.12/distros/conda.txt index 08c4473f336..6c4c1ce29a1 100644 --- a/build/pkgs/_python3.12/distros/conda.txt +++ b/build/pkgs/_python3.12/distros/conda.txt @@ -1 +1 @@ -python==3.12 +python=3.12 diff --git a/build/pkgs/_python3.9/distros/conda.txt b/build/pkgs/_python3.9/distros/conda.txt index ca224649651..23caf0e0ee2 100644 --- a/build/pkgs/_python3.9/distros/conda.txt +++ b/build/pkgs/_python3.9/distros/conda.txt @@ -1 +1 @@ -python==3.9 +python=3.9 From 4a70c1e535bc621bdbe95d8f531375e5700d7c3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Fri, 10 Nov 2023 19:56:31 -0300 Subject: [PATCH 05/19] Exclude external software from --hide=all and --hide=optional --- src/sage/doctest/control.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index 8583d7a447d..633afd5c2e6 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -457,11 +457,15 @@ def __init__(self, options, args): options.hide.discard('all') from sage.features.all import all_features feature_names = {f.name for f in all_features() if not f.is_standard()} + from sage.doctest.external import external_software + feature_names.difference_update(external_software) options.hide = options.hide.union(feature_names) if 'optional' in options.hide: options.hide.discard('optional') from sage.features.all import all_features feature_names = {f.name for f in all_features() if f.is_optional()} + from sage.doctest.external import external_software + feature_names.difference_update(external_software) options.hide = options.hide.union(feature_names) options.disabled_optional = set() From 84fb6dac85ffbab02d69c1594a9ae4a2bccf6c84 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Sun, 12 Nov 2023 13:22:23 +0900 Subject: [PATCH 06/19] Fix pdf doc build --- .github/workflows/doc-build.yml | 2 +- src/doc/Makefile | 14 +++---- src/doc/en/reference/references/index.rst | 7 ++++ .../combinat/species/generating_series.py | 11 +----- src/sage/rings/lazy_series.py | 2 +- src/sage_docbuild/builders.py | 38 +++++++++++++++---- src/sage_docbuild/conf.py | 2 +- 7 files changed, 49 insertions(+), 27 deletions(-) diff --git a/.github/workflows/doc-build.yml b/.github/workflows/doc-build.yml index 3660ff3a947..7d87c9ed4c5 100644 --- a/.github/workflows/doc-build.yml +++ b/.github/workflows/doc-build.yml @@ -206,7 +206,7 @@ jobs: export SAGE_LIVE_DOC=yes export SAGE_JUPYTER_SERVER=binder:sagemath/sage-binder-env/dev make doc-clean doc-uninstall - ./config.status && make sagemath_doc_html-no-deps + ./config.status && make doc-html && make doc-pdf working-directory: ./worktree-image env: MAKE: make -j2 --output-sync=recurse diff --git a/src/doc/Makefile b/src/doc/Makefile index 2f76dfb9cb4..912eb5cb0e9 100644 --- a/src/doc/Makefile +++ b/src/doc/Makefile @@ -46,14 +46,17 @@ doc-inventory-reference: doc-src $(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" doc-inventory--reference_top endif -# reference manual, html -doc-html-reference: doc-inventory-reference +# sub docs of reference manual, html +doc-html-reference-sub: doc-inventory-reference $(eval DOCS = $(shell sage --docbuild --all-documents reference)) @if [ -z "$(DOCS)" ]; then echo "Error: 'sage --docbuild --all-documents' failed"; exit 1; fi $(eval BIBLIO = $(firstword $(DOCS))) $(eval OTHER_DOCS = $(wordlist 2, 100, $(DOCS))) $(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" doc-html--$(subst /,-,$(BIBLIO)) $(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" $(foreach doc, $(OTHER_DOCS), doc-html--$(subst /,-,$(doc))) + +# reference manual, html; reference_top is built after sub docs +doc-html-reference: doc-html-reference-sub $(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" doc-html--reference_top # other documentation, html @@ -79,16 +82,13 @@ doc-pdf-reference: doc-inventory-reference $(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" doc-pdf--reference_top # other documentation, pdf -doc-pdf-other: doc-html-reference +doc-pdf-other: doc-pdf-reference $(eval DOCS = $(shell sage --docbuild --all-documents all)) @if [ -z "$(DOCS)" ]; then echo "Error: 'sage --docbuild --all-documents' failed"; exit 1; fi $(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" $(foreach doc, $(wordlist 2, 100, $(DOCS)), doc-pdf--$(subst /,-,$(doc))) -# website with pdf links -doc-pdf-website: - sage --docbuild website html $(SAGE_DOCBUILD_OPTS) +doc-pdf: doc-pdf-reference doc-pdf-other -doc-pdf: doc-pdf-reference doc-pdf-other doc-pdf-website .PHONY: all clean \ doc-src \ diff --git a/src/doc/en/reference/references/index.rst b/src/doc/en/reference/references/index.rst index d9f406d055d..50b4ad0fead 100644 --- a/src/doc/en/reference/references/index.rst +++ b/src/doc/en/reference/references/index.rst @@ -960,6 +960,13 @@ REFERENCES: .. [BL2003] \S. Brlek, A. Ladouceur, A note on differentiable palindromes, Theoret. Comput. Sci. 302 (2003) 167--178. +.. [BLL1998] \F. Bergeron, G. Labelle, and P. Leroux. + "Combinatorial species and tree-like structures". + Encyclopedia of Mathematics and its Applications, vol. 67, Cambridge Univ. Press. 1998. + +.. [BLL2008] François Bergeron, Gilbert Labelle, and Pierre Leroux. + "Introduction to the Theory of Species of Structures", March 14, 2008. + .. [BraLea2008] \C. Bracken and Gregor Leander: *New families of functions with differential uniformity of 4*, Proceedings of the Conference BFCA, Copenhagen, 2008. diff --git a/src/sage/combinat/species/generating_series.py b/src/sage/combinat/species/generating_series.py index e7f7c8ee978..dca117a9971 100644 --- a/src/sage/combinat/species/generating_series.py +++ b/src/sage/combinat/species/generating_series.py @@ -30,13 +30,6 @@ sage: s[3] # optional - sage.modules p[1, 1, 1] + p[2, 1] -REFERENCES: - -.. [BLL] \F. Bergeron, G. Labelle, and P. Leroux. - "Combinatorial species and tree-like structures". - Encyclopedia of Mathematics and its Applications, vol. 67, Cambridge Univ. Press. 1998. -.. [BLL-Intro] François Bergeron, Gilbert Labelle, and Pierre Leroux. - "Introduction to the Theory of Species of Structures", March 14, 2008. """ # **************************************************************************** @@ -217,7 +210,7 @@ def functorial_composition(self, y): REFERENCES: - - Section 2.2 of [BLL]_. + - Section 2.2 of [BLL1998]_. EXAMPLES:: @@ -651,7 +644,7 @@ def LogarithmCycleIndexSeries(R=QQ): Return the cycle index series of the virtual species `\Omega`, the compositional inverse of the species `E^{+}` of nonempty sets. - The notion of virtual species is treated thoroughly in [BLL]_. + The notion of virtual species is treated thoroughly in [BLL1998]_. The specific algorithm used here to compute the cycle index of `\Omega` is found in [Labelle2008]_. diff --git a/src/sage/rings/lazy_series.py b/src/sage/rings/lazy_series.py index 8086e15f9ef..5fdfb64cea4 100644 --- a/src/sage/rings/lazy_series.py +++ b/src/sage/rings/lazy_series.py @@ -6219,7 +6219,7 @@ def functorial_composition(self, *args): whose labels are the set of all `G`-structures on `A`. The Frobenius character (or cycle index series) of `F \Box G` - can be computed as follows, see section 2.2 of [BLL]_): + can be computed as follows, see section 2.2 of [BLL1998]_): .. MATH:: diff --git a/src/sage_docbuild/builders.py b/src/sage_docbuild/builders.py index 323c9247252..c79b61c1506 100644 --- a/src/sage_docbuild/builders.py +++ b/src/sage_docbuild/builders.py @@ -637,17 +637,21 @@ def pdf(self): """ super().pdf() - # we need to build master index file which lists all - # of the PDF file. So we create an html file, based on - # the file index.html from the "reference_top" target. - - # First build the top reference page. This only takes a few seconds. - getattr(get_builder('reference_top'), 'html')() + # We want to build master index file which lists all of the PDF file. + # We modify the file index.html from the "reference_top" target, if it + # exists. Otherwise, we are done. from sage.env import SAGE_DOC reference_dir = os.path.join(SAGE_DOC, 'html', 'en', 'reference') output_dir = self._output_dir('pdf') + # Check if the top reference index.html exists. + try: + with open(os.path.join(reference_dir, 'index.html')) as f: + html = f.read() + except FileNotFoundError: + return + # Install in output_dir a symlink to the directory containing static files. # Prefer relative path for symlinks. relpath = os.path.relpath(reference_dir, output_dir) @@ -657,8 +661,6 @@ def pdf(self): pass # Now modify top reference index.html page and write it to output_dir. - with open(os.path.join(reference_dir, 'index.html')) as f: - html = f.read() html_output_dir = os.path.dirname(reference_dir) # Fix links in navigation bar @@ -1051,13 +1053,33 @@ def get_modules(self, filename): Given a filename for a reST file, return an iterator for all of the autogenerated reST files that it includes. """ + from sage.features.all import all_features + # Create the regular expression used to detect an autogenerated file auto_re = re.compile(r'^\s*(..\/)*(sage(_docbuild)?\/[\w\/]*)\s*$') # Read the lines with open(filename) as f: lines = f.readlines() + + skip = False for line in lines: + if skip: + if not line.strip() or line.count(' ', 0) >= indent: + continue + skip = False + elif line.lstrip().lower().startswith('.. only::'): + try: + tag_name = line[line.index('feature_') + 8:].strip() + for feature in all_features(): + if tag_name == feature.name.replace('.', '_'): + break + else: + skip = True + indent = line.index('.. ') + 3 + continue + except ValueError: + pass match = auto_re.match(line) if match: yield match.group(2).replace(os.path.sep, '.') diff --git a/src/sage_docbuild/conf.py b/src/sage_docbuild/conf.py index 93333c2509d..8602016d042 100644 --- a/src/sage_docbuild/conf.py +++ b/src/sage_docbuild/conf.py @@ -296,7 +296,7 @@ def set_intersphinx_mappings(app, config): intersphinx.normalize_intersphinx_mapping(app, config) -# By default document are not master. +# By default document is master. multidocs_is_master = True # https://sphinx-copybutton.readthedocs.io/en/latest/use.html From 907276a710c25df6aea8a09dc6c8f8621f7eda5e Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Sun, 12 Nov 2023 13:47:22 +0900 Subject: [PATCH 07/19] Revert live doc - no pdfs --- .github/workflows/doc-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/doc-build.yml b/.github/workflows/doc-build.yml index 7d87c9ed4c5..3660ff3a947 100644 --- a/.github/workflows/doc-build.yml +++ b/.github/workflows/doc-build.yml @@ -206,7 +206,7 @@ jobs: export SAGE_LIVE_DOC=yes export SAGE_JUPYTER_SERVER=binder:sagemath/sage-binder-env/dev make doc-clean doc-uninstall - ./config.status && make doc-html && make doc-pdf + ./config.status && make sagemath_doc_html-no-deps working-directory: ./worktree-image env: MAKE: make -j2 --output-sync=recurse From 8912679e891e4ea8e8383a2110df66738b7c80c9 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Sun, 12 Nov 2023 19:57:29 +0900 Subject: [PATCH 08/19] Revive pdf docs index page --- src/doc/en/website/root_index.html | 2 +- src/doc/en/website/templates/index.html | 54 ++++++++++---------- src/doc/en/website/templates/index_furo.html | 54 ++++++++++---------- src/sage_docbuild/builders.py | 33 ++++++++++-- 4 files changed, 83 insertions(+), 60 deletions(-) diff --git a/src/doc/en/website/root_index.html b/src/doc/en/website/root_index.html index 21a6086ed72..c3d25ff495b 100644 --- a/src/doc/en/website/root_index.html +++ b/src/doc/en/website/root_index.html @@ -118,7 +118,7 @@

Sage Documentation

PREP Tutorials
Constructions
FAQ
-
Reference Manual
+
Reference Manual
Installation Guide
Developer Guide
diff --git a/src/doc/en/website/templates/index.html b/src/doc/en/website/templates/index.html index c63d109b4dc..cad4cbc287a 100644 --- a/src/doc/en/website/templates/index.html +++ b/src/doc/en/website/templates/index.html @@ -44,12 +44,12 @@

markup. start = rst.rfind('*\n') + 1 end = rst.find('\nUser Interfaces') @@ -725,7 +748,7 @@ def pdf(self): rst_toc = re.sub(r'\n([A-Z][a-zA-Z, ]*)\n[-]*\n', r'\n\n\n

\1

\n\n
    \n', rst_toc) # now write the file. - with open(os.path.join(output_dir, 'index.html'), 'w') as new_index: + with open(os.path.join(output_dir, 'index-pdf.html'), 'w') as new_index: new_index.write(html[:html_end_preamble]) new_index.write('

    Sage Reference Manual (PDF version)

    ') new_index.write(rst_body) From dc2f4fe34e4a03c62817d22198ae8f89313f33ab Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Sun, 12 Nov 2023 23:59:29 +0900 Subject: [PATCH 09/19] Make pdf links tidy --- src/sage_docbuild/builders.py | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/src/sage_docbuild/builders.py b/src/sage_docbuild/builders.py index b113724789b..63aa1145154 100644 --- a/src/sage_docbuild/builders.py +++ b/src/sage_docbuild/builders.py @@ -690,9 +690,6 @@ def pdf(self): html = re.sub(r'Sage(.*)Documentation', r'Sage\2Documentation', html) - html = re.sub(r'Reference Manual', - r'Reference Manual (PDF version)', - html) html = re.sub(r'
  • ', r'