Skip to content

Commit

Permalink
Read cudf.__version__ in Sphinx build (#14872)
Browse files Browse the repository at this point in the history
Rather than hard-coding the version number in the Sphinx config, dynamically read `cudf.__version__`.

Authors:
  - Kyle Edwards (https://github.com/KyleFromNVIDIA)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - Vyas Ramasubramani (https://github.com/vyasr)
  - Ray Douglass (https://github.com/raydouglass)

URL: #14872
  • Loading branch information
KyleFromNVIDIA authored Feb 22, 2024
1 parent 296185c commit 4e39e71
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
6 changes: 0 additions & 6 deletions ci/release/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ sed_runner 's/'"branch-.*\/cmake-format-rapids-cmake.json"'/'"branch-${NEXT_SHOR
# doxyfile update
sed_runner 's/PROJECT_NUMBER = .*/PROJECT_NUMBER = '${NEXT_FULL_TAG}'/g' cpp/doxygen/Doxyfile

# sphinx docs update
sed_runner 's/version = .*/version = "'${NEXT_SHORT_TAG}'"/g' docs/cudf/source/conf.py
sed_runner 's/release = .*/release = "'${NEXT_FULL_TAG}'"/g' docs/cudf/source/conf.py
sed_runner 's/version = .*/version = "'${NEXT_SHORT_TAG}'"/g' docs/dask_cudf/source/conf.py
sed_runner 's/release = .*/release = "'${NEXT_FULL_TAG}'"/g' docs/dask_cudf/source/conf.py

DEPENDENCIES=(
cudf
cudf_kafka
Expand Down
13 changes: 9 additions & 4 deletions docs/cudf/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import datetime
import filecmp
import glob
import os
Expand All @@ -25,12 +26,15 @@
import xml.etree.ElementTree as ET

from docutils.nodes import Text
from packaging.version import Version
from sphinx.addnodes import pending_xref
from sphinx.highlighting import lexers
from sphinx.ext import intersphinx
from pygments.lexer import RegexLexer
from pygments.token import Text as PText

import cudf


class PseudoLexer(RegexLexer):
"""Trivial lexer for pseudocode."""
Expand Down Expand Up @@ -172,17 +176,18 @@ def clean_all_xml_files(path):

# General information about the project.
project = "cudf"
copyright = "2018-2023, NVIDIA Corporation"
copyright = f"2018-{datetime.datetime.today().year}, NVIDIA Corporation"
author = "NVIDIA Corporation"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
CUDF_VERSION = Version(cudf.__version__)
# The short X.Y version.
version = "24.04"
# The full version, including alpha/beta/rc tags.
release = "24.04.00"
version = f"{CUDF_VERSION.major:02}.{CUDF_VERSION.minor:02}"
# The full version.
release = f"{CUDF_VERSION.major:02}.{CUDF_VERSION.minor:02}.{CUDF_VERSION.micro:02}"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
15 changes: 12 additions & 3 deletions docs/dask_cudf/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,20 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

import datetime

from packaging.version import Version

import dask_cudf


DASK_CUDF_VERSION = Version(dask_cudf.__version__)

project = "dask-cudf"
copyright = "2018-2023, NVIDIA Corporation"
copyright = f"2018-{datetime.datetime.today().year}, NVIDIA Corporation"
author = "NVIDIA Corporation"
version = "24.04"
release = "24.04.00"
version = f"{DASK_CUDF_VERSION.major:02}.{DASK_CUDF_VERSION.minor:02}"
release = f"{DASK_CUDF_VERSION.major:02}.{DASK_CUDF_VERSION.minor:02}.{DASK_CUDF_VERSION.micro:02}"

language = "en"

Expand Down

0 comments on commit 4e39e71

Please sign in to comment.