Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ find_package(resolv)

if(ENABLE_DOCS OR ENABLE_AUTEST)
find_package(Python3 REQUIRED)
find_program(PipEnv pipenv REQUIRED)
find_program(UV uv REQUIRED)
find_program(NETCAT_PROGRAM nc REQUIRED)
endif()

Expand Down
4 changes: 3 additions & 1 deletion ci/docker/deb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,7 @@ RUN apt-get update; apt-get -y dist-upgrade; \
mkdir -p /var/jenkins && chown jenkins.jenkins /var/jenkins

# This is for autest stuff, skipping since it's pulling in a *lot* ...
# apt-get -y install python3 httpd-tools procps-ng nmap-ncat pipenv \
# apt-get -y install python3 httpd-tools procps-ng nmap-ncat \
# python3-virtualenv python3-gunicorn python3-requests python3-httpbin; \
# Install uv for Python environment management:
# curl -LsSf https://astral.sh/uv/install.sh | sh
4 changes: 3 additions & 1 deletion ci/docker/yum/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ RUN yum -y update; \
ImageMagick-devel ImageMagick-c++-devel hiredis-devel zlib-devel zstd-devel \
perl-ExtUtils-MakeMaker perl-Digest-SHA perl-URI; \
# This is for autest stuff
yum -y install python3 httpd-tools procps-ng nmap-ncat pipenv \
yum -y install python3 httpd-tools procps-ng nmap-ncat \
python3-virtualenv python3-gunicorn python3-requests python3-httpbin; \
# Install uv for Python environment management
curl -LsSf https://astral.sh/uv/install.sh | sh; \
# Optional: This is for the OpenSSH server, and Jenkins account + access (comment out if not needed)
yum -y install java openssh-server && ssh-keygen -A; rm -f /run/nologin; \
groupadd -g 665 jenkins && \
Expand Down
62 changes: 26 additions & 36 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,69 +74,59 @@ foreach(UML ${UML_FILES})
endforeach()
add_custom_target(generate_svg_from_uml DEPENDS ${SVG_FILES})

# Docs are built with python so we need a target to setup pipenv
# Copy Pipfile to build directory and explicitly point pipenv to it
# PIPENV_VENV_IN_PROJECT=1 creates .venv next to the Pipfile location (if not already in a venv)
# PIPENV_VERBOSITY=-1 suppresses warnings
# If user is already in a virtualenv, pipenv will use it; otherwise creates one in build dir
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Pipfile ${CMAKE_CURRENT_BINARY_DIR}/Pipfile COPYONLY)
set(RUNPIPENV PIPENV_PIPFILE=${CMAKE_CURRENT_BINARY_DIR}/Pipfile PIPENV_VENV_IN_PROJECT=1 PIPENV_VERBOSITY=-1 ${PipEnv})
# Create a marker file to indicate pipenv setup is complete
# This is more reliable than using Pipfile.lock which might already exist
# Docs are built with python so we need a target to setup the virtual environment.
# Copy pyproject.toml to build directory and use uv to manage dependencies.
# uv creates .venv in the project directory by default.
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pyproject.toml ${CMAKE_CURRENT_BINARY_DIR}/pyproject.toml COPYONLY)
set(RUNUV ${UV} --project ${CMAKE_CURRENT_BINARY_DIR})
# Create a marker file to indicate uv setup is complete.
add_custom_command(
OUTPUT .pipenv_installed
COMMAND ${RUNPIPENV} install --python ${Python3_EXECUTABLE}
COMMAND ${CMAKE_COMMAND} -E touch .pipenv_installed
COMMENT "Setup pipenv in build directory (${CMAKE_CURRENT_BINARY_DIR}/.venv) and install packages"
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Pipfile
OUTPUT .uv_installed
COMMAND ${RUNUV} sync
COMMAND ${CMAKE_COMMAND} -E touch .uv_installed
COMMENT "Setup uv virtual environment in build directory (${CMAKE_CURRENT_BINARY_DIR}/.venv) and install packages"
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/pyproject.toml
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
VERBATIM
)

add_custom_target(
generate_docs
COMMAND ${CMAKE_COMMAND} -E env "JAVA_TOOL_OPTIONS=-Djava.awt.headless=true -Dapple.awt.UIElement=true" ${RUNPIPENV}
run python ${CMAKE_CURRENT_SOURCE_DIR}/checkvers.py --check-version
COMMAND ${CMAKE_COMMAND} -E env "JAVA_TOOL_OPTIONS=-Djava.awt.headless=true -Dapple.awt.UIElement=true" ${RUNPIPENV}
run python -m sphinx -W -c ${CMAKE_CURRENT_BINARY_DIR} -b html ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E env "JAVA_TOOL_OPTIONS=-Djava.awt.headless=true -Dapple.awt.UIElement=true" ${RUNUV} run
python ${CMAKE_CURRENT_SOURCE_DIR}/checkvers.py --check-version
COMMAND ${CMAKE_COMMAND} -E env "JAVA_TOOL_OPTIONS=-Djava.awt.headless=true -Dapple.awt.UIElement=true" ${RUNUV} run
python -m sphinx -W -c ${CMAKE_CURRENT_BINARY_DIR} -b html ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/docbuild/html
DEPENDS generate_docs_setup .pipenv_installed
DEPENDS generate_docs_setup .uv_installed
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Sphinx PlantUML extension now generates diagrams automatically in build tree"
)
# Generate PDF documentation (Letter paper size - US standard)
add_custom_target(
generate_pdf
COMMAND ${CMAKE_COMMAND} -E env "JAVA_TOOL_OPTIONS=-Djava.awt.headless=true -Dapple.awt.UIElement=true" ${RUNPIPENV}
run python ${CMAKE_CURRENT_SOURCE_DIR}/checkvers.py --check-version
COMMAND ${CMAKE_COMMAND} -E env "JAVA_TOOL_OPTIONS=-Djava.awt.headless=true -Dapple.awt.UIElement=true" ${RUNPIPENV}
run python -m sphinx -c ${CMAKE_CURRENT_BINARY_DIR} -b latex -t latex_paper ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E env "JAVA_TOOL_OPTIONS=-Djava.awt.headless=true -Dapple.awt.UIElement=true" ${RUNUV} run
python ${CMAKE_CURRENT_SOURCE_DIR}/checkvers.py --check-version
COMMAND ${CMAKE_COMMAND} -E env "JAVA_TOOL_OPTIONS=-Djava.awt.headless=true -Dapple.awt.UIElement=true" ${RUNUV} run
python -m sphinx -c ${CMAKE_CURRENT_BINARY_DIR} -b latex -t latex_paper ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/docbuild/latex
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_BINARY_DIR}/docbuild/latex latexmk -pdf -interaction=nonstopmode -f
ApacheTrafficServer.tex
DEPENDS generate_docs_setup .pipenv_installed
DEPENDS generate_docs_setup .uv_installed
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Building PDF documentation with Sphinx and LaTeX (Letter paper, PlantUML generates PNG automatically)"
)

# Generate PDF documentation (A4 paper size - International standard)
add_custom_target(
generate_pdf_a4
COMMAND ${CMAKE_COMMAND} -E env "JAVA_TOOL_OPTIONS=-Djava.awt.headless=true -Dapple.awt.UIElement=true" ${RUNPIPENV}
run python ${CMAKE_CURRENT_SOURCE_DIR}/checkvers.py --check-version
COMMAND ${CMAKE_COMMAND} -E env "JAVA_TOOL_OPTIONS=-Djava.awt.headless=true -Dapple.awt.UIElement=true" ${RUNPIPENV}
run python -m sphinx -c ${CMAKE_CURRENT_BINARY_DIR} -b latex -t latex_a4 ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E env "JAVA_TOOL_OPTIONS=-Djava.awt.headless=true -Dapple.awt.UIElement=true" ${RUNUV} run
python ${CMAKE_CURRENT_SOURCE_DIR}/checkvers.py --check-version
COMMAND ${CMAKE_COMMAND} -E env "JAVA_TOOL_OPTIONS=-Djava.awt.headless=true -Dapple.awt.UIElement=true" ${RUNUV} run
python -m sphinx -c ${CMAKE_CURRENT_BINARY_DIR} -b latex -t latex_a4 ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/docbuild/latex-a4
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_BINARY_DIR}/docbuild/latex-a4 latexmk -pdf -interaction=nonstopmode
-f ApacheTrafficServer.tex
DEPENDS generate_docs_setup .pipenv_installed
DEPENDS generate_docs_setup .uv_installed
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Building PDF documentation with Sphinx and LaTeX (A4 paper, PlantUML generates PNG automatically)"
)

#add_custom_command(
# TARGET generate_docs
# POST_BUILD
# COMMAND ${RUNPIPENV} --rm
# COMMENT "Cleaning up pipenv"
#)
12 changes: 6 additions & 6 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ This directory contains the source code for Traffic Server documentation.

## Package Requirements
Traffic Server documentation is built using the Sphinx documentation generator.
The Sphinx build tool is distributed as a Python package. A Pipfile is provided
to conveniently configure a Python virtual environment with the needed Sphinx
packages.
The Sphinx build tool is distributed as a Python package. A `pyproject.toml` is
provided to conveniently configure a Python virtual environment with the needed
Sphinx packages via uv.

In addition to the Sphinx Python package requirements, building the
documentation will also require Java and graphviz system packages to be
documentation will also require Java, graphviz, and uv system packages to be
installed.

## Build Steps
Building the docs requires passing `-DENABLE_DOCS=ON` to cmake (docs generation
is off by default), and then using the appropriate build target. The build steps
will automatically install a Pipenv virtual environment using `docs/Pipfile` and
do what is necessary to build the docs.
will automatically install a virtual environment via uv using `doc/pyproject.toml`
and do what is necessary to build the docs.

### Building HTML Documentation
```sh
Expand Down
16 changes: 9 additions & 7 deletions doc/developer-guide/documentation/building.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,18 @@ System installs
python3
Python 3 is required. The build system will use this to create a virtual environment.

pipenv
Used to manage Python dependencies. Install with ``pip3 install pipenv`` or your system package manager.
uv
Used to manage Python dependencies. See from https://docs.astral.sh/uv/getting-started/installation/
for installation instructions. ``curl -LsSf https://astral.sh/uv/install.sh | sh``, or
or ``pip3 install uv``, or your system package manager.

Python packages
Python dependencies are managed automatically via `pipenv <https://docs.pipenv.org/>`__
and the :ts:git:`doc/Pipfile`. The build system will automatically create a virtual environment
Python dependencies are managed automatically via `uv <https://docs.astral.sh/uv/>`__
and the :ts:git:`doc/pyproject.toml`. The build system will automatically create a virtual environment
and install all required packages (including Sphinx, sphinx-rtd-theme, sphinxcontrib-plantuml,
sphinx-intl for internationalization, and other dependencies) when you build the documentation.

You do not need to manually install these packages or set up pipenv yourself - the CMake build
You do not need to manually install these packages or set up uv yourself - the CMake build
targets handle this automatically.

Building the documentation
Expand All @@ -72,8 +74,8 @@ With CMake configured with ``-DENABLE_DOCS=ON``, building the documentation is s

The build system will automatically:

1. Create a pipenv virtual environment in the build directory
2. Install all required Python packages from :ts:git:`doc/Pipfile`
1. Create a virtual environment in the build directory via uv
2. Install all required Python packages from :ts:git:`doc/pyproject.toml`
3. Generate the documentation

For repeated builds while working on the documentation, simply run the build command again.
Expand Down
1 change: 0 additions & 1 deletion doc/developer-guide/testing/autests.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ If |TS| cmake build is configured via ``-DENABLE_AUTEST=ON``, tests can be run w
cmake --build build
cmake --install build
cd build/tests
pipenv install
./autest.sh --sandbox /tmp/sbcursor --clean=none -f <test_name_without_test_py_extension>

For example, to run ``cache-auth.test.py``:
Expand Down
Loading