diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 2c60154383..1db4a6d199 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -28,10 +28,17 @@ jobs: with: fetch-depth: 2 - - name: "Setup" + - name: Install Python + uses: actions/setup-python@v6 + with: + python-version: "3.13" + + - name: Install uv + uses: astral-sh/setup-uv@v7 + + - name: "Install Python dependencies" run: | - sudo apt-get update - sudo apt-get install -y python3-sphinx + uv pip install --system -r doc/requirements.txt sphinx-build --version - name: "Build documentation" @@ -42,6 +49,7 @@ jobs: - name: "Setup LaTeX" if: github.repository == 'flintlib/flint' && github.event_name == 'push' && github.ref == 'refs/heads/main' run: | + sudo apt-get update # See https://www.sphinx-doc.org/en/master/usage/builders/index.html#sphinx.builders.latex.LaTeXBuilder sudo apt-get install -y texlive-latex-recommended texlive-fonts-recommended texlive-fonts-extra tex-gyre texlive-latex-extra latexmk diff --git a/.gitignore b/.gitignore index ce3195baac..4bc8073979 100644 --- a/.gitignore +++ b/.gitignore @@ -66,3 +66,5 @@ config.m4 src/flint-mparam.h .gdb_history vgcore.* +.venv/ +venv/ \ No newline at end of file diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 0000000000..7bb5d13728 --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1,3 @@ +# Sphinx documentation dependencies +sphinx>=9.0 +sphinx_clarity_theme==1.0.2 \ No newline at end of file diff --git a/doc/source/_static/default.css b/doc/source/_static/default.css deleted file mode 100644 index 019ab8d02b..0000000000 --- a/doc/source/_static/default.css +++ /dev/null @@ -1,23 +0,0 @@ -@import url("pygments.css"); -@import url("classic.css"); - -body { font-family: "arial", sans-serif; } - -div .toctree-wrapper { column-count: 2; } - -div .toctree-wrapper > ul { margin: 0; } - -ul .toctree-l1 { - margin: 0; - -webkit-column-break-inside: avoid; - page-break-inside: avoid; - break-inside: avoid-column; -} - -div.body { - min-width: 450px; - max-width: 100%; -} - -li p { margin: 0.2em; } - diff --git a/doc/source/_static/styles/custom.css b/doc/source/_static/styles/custom.css new file mode 100644 index 0000000000..b99ba99b27 --- /dev/null +++ b/doc/source/_static/styles/custom.css @@ -0,0 +1,37 @@ +/* More dense API signatures */ +dt.sig { + margin: 0 !important; + border: 0 !important; + border-bottom: 1px solid var(--color-base-100) !important; +} + +dt { + font-weight: normal !important; +} + +/* -- object description styles --------------------------------------------- */ + +.sig-name { + font-weight: bold; +} + +.sig-param.n { + font-style: italic; +} + +/* C++ specific styling */ + +.sig.c .k, .sig.c .kt, +.sig.cpp .k, .sig.cpp .kt { + color: #0033B3; +} + +.sig.c .m, +.sig.cpp .m { + color: #1750EB; +} + +.sig.c .s, .sig.c .sc, +.sig.cpp .s, .sig.cpp .sc { + color: #067D17; +} diff --git a/doc/source/conf.py b/doc/source/conf.py index ddad93c724..4efad5172f 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -91,11 +91,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'default' - -html_context = { - 'css_files': ['_static/default.css'], -} +html_theme = 'sphinx_clarity_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -103,16 +99,6 @@ # html_theme_options = { - 'sidebarwidth' : 300, - 'collapsiblesidebar': True, - 'bodyfont': "'arial', sans-serif", - 'headfont': "'arial', sans-serif", - 'sidebarbtncolor': '#666', - 'sidebarbgcolor': '#444', - 'sidebarlinkcolor': '#ddd', - 'relbarbgcolor': '#333', - 'footerbgcolor': '#333', - 'headbgcolor': '#fff', } # Add any paths that contain custom static files (such as style sheets) here, @@ -130,6 +116,8 @@ # # html_sidebars = {} +html_css_files = ["styles/custom.css"] + # -- Options for HTMLHelp output --------------------------------------------- diff --git a/doc/source/index.rst b/doc/source/index.rst index bc1afa25a8..a649f645f2 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -22,6 +22,7 @@ Introduction .. toctree:: :maxdepth: 1 + :caption: Introduction introduction.rst building.rst @@ -38,6 +39,7 @@ General utilities .. toctree:: :maxdepth: 1 + :caption: General utilities flint.rst profiler.rst @@ -50,6 +52,7 @@ Generic rings .. toctree:: :maxdepth: 1 + :caption: Generic rings gr.rst gr_implementing.rst @@ -74,6 +77,7 @@ Integers .. toctree:: :maxdepth: 1 + :caption: Integers ulong_extras.rst fmpz.rst @@ -109,6 +113,7 @@ Rational numbers .. toctree:: :maxdepth: 1 + :caption: Rational numbers fmpq.rst fmpq_vec.rst @@ -131,6 +136,7 @@ Integers mod n .. toctree:: :maxdepth: 1 + :caption: Integers mod n nmod.rst nmod_vec.rst @@ -162,6 +168,7 @@ Groups and other structures .. toctree:: :maxdepth: 1 + :caption: Groups and other structures perm.rst qfb.rst @@ -174,6 +181,7 @@ Number fields and algebraic numbers .. toctree:: :maxdepth: 1 + :caption: Number fields and algebraic numbers nf.rst nf_elem.rst @@ -185,6 +193,7 @@ Real and complex numbers .. toctree:: :maxdepth: 1 + :caption: Real and complex numbers overview.rst using.rst @@ -235,6 +244,7 @@ Exact real and complex numbers .. toctree:: :maxdepth: 1 + :caption: Exact real and complex numbers introduction_calcium.rst examples_calcium.rst @@ -253,6 +263,7 @@ Finite fields .. toctree:: :maxdepth: 1 + :caption: Finite fields fq.rst fq_default.rst @@ -292,6 +303,7 @@ p-adic numbers .. toctree:: :maxdepth: 1 + :caption: p-adic numbers padic.rst padic_poly.rst @@ -303,6 +315,7 @@ Floating-point support code .. toctree:: :maxdepth: 1 + :caption: Floating-point support code double_extras.rst double_interval.rst @@ -314,6 +327,7 @@ Interfaces .. toctree:: :maxdepth: 1 + :caption: Interfaces python_flint.rst @@ -322,6 +336,7 @@ References .. toctree:: :maxdepth: 1 + :caption: References references.rst @@ -330,5 +345,6 @@ Version history .. toctree:: :maxdepth: 1 + :caption: Version history history.rst