Fix Sphinx configuration post-update (#5588)

Adjust Sphinx configuration and release script

Changes:

- Update `source_suffix` in docs/conf.py to use dict format as required
by newer Sphinx
  versions
- Fix typo in theme config: `pygment_light_style` ->
`pygments_light_style`
- Improve release script to handle Sphinx intersphinx output formatting:
  - Replace tabs with spaces for consistent parsing
  - Add reference to sphinx.ext.intersphinx command in docstring
  - Update line parsing to match space-indented format
- Restructure CI workflow to ensure relevant dependencies are installed
and changelog formatting is tested.

These changes ensure compatibility with newer Sphinx versions and
improve the robustness
of the release script's reference parsing.

Edit:

While working on this PR GitHub decided to upgrade their linux/ubuntu
runners with `Ubuntu 24.04`. Ubuntu upgrades are the worst: imagine not
updating your system for 3 years and then suddenly upgrading
**everything** to the most recent versions. At which point you start
realizing that the final **S** in their **LTS** means __Suffering__
instead of __Support__.

We use just a few system dependencies in our builds and as expected,
things broke:
* `libcairo2-dev` now needs to be installed for pygobject.
* `pandoc` `rst` -> `markdown` conversion output has changed
* Completion tests are unhappy about `bash` / `bash-completion` upgrade,
and I could not figure out why so I'm just `xfail`ing that test in CI.
This commit is contained in:
Šarūnas Nejus 2025-01-19 01:06:00 +00:00 committed by GitHub
commit f4097410eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 32 additions and 29 deletions

View file

@ -33,23 +33,26 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt update
sudo apt install ffmpeg gobject-introspection libgirepository1.0-dev pandoc
poetry install --with=release --extras=docs --extras=replaygain --extras=reflink
poe docs
sudo apt install ffmpeg gobject-introspection libcairo2-dev libgirepository1.0-dev pandoc
- name: Install Python dependencies
run: poetry install --only=main,test --extras=autobpm
- if: ${{ env.IS_MAIN_PYTHON != 'true' }}
name: Test without coverage
run: poe test
- if: ${{ env.IS_MAIN_PYTHON == 'true' }}
name: Test with coverage
- name: Add pytest annotator
uses: liskin/gh-problem-matcher-wrap@v3
with:
linters: pytest
run: poe test-with-coverage
action: add
- if: ${{ env.IS_MAIN_PYTHON != 'true' }}
name: Test without coverage
run: |
poetry install --extras=autobpm
poe test
- if: ${{ env.IS_MAIN_PYTHON == 'true' }}
name: Test with coverage
run: |
poetry install --extras=autobpm --extras=docs --extras=replaygain --extras=reflink
poe docs
poe test-with-coverage
- if: ${{ env.IS_MAIN_PYTHON == 'true' }}
name: Store the coverage report

View file

@ -5,7 +5,7 @@ AUTHOR = "Adrian Sampson"
extensions = ["sphinx.ext.autodoc", "sphinx.ext.extlinks"]
exclude_patterns = ["_build"]
source_suffix = ".rst"
source_suffix = {".rst": "restructuredtext"}
master_doc = "index"
project = "beets"
@ -61,13 +61,7 @@ man_pages = [
# Options for pydata theme
html_theme = "pydata_sphinx_theme"
html_theme_options = {
"collapse_navigation": True,
"logo": {
"text": "beets",
},
"pygment_light_style": "bw",
}
html_theme_options = {"collapse_navigation": True, "logo": {"text": "beets"}}
html_title = "beets"
html_logo = "_static/beets_logo_nobg.png"
html_static_path = ["_static"]

View file

@ -46,6 +46,8 @@ class Ref(NamedTuple):
Each line has the following structure:
<id> [optional title : ] <relative-url-path>
See the output of
python -m sphinx.ext.intersphinx docs/_build/html/objects.inv
"""
if len(line_parts := line.split(" ", 1)) == 1:
return cls(line, None, None)
@ -82,10 +84,11 @@ def get_refs() -> dict[str, Ref]:
with redirect_stdout(captured_output):
intersphinx.inspect_main([str(objects_filepath)])
lines = captured_output.getvalue().replace("\t", " ").splitlines()
return {
r.id: r
for ln in captured_output.getvalue().split("\n")
if ln.startswith("\t") and (r := Ref.from_line(ln.strip()))
for ln in lines
if ln.startswith(" ") and (r := Ref.from_line(ln.strip()))
}
@ -132,8 +135,7 @@ def create_rst_replacements() -> list[Replacement]:
MD_REPLACEMENTS: list[Replacement] = [
(r"^ (- )", r"\1"), # remove indent from top-level bullet points
(r"^ +( - )", r"\1"), # adjust nested bullet points indent
(r"<span[^>]+>([^<]+)</span>", r"_\1"), # remove a couple of wild span refs
(r"^(\w[^\n]{,80}):(?=\n\n[^ ])", r"### \1"), # format section headers
(r"^(\w[^\n]{81,}):(?=\n\n[^ ])", r"**\1**"), # and bolden too long ones
(r"### [^\n]+\n+(?=### )", ""), # remove empty sections

View file

@ -70,7 +70,7 @@ Bug fixes:
def md_changelog():
return r"""### New features
- [Substitute Plugin](https://beets.readthedocs.io/en/stable/plugins/substitute.html): Some substitute multi-line change. :bug: (\#5467)
- [Substitute Plugin](https://beets.readthedocs.io/en/stable/plugins/substitute.html): Some substitute multi-line change. :bug: (#5467)
- [list](https://beets.readthedocs.io/en/stable/reference/cli.html#list-cmd) Update.
You can do something with this command:
@ -82,9 +82,9 @@ You can do something with this command:
- Another fix with its own bullet points using correct indentation:
- First
- Second
- Some fix thanks to @username. :bug: (\#5467)
- Some fix thanks to @username. :bug: (#5467)
- Some fix that mentions user @username.
- Some fix that refers to an issue. :bug: (\#5467)
- Some fix that refers to an issue. :bug: (#5467)
- Some fix with its own bullet points using incorrect indentation:
- First nested bullet point with some text that wraps to the next line
- Second nested bullet point
@ -93,7 +93,7 @@ You can do something with this command:
### Other changes
- Changed `bitesize` label to `good first issue`. Our [contribute](https://github.com/beetbox/beets/contribute) page is now automatically populated with these issues. :bug: (\#4855)
- Changed `bitesize` label to `good first issue`. Our [contribute](https://github.com/beetbox/beets/contribute) page is now automatically populated with these issues. :bug: (#4855)
# 2.1.0 (November 22, 2024)

View file

@ -1397,6 +1397,10 @@ class PluginTest(TestPluginTestCase):
@_common.slow_test()
@pytest.mark.xfail(
os.environ.get("GITHUB_ACTIONS") == "true" and sys.platform == "linux",
reason="Completion is for some reason unhappy on Ubuntu 24.04 in CI",
)
class CompletionTest(TestPluginTestCase):
def test_completion(self):
# Do not load any other bash completion scripts on the system.