Skip to content

Fix sphinx warnings - #2062

Merged
JeanChristopheMorinPerso merged 11 commits into
AcademySoftwareFoundation:mainfrom
JeanChristopheMorinPerso:fix_sphinx_warnings
May 9, 2026
Merged

JeanChristopheMorinPerso merged 11 commits into
AcademySoftwareFoundation:mainfrom
JeanChristopheMorinPerso:fix_sphinx_warnings

Conversation

@JeanChristopheMorinPerso

@JeanChristopheMorinPerso JeanChristopheMorinPerso commented Jan 3, 2026 •

Copy link
Copy Markdown
Member

Fix Sphinx warnings caused by duplicate symbols by introducing two new Sphinx domains: rex and pkgdef.

This makes it possible to reference package attributes in the docs using :pkgdef:attr for example, and stuff in commands using :rex:attr.

This removes any duplicates in symbols. These new domains won't affect users reading our docs in any way, but it will have an impact on any user that are cross-linking our docs using intersphinx (https://docs.readthedocs.com/platform/latest/guides/intersphinx.html). These users will have to update references to :data:version, etc to use our domains instead.

I also fixed some more warnings that were not related to the duplicate symbols, and modified the CLI docs auto-generation code to improve the readability of the docs a little bit (please look at https://rez--2062.org.readthedocs.build/en/2062/commands_index.html?readthedocs-diff=true to visualize the diff).

AI disclosure:

The custom domains code was written using Amp. Here are the threads:

@codecov

codecov Bot commented Jan 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.04%. Comparing base (d9e2211) to head (2dc112d).
⚠️ Report is 48 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2062      +/-   ##
==========================================
- Coverage   60.05%   60.04%   -0.01%     
==========================================
  Files         164      164              
  Lines       20559    20559              
  Branches     3571     3571              
==========================================
- Hits        12346    12344       -2     
- Misses       7345     7346       +1     
- Partials      868      869       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses Sphinx build warnings caused by duplicate symbols by introducing two new Sphinx domains (rex and pkgdef) and updating documentation cross-references to use them. It also includes several smaller docstring/help-text adjustments and changes to the CLI docs auto-generation for readability.

Changes:

  • Add custom Sphinx domains (rex, pkgdef) to disambiguate symbols and update docs to reference them (eg :pkgdef:attr:, :rex:func:).
  • Adjust multiple docs/docstrings to reduce Sphinx warnings and improve cross-linking clarity.
  • Update CLI docs generation ordering/formatting and default/choices presentation.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
docs/rez_sphinxext.py Adds rex/pkgdef Sphinx domains and modifies CLI RST auto-generation.
src/rez/rezconfig.py Updates config documentation cross-references to use new domains.
src/rez/package_test.py Updates docstring cross-references to pkgdef domain.
src/rez/package_copy.py Updates docstring cross-reference for relocatable.
src/rez/package_cache.py Docstring tweaks (logging.Logger typing, :meth: role).
src/rez/cli/selftest.py Help text typo/format fix for pytest flag reference.
src/rez/cli/search.py Help text example formatting tweak.
src/rez/cli/env.py Help text formatting tweak for -c flag reference.
src/rez/build_process.py Docstring deprecation wording/format adjustment.
docs/source/variants.rst Switch attribute references to pkgdef domain.
docs/source/suites.rst Switch attribute references to pkgdef domain.
docs/source/package_orderers.rst Switch attribute references to pkgdef domain.
docs/source/package_definition.rst Large sweep updating roles/directives to pkgdef and rex domains.
docs/source/package_commands.rst Updates directives/roles to rex/pkgdef and refines wording.
docs/source/managing_packages.rst Updates relocatable reference to pkgdef domain.
docs/source/ephemerals.rst Updates commands/rex object references to new domains.
docs/source/environment.rst Updates commands and build-requires attribute references to pkgdef.
docs/source/context.rst Updates commands references to pkgdef domain.
docs/source/caching.rst Updates cachable references to pkgdef domain.
docs/source/building_packages.rst Updates build-related attribute references to pkgdef/rex.
docs/source/basic_concepts.rst Updates introductory references to pkgdef domain.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/rez_sphinxext.py
Comment on lines +453 to +455
# Avoid Sphinx warnings. Escape * only if it's not surrounded by
# double backticks.
help_str = re.sub(r"[^`]{2}(\*)[^`]{2}", r"\1", help_str)
Comment thread docs/rez_sphinxext.py
Comment on lines 457 to 460
# Replace everything that looks like an argument with an option directive.
help_str = re.sub(r"(?<!\w)-[a-zA-Z](?=\s|\/|\)|\.?$)|(?<!\w)--[a-zA-Z-0-9]+(?=\s|\/|\)|\.?$)", r":option:`\g<0>`", help_str)
help_str = help_str.replace("--", "\\--")
help_str = re.sub(r"(?<!\w)-[a-zA-Z](?![\w=])(?=\s|\/|\)|\.?)|(?<!\w)--[a-zA-Z-0-9]+(?![\w=])(?=\s|\/|\)|\.?)", r":option:`\g<0>`", help_str)
help_str = re.sub(r"[^` ]{2}(--)", "\\--", help_str)

Comment thread docs/rez_sphinxext.py
document.append("")
document.append(f" Choices: {', '.join(action.choices)}")
document.append(f" **Choices**: {', '.join(f'``{choice}``' for choice in action.choices)}")
if default and default != sentinel:
Comment thread docs/rez_sphinxext.py Outdated
Comment on lines +119 to +121
A Python-like domain that:
1. Uses fixed directives that register objects in the correct domain
2. Falls back to bare-name resolution when qualified name resolution fails
Comment thread docs/rez_sphinxext.py Outdated
Comment thread src/rez/rezconfig.py Outdated
Comment thread docs/source/context.rst Outdated
Comment thread docs/source/managing_packages.rst
Comment thread docs/source/caching.rst Outdated
Comment thread docs/source/package_commands.rst Outdated
JeanChristopheMorinPerso and others added 9 commits May 9, 2026 18:24
…w Sphinx domains: rex and pkgdef.

Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
@JeanChristopheMorinPerso
JeanChristopheMorinPerso marked this pull request as ready for review May 9, 2026 22:52
@JeanChristopheMorinPerso
JeanChristopheMorinPerso requested a review from a team as a code owner May 9, 2026 22:52
Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
Comment thread docs/source/caching.rst
not be cached. To make a package cachable, you can set :attr:`cachable`
to False in its package definition file. Reasons you may *not* want to do this include
not be cached. To make a package cachable, you can set :pkgdef:attr:`cachable`
to True in its package definition file. Reasons you may *not* want to do this include

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh.

@maxnbk maxnbk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than the Copilot regexes, unsure about those comments

@JeanChristopheMorinPerso
JeanChristopheMorinPerso merged commit 67eaf82 into AcademySoftwareFoundation:main May 9, 2026
63 checks passed
@JeanChristopheMorinPerso
JeanChristopheMorinPerso deleted the fix_sphinx_warnings branch May 22, 2026 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants