Skip to content

update packaging and testing and drop EoL Pythons #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

terencehonles
Copy link

@terencehonles terencehonles commented Nov 1, 2024

This tackles a few points on #40, but will have a failing test without #39

fixes: #36 , fixes: #37

@terencehonles terencehonles force-pushed the update-packaging-and-testing-and-drop-eol-pythons branch 2 times, most recently from fb7efd5 to 60a396b Compare November 2, 2024 12:54
Copy link
Author

Choose a reason for hiding this comment

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

I left this as its own file, but it can be moved to pyproject.toml too, but we'd need to ensure tox v4 I believe and probably will need to use a different Github Actions runner

wheel
# last release for old versions
sphinx747: sphinx==7.4.7
sphinx621: sphinx==6.2.1
Copy link
Author

Choose a reason for hiding this comment

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

I dropped 5.x because it looks like it has issues with Python 3.13 since it imports the removed imghdr module differently than more recent versions, and I don't know if we need to go that far back. Otherwise we can just change the envlist to not include 5x for Python 3.13, but two older releases seem sufficient.

[testenv:wheel]
minversion = 3.15.0
commands =
python -m build --wheel .
Copy link
Author

@terencehonles terencehonles Nov 2, 2024

Choose a reason for hiding this comment

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

Since building the wheel doesn't need to be tested in all the Python versions I split this out, and only test that it builds with the latest Python (at least on the CI), if you run locally I believe this will use the base Python.

commands =
./setup.py bdist_wheel
./setup.py install
Copy link
Author

@terencehonles terencehonles Nov 2, 2024

Choose a reason for hiding this comment

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

tox always installs the package (unless you say otherwise), so this was redundant

Copy link
Author

Choose a reason for hiding this comment

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

pyproject.toml handles namespace packages automatically

setup.cfg Outdated
Copy link
Author

Choose a reason for hiding this comment

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

Universal wheels are deprecated and are only needed for Python 2, so since we're dropping Python 2 this isn't needed.

author_email='tomasz.czyz@gmail.com',
description='Sphinx extension for thumbnails',
long_description=codecs.open('README.rst', encoding="utf8").read(),
zip_safe=False,
Copy link
Author

@terencehonles terencehonles Nov 2, 2024

Choose a reason for hiding this comment

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

This looks like it's deprecated and doesn't seem to apply to Python 3 (or it can still break since you can install zip packages, but that's not standard)

pyproject.toml Outdated
]
dependencies = [
"requests>2.2,<3",
"setuptools", # TODO: migrate off of pkg_resources
Copy link
Author

Choose a reason for hiding this comment

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

This is now properly declared as a dependency until pkg_resources is not used here:

backend = list(pkg_resources.iter_entry_points(
group='sphinxcontrib.images.backend',
name=backend_name_or_callable))[0]
backend = backend.load()

It's no longer needed for namespace packages

@terencehonles terencehonles force-pushed the update-packaging-and-testing-and-drop-eol-pythons branch 3 times, most recently from 8d4045c to 83283c7 Compare November 4, 2024 11:10
@terencehonles
Copy link
Author

terencehonles commented Nov 4, 2024

I've verified that the packaging creates the same assets (aside from the previously missing pointer.css and now minified lightbox.min.css stylesheets and the legacy namespace metadata):

  • old tar: sphinxcontrib-images-0.9.4.tar.gz

    sphinxcontrib-images-0.9.4/
    sphinxcontrib-images-0.9.4/LICENSE.txt
    sphinxcontrib-images-0.9.4/MANIFEST.in
    sphinxcontrib-images-0.9.4/PKG-INFO
    sphinxcontrib-images-0.9.4/README.rst
    sphinxcontrib-images-0.9.4/setup.cfg
    sphinxcontrib-images-0.9.4/setup.py
    sphinxcontrib-images-0.9.4/sphinxcontrib/
    sphinxcontrib-images-0.9.4/sphinxcontrib/__init__.py
    sphinxcontrib-images-0.9.4/sphinxcontrib/images.py
    sphinxcontrib-images-0.9.4/sphinxcontrib_images.egg-info/
    sphinxcontrib-images-0.9.4/sphinxcontrib_images.egg-info/PKG-INFO
    sphinxcontrib-images-0.9.4/sphinxcontrib_images.egg-info/SOURCES.txt
    sphinxcontrib-images-0.9.4/sphinxcontrib_images.egg-info/dependency_links.txt
    sphinxcontrib-images-0.9.4/sphinxcontrib_images.egg-info/entry_points.txt
    sphinxcontrib-images-0.9.4/sphinxcontrib_images.egg-info/namespace_packages.txt
    sphinxcontrib-images-0.9.4/sphinxcontrib_images.egg-info/not-zip-safe
    sphinxcontrib-images-0.9.4/sphinxcontrib_images.egg-info/requires.txt
    sphinxcontrib-images-0.9.4/sphinxcontrib_images.egg-info/top_level.txt
    sphinxcontrib-images-0.9.4/sphinxcontrib_images_lightbox2/
    sphinxcontrib-images-0.9.4/sphinxcontrib_images_lightbox2/__init__.py
    sphinxcontrib-images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/
    sphinxcontrib-images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/
    sphinxcontrib-images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/css/
    sphinxcontrib-images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/css/lightbox.css
    sphinxcontrib-images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/images/
    sphinxcontrib-images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/images/close.png
    sphinxcontrib-images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/images/loading.gif
    sphinxcontrib-images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/images/next.png
    sphinxcontrib-images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/images/prev.png
    sphinxcontrib-images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/js/
    sphinxcontrib-images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/js/lightbox-plus-jquery.min.js
    sphinxcontrib-images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/js/lightbox-plus-jquery.min.map
    sphinxcontrib-images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2-customize/
    sphinxcontrib-images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2-customize/jquery-noconflict.js
    sphinxcontrib-images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2.py
    
  • new tar: dist/sphinxcontrib_images-0.9.4.tar.gz

    sphinxcontrib_images-0.9.4/
    sphinxcontrib_images-0.9.4/LICENSE.txt
    sphinxcontrib_images-0.9.4/PKG-INFO
    sphinxcontrib_images-0.9.4/README.rst
    sphinxcontrib_images-0.9.4/pyproject.toml
    sphinxcontrib_images-0.9.4/setup.cfg
    sphinxcontrib_images-0.9.4/sphinxcontrib/
    sphinxcontrib_images-0.9.4/sphinxcontrib/images.py
    sphinxcontrib_images-0.9.4/sphinxcontrib_images.egg-info/
    sphinxcontrib_images-0.9.4/sphinxcontrib_images.egg-info/PKG-INFO
    sphinxcontrib_images-0.9.4/sphinxcontrib_images.egg-info/SOURCES.txt
    sphinxcontrib_images-0.9.4/sphinxcontrib_images.egg-info/dependency_links.txt
    sphinxcontrib_images-0.9.4/sphinxcontrib_images.egg-info/entry_points.txt
    sphinxcontrib_images-0.9.4/sphinxcontrib_images.egg-info/requires.txt
    sphinxcontrib_images-0.9.4/sphinxcontrib_images.egg-info/top_level.txt
    sphinxcontrib_images-0.9.4/sphinxcontrib_images_lightbox2/
    sphinxcontrib_images-0.9.4/sphinxcontrib_images_lightbox2/__init__.py
    sphinxcontrib_images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/
    sphinxcontrib_images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/
    sphinxcontrib_images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/css/
    sphinxcontrib_images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/css/lightbox.min.css
    sphinxcontrib_images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/images/
    sphinxcontrib_images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/images/close.png
    sphinxcontrib_images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/images/loading.gif
    sphinxcontrib_images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/images/next.png
    sphinxcontrib_images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/images/prev.png
    sphinxcontrib_images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/js/
    sphinxcontrib_images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/js/lightbox-plus-jquery.min.js
    sphinxcontrib_images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2/dist/js/lightbox-plus-jquery.min.map
    sphinxcontrib_images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2-customize/
    sphinxcontrib_images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2-customize/jquery-noconflict.js
    sphinxcontrib_images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2-customize/pointer.css
    sphinxcontrib_images-0.9.4/sphinxcontrib_images_lightbox2/lightbox2.py
    
  • old wheel: sphinxcontrib_images-0.9.4-py2.py3-none-any.whl

      Archive:  sphinxcontrib_images-0.9.4-py2.py3-none-any.whl
    Archive:  sphinxcontrib_images-0.9.4-py2.py3-none-any.whl
      Length      Date    Time    Name
    ---------  ---------- -----   ----
          574  2021-08-09 04:50   sphinxcontrib_images-0.9.4-py3.7-nspkg.pth
        12838  2021-08-08 21:31   sphinxcontrib/images.py
           34  2021-08-01 20:30   sphinxcontrib_images_lightbox2/__init__.py
         2713  2021-08-05 20:32   sphinxcontrib_images_lightbox2/lightbox2.py
         3580  2021-08-05 19:41   sphinxcontrib_images_lightbox2/lightbox2/dist/css/lightbox.css
          280  2021-08-05 19:41   sphinxcontrib_images_lightbox2/lightbox2/dist/images/close.png
         8476  2021-08-05 19:41   sphinxcontrib_images_lightbox2/lightbox2/dist/images/loading.gif
         1350  2021-08-05 19:41   sphinxcontrib_images_lightbox2/lightbox2/dist/images/next.png
         1360  2021-08-05 19:41   sphinxcontrib_images_lightbox2/lightbox2/dist/images/prev.png
        98688  2021-08-05 19:41   sphinxcontrib_images_lightbox2/lightbox2/dist/js/lightbox-plus-jquery.min.js
       144969  2021-08-05 19:41   sphinxcontrib_images_lightbox2/lightbox2/dist/js/lightbox-plus-jquery.min.map
           26  2021-08-01 20:30   sphinxcontrib_images_lightbox2/lightbox2-customize/jquery-noconflict.js
        10173  2021-08-09 04:50   sphinxcontrib_images-0.9.4.dist-info/LICENSE.txt
         3335  2021-08-09 04:50   sphinxcontrib_images-0.9.4.dist-info/METADATA
          110  2021-08-09 04:50   sphinxcontrib_images-0.9.4.dist-info/WHEEL
          208  2021-08-09 04:50   sphinxcontrib_images-0.9.4.dist-info/entry_points.txt
           14  2021-08-09 04:50   sphinxcontrib_images-0.9.4.dist-info/namespace_packages.txt
           45  2021-08-09 04:50   sphinxcontrib_images-0.9.4.dist-info/top_level.txt
         2046  2021-08-09 04:50   sphinxcontrib_images-0.9.4.dist-info/RECORD
    ---------                     -------
       290819                     19 files
    
    
  • new wheel: dist/sphinxcontrib_images-0.9.4-py3-none-any.whl

    Archive:  dist/sphinxcontrib_images-0.9.4-py3-none-any.whl
      Length      Date    Time    Name
    ---------  ---------- -----   ----
        12900  2024-11-04 10:54   sphinxcontrib/images.py
           34  2020-07-21 22:43   sphinxcontrib_images_lightbox2/__init__.py
         2760  2024-11-04 10:54   sphinxcontrib_images_lightbox2/lightbox2.py
         2532  2024-11-01 18:09   sphinxcontrib_images_lightbox2/lightbox2/dist/css/lightbox.min.css
          280  2024-11-01 18:09   sphinxcontrib_images_lightbox2/lightbox2/dist/images/close.png
         8476  2024-11-01 18:09   sphinxcontrib_images_lightbox2/lightbox2/dist/images/loading.gif
         1350  2024-11-01 18:09   sphinxcontrib_images_lightbox2/lightbox2/dist/images/next.png
         1360  2024-11-01 18:09   sphinxcontrib_images_lightbox2/lightbox2/dist/images/prev.png
        98688  2024-11-01 18:09   sphinxcontrib_images_lightbox2/lightbox2/dist/js/lightbox-plus-jquery.min.js
       144969  2024-11-01 18:09   sphinxcontrib_images_lightbox2/lightbox2/dist/js/lightbox-plus-jquery.min.map
           26  2020-07-21 22:43   sphinxcontrib_images_lightbox2/lightbox2-customize/jquery-noconflict.js
           68  2024-11-01 16:36   sphinxcontrib_images_lightbox2/lightbox2-customize/pointer.css
        10173  2024-11-04 11:09   sphinxcontrib_images-0.9.4.dist-info/LICENSE.txt
         3285  2024-11-04 11:09   sphinxcontrib_images-0.9.4.dist-info/METADATA
           91  2024-11-04 11:09   sphinxcontrib_images-0.9.4.dist-info/WHEEL
          207  2024-11-04 11:09   sphinxcontrib_images-0.9.4.dist-info/entry_points.txt
           45  2024-11-04 11:09   sphinxcontrib_images-0.9.4.dist-info/top_level.txt
         1954  2024-11-04 11:09   sphinxcontrib_images-0.9.4.dist-info/RECORD
    ---------                     -------
       289198                     18 files
    
    

@jonascj
Copy link
Collaborator

jonascj commented Mar 31, 2025

Thank you @terencehonles This appears to be what we need and your knowledge of actions/workflow/tox/packaging is more up-to-date than mine.

Do you think we should just merge this here in March/April 2025 and then merge #39 after?

@terencehonles
Copy link
Author

That seems reasonable to me. I'm out of office right now and may not have any time to update anything until April 9th or 14th, but I can look to see if anything here needs an update if we're waiting until that point anyways. Otherwise, I assume everything here was clear to merge and can be updated later if there's any more recent follow-ups that make sense since I proposed this pr.

@terencehonles
Copy link
Author

I had a chance to review the PR and no new Python versions hit EoL, so this should be good to merge. I had tested this with #39 IIRC, so they could be merged independently in series or can be merged into a temporary branch and have that branch run the CI checks to confirm everything goes green.

@jonascj
Copy link
Collaborator

jonascj commented Apr 2, 2025

@terencehonles I've tested merging #41 followed by merging #39 in this branch https://github.com/sphinx-contrib/images/tree/pr3941 and everything looks good (https://github.com/sphinx-contrib/images/actions/runs/14230225566).

Would you test https://test.pypi.org/project/sphinxcontrib-images/0.9.5rc1/ to see if everything is working as expected?

python -m venv venv
source venv/bin/activate
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ sphinxcontrib-images==0.9.5rc1

For me the package is installable and it can build the documentation in docs/ , but produces some non-fatal errors while doing so. Maybe it is just the remote images (wikipedia's logo) which are not longer available. Maybe it is something else, I'll investigate tomorrow.

I haven't really considered the version requirements you suggested in details, we should consider those a second time. Dropping support for Python<3.9 seems reasonable, but does that necessitate dropping support for sphinx 4? And are the requirements on requests and setuptools as tight/loose as they need to / can be?

Not that it matters much, but should it be version 0.9.5 or something else, like 1.0.0? I suppose the extension does have a public API which calls for 1.y.z (same applied in 2021 though), but bumbing the major number is normally reserved for breaking backward compability.

@j9ac9k
Copy link

j9ac9k commented Apr 3, 2025

Thank you @terencehonles This appears to be what we need and your knowledge of actions/workflow/tox/packaging is more up-to-date than mine.

Do you think we should just merge this here in March/April 2025 and then merge #39 after?

I'm of the opinion the commit from #39 should be cherry-picked into this branch/PR. Hard to update packaging/testing when the tests fail due to an import error from the very get-go.

@j9ac9k
Copy link

j9ac9k commented Apr 3, 2025

image

pyright seems to be giving a hint to the issue (I'll keep looking)

EDIT: fix here I believe is to remove the brown import, and pass in the string 'brown', not the imported function.

@j9ac9k
Copy link

j9ac9k commented Apr 3, 2025

Converting brown to 'brown', I get past that error but now complaining it cannot find close.png

...
        raise ExtensionError(
    sphinx.errors.ExtensionError: Handler <function install_backend_static_files at 0x1137a1800> for event 'env-updated' threw an exception (exception: /Users/ogi/Developer/images/sphinxcontrib_images_lightbox2/lightbox2/dist/images/close.png does not exist)

EDIT: this was my own fault, I cloned the repo but didn't initialize the submodules

pyproject.toml Outdated
"Environment :: Console",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
Copy link

@j9ac9k j9ac9k Apr 3, 2025

Choose a reason for hiding this comment

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

license specifications in the classifier I recently learned has been deprecated

EDIT: looks like they were deprecated long ago!! https://peps.python.org/pep-0639/

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, I think we should fix those warnings as well - might as well do while we're moving from setup.py to project.toml

Copy link
Collaborator

Choose a reason for hiding this comment

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

pyproject.toml could be patched as follows

diff --git a/pyproject.toml b/pyproject.toml
index 4a2cbcc..a9ade4f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -7,6 +7,8 @@ name = "sphinxcontrib-images"
 version = "0.9.4"
 requires-python = ">= 3.9"
 
+license = "Apache-2.0"
+license-files = ["LICENSE.txt"]
 authors = [
     {name = "Tomasz Czyż", email = "tomasz.czyz@gmail.com"},
 ]
@@ -15,7 +17,6 @@ classifiers = [
     "Environment :: Console",
     "Environment :: Web Environment",
     "Intended Audience :: Developers",
-    "License :: OSI Approved :: Apache Software License",
     "Operating System :: OS Independent",
     "Programming Language :: Python",
     "Programming Language :: Python :: 3 :: Only",
@@ -31,7 +32,6 @@ dependencies = [
     "sphinx>=5.0",
 ]
 description = "Sphinx extension for thumbnails"
-license = {text = "Apache 2"}
 readme = "README.rst"

Copy link
Author

Choose a reason for hiding this comment

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

While PEP-639 declared the new format quite a while ago it took awhile to be implemented by the backends (see table here), and setuptools only got support this March.

Since we do control the build environment I bumped this to require setuptools >= 77.0.3, and defined the license information using the new syntax. I believe the "Apache 2" specifier I used previously probably should have been "Apache-2.0", so that's fixed regardless

@j9ac9k
Copy link

j9ac9k commented Apr 3, 2025

Once I realized there was also a submodule; everything ran successfully when building the pyqtgraph docs. Only outstanding issue is the brown import, fairly certain that should just be the string 'brown'.

@jonascj
Copy link
Collaborator

jonascj commented Apr 3, 2025

Thank you @terencehonles This appears to be what we need and your knowledge of actions/workflow/tox/packaging is more up-to-date than mine.
Do you think we should just merge this here in March/April 2025 and then merge #39 after?

I'm of the opinion the commit from #39 should be cherry-picked into this branch/PR. Hard to update packaging/testing when the tests fail due to an import error from the very get-go.

I agree - that would be pretty / semantic way, ensuring credit where credit is due. The quick way around it would be the ugly double merging or manually reimplementing (typing /copying) the two PRs.

@jonascj
Copy link
Collaborator

jonascj commented Apr 4, 2025

@terencehonles Can you cherry-pick commit fc15936 from #39 into your fork/PR?

Maybe a few other changes to pyproject.toml could be made as well (it causes a few deprecation warnings at the moment).

@coredumperror
Copy link

coredumperror commented Apr 10, 2025

EDIT: fix here I believe is to remove the brown import, and pass in the string 'brown', not the imported function.

Can confirm that this is the correct fix. I found it myself while debugging some odd logging errors I was getting while using 0.9.5rc1, and converting brown to 'brown' worked a treat.

Any chance a new build could be put together with this fix?

@jonascj
Copy link
Collaborator

jonascj commented Apr 10, 2025

@coredumperror I don't think I see any errors related to this when testing the pr3941 branch (from git or from test.pypi.org). Would you mind posting your logs?

Imports like from sphinx.util.console import brown are quite common in the contrib extensions: https://github.com/search?q=org%3Asphinx-contrib%20sphinx.util.console&type=code . Not that common use makes it correct use. But I'd like to replicate the error/warnings before changing it.

@coredumperror
Copy link

coredumperror commented Apr 10, 2025

Are you using Sphinx 8.x? This doesn't seem to happen with Sphinx 7.x. Here's what I get in my output when I build the HTML version of my project's docs with 0.9.5rc1 and Sphinx 8.2.3:

Copying static files for sphinxcontrib-images...[100%] --- Logging error ---
Traceback (most recent call last):
  File "/Users/<username>/.local/share/uv/python/cpython-3.12.8-macos-aarch64-none/lib/python3.12/logging/__init__.py", line 1160, in emit
    msg = self.format(record)
          ^^^^^^^^^^^^^^^^^^^
  File "/Users/<username>/.local/share/uv/python/cpython-3.12.8-macos-aarch64-none/lib/python3.12/logging/__init__.py", line 999, in format
    return fmt.format(record)
           ^^^^^^^^^^^^^^^^^^
  File "/<app-folder>/.venv/lib/python3.12/site-packages/sphinx/util/logging.py", line 574, in format
    return colourise(colour_name, message)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<app-folder>/.venv/lib/python3.12/site-packages/sphinx/_cli/util/colour.py", line 58, in colourise
    if colour_name.startswith('_') or colour_name in {
       ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'function' object has no attribute 'startswith'
Call stack:
  File "/<app-folder>/.venv/bin/sphinx-build", line 10, in <module>
    sys.exit(main())
  File "/<app-folder>/.venv/lib/python3.12/site-packages/sphinx/cmd/build.py", line 491, in main
    return make_mode.run_make_mode(argv[1:])
  File "/<app-folder>/.venv/lib/python3.12/site-packages/sphinx/cmd/make_mode.py", line 223, in run_make_mode
    return make.run_generic_build(builder_name)
  File "/<app-folder>/.venv/lib/python3.12/site-packages/sphinx/cmd/make_mode.py", line 206, in run_generic_build
    return build_main(args + self.opts)
  File "/<app-folder>/.venv/lib/python3.12/site-packages/sphinx/cmd/build.py", line 432, in build_main
    app.build(args.force_all, args.filenames)
  File "/<app-folder>/.venv/lib/python3.12/site-packages/sphinx/application.py", line 422, in build
    self.builder.build_all()
  File "/<app-folder>/.venv/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 319, in build_all
    self.build(None, summary=__('all source files'), method='all')
  File "/<app-folder>/.venv/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 403, in build
    updated_docnames = set(self.read())
  File "/<app-folder>/.venv/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 564, in read
    for retval in self.events.emit('env-updated', self.env):
  File "/<app-folder>/.venv/lib/python3.12/site-packages/sphinx/events.py", line 404, in emit
    results.append(listener.handler(self.app, *args))
  File "/<app-folder>/.venv/lib/python3.12/site-packages/sphinxcontrib/images.py", line 230, in install_backend_static_files
    for source_file_path in (app.builder.status_iterator
  File "/<app-folder>/.venv/lib/python3.12/site-packages/sphinx/util/display.py", line 53, in status_iterator
    logger.info(stringify_func(item), nonl=True, color=color)
  File "/Users/<username>/.local/share/uv/python/cpython-3.12.8-macos-aarch64-none/lib/python3.12/logging/__init__.py", line 1924, in info
    self.log(INFO, msg, *args, **kwargs)
  File "/<app-folder>/.venv/lib/python3.12/site-packages/sphinx/util/logging.py", line 138, in log
    super().log(level, msg, *args, **kwargs)
  File "/Users/<username>/.local/share/uv/python/cpython-3.12.8-macos-aarch64-none/lib/python3.12/logging/__init__.py", line 1962, in log
    self.logger.log(level, msg, *args, **kwargs)
  File "/Users/<username>/.local/share/uv/python/cpython-3.12.8-macos-aarch64-none/lib/python3.12/logging/__init__.py", line 1609, in log
    self._log(level, msg, args, **kwargs)
  File "/Users/<username>/.local/share/uv/python/cpython-3.12.8-macos-aarch64-none/lib/python3.12/logging/__init__.py", line 1684, in _log
    self.handle(record)
  File "/Users/<username>/.local/share/uv/python/cpython-3.12.8-macos-aarch64-none/lib/python3.12/logging/__init__.py", line 1700, in handle
    self.callHandlers(record)
  File "/Users/<username>/.local/share/uv/python/cpython-3.12.8-macos-aarch64-none/lib/python3.12/logging/__init__.py", line 1762, in callHandlers
    hdlr.handle(record)
  File "/Users/<username>/.local/share/uv/python/cpython-3.12.8-macos-aarch64-none/lib/python3.12/logging/__init__.py", line 1028, in handle
    self.emit(record)
  File "/<app-folder>/.venv/lib/python3.12/site-packages/sphinx/util/logging.py", line 219, in emit
    super().emit(record)
Message: 'lightbox2-customize/pointer.css'
Arguments: ()

This same traceback gets printed a dozen times, as it seems to be part of the progress bar, and crashes every time the builder tries to print an updated progress percentage. The build itself actually does finish, tho, despite these tracebacks spamming the log, which may be why you're not seeing an error.

Here's a summarized version of the entire output, to show what I mean:

$ make html
Running Sphinx v8.2.3
loading translations [en]... done
Converting `source_suffix = '.rst'` to `source_suffix = {'.rst': 'restructuredtext'}`.
Initiated sphinxcontrib-images backend: `sphinxcontrib_images_lightbox2.lightbox2:LightBox2`
loading intersphinx inventory 'python' from https://docs.python.org/3/objects.inv ...
building [mo]: all of 0 po files
writing output...
building [html]: all source files
updating environment: [new config] 22 added, 0 changed, 0 removed
reading sources... [100%] runbook/using
Downloading remote images...
Copying static files for sphinxcontrib-images...[ 11%] --- Logging error ---
TRACEBACK
Copying static files for sphinxcontrib-images...[ 22%] --- Logging error ---
TRACEBACK
Copying static files for sphinxcontrib-images...[ 33%] --- Logging error ---
TRACEBACK
Copying static files for sphinxcontrib-images...[ 44%] --- Logging error ---
TRACEBACK
Copying static files for sphinxcontrib-images...[ 56%] --- Logging error ---
TRACEBACK
Copying static files for sphinxcontrib-images...[ 67%] --- Logging error ---
TRACEBACK
Copying static files for sphinxcontrib-images...[ 78%] --- Logging error ---
TRACEBACK
Copying static files for sphinxcontrib-images...[ 89%] --- Logging error ---
TRACEBACK
Copying static files for sphinxcontrib-images...[100%] --- Logging error ---
TRACEBACK

looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
copying assets...
copying static files...
Writing evaluated template result to /<app-folder>/doc/build/html/_static/basic.css
Writing evaluated template result to /<app-folder>/doc/build/html/_static/language_data.js
Writing evaluated template result to /<app-folder>/doc/build/html/_static/documentation_options.js
Writing evaluated template result to /<app-folder>/doc/build/html/_static/js/versions.js
copying static files: done
copying extra files...
copying extra files: done
copying assets: done
writing output... [100%] runbook/using
WARNING: Many canditates found for xref to 'module' 'ecs_cluster'.
WARNING: Many canditates found for xref to 'module' 'ecs_cluster'.
WARNING: Many canditates found for xref to 'module' 'ecs_cluster'.
WARNING: Many canditates found for xref to 'module' 'ecs_cluster'.
WARNING: Many canditates found for xref to 'module' 'ecs_cluster'.
WARNING: Many canditates found for xref to 'module' 'ecs_cluster'.
WARNING: Cross reference to 'aws_security_group.provisioners' could not be resolved within the 'tf' domain
WARNING: Many canditates found for xref to 'module' 'ecs_cluster'.
generating indices... genindex tf-definitionsindex done
highlighting code...[100%] /<app-folder>/terraform/subnets.tf
writing additional pages... search done
copying images... [100%] ../images/prod-security-groups.png
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 8 warnings.

The colour_name variable that it's complaining about is supposed to be 'brown', but it's being sent into that function as the brown import you mentioned. I think maybe Sphinx 8 changed the API for the app.builder.status_iterator, which this package calls on lines 230 and 257 in images.py, to expect a string there, instead of a function.

@jonascj
Copy link
Collaborator

jonascj commented Apr 11, 2025

@coredumperror Thank you for the further details - I'll have a look at your sphinx8-api-change hypothesis.

@jonascj
Copy link
Collaborator

jonascj commented Apr 11, 2025

I can reproduce this now, it happens with sphinx 8.2.3 but not sphinx 8.1.3. So something must have changed between the two versions, or something changed between python 3.10 (on which I tested sphinx 8.1.3) and python 3.12 (on which I tested sphinx 8.2.3).

According to the Sphinx's list of deprecated APIs nothing was removed in 8.2: https://www.sphinx-doc.org/en/master/extdev/deprecated.html (changelog https://www.sphinx-doc.org/en/master/changes/8.2.html).

@j9ac9k
Copy link

j9ac9k commented Apr 11, 2025

I can reproduce this now, it happens with sphinx 8.2.3 but not sphinx 8.1.3. So something must have changed between the two versions, or something changed between python 3.10 (on which I tested sphinx 8.1.3) and python 3.12 (on which I tested sphinx 8.2.3).

According to the Sphinx's list of deprecated APIs nothing was removed in 8.2: https://www.sphinx-doc.org/en/master/extdev/deprecated.html (changelog https://www.sphinx-doc.org/en/master/changes/8.2.html).

This change I don't think was part of Sphinx's public API? Since you narrowed the two versions you could git bisect. Alternatively see if the string form of the color name works with the oldest version of sphinx you plan to support. If so you could just make the change.

@jonascj
Copy link
Collaborator

jonascj commented Apr 11, 2025

@j9ac9k Is it then a bug in sphinx / failure to document a change / something which worked by accident in the past? Anyway, good idea with bisection, I'll give it a try. Let me know if you find it first.

@j9ac9k
Copy link

j9ac9k commented Apr 12, 2025 via email

@jonascj
Copy link
Collaborator

jonascj commented Apr 13, 2025

Let us continue no attribute 'startswith'-error from sphinx 8.2.3 in #45 .

@jonascj
Copy link
Collaborator

jonascj commented Apr 15, 2025

@coredumperror I've made a test build with the string fix: https://test.pypi.org/project/sphinxcontrib-images/0.9.5rc2/

@coredumperror
Copy link

Fabulous! With Sphinx 8.2.3 and shinxcontrib-images 0.9.5rc2 installed, I get exactly the output I expect:

$ make html
Running Sphinx v8.2.3
loading translations [en]... done
Converting `source_suffix = '.rst'` to `source_suffix = {'.rst': 'restructuredtext'}`.
Initiated sphinxcontrib-images backend: `sphinxcontrib_images_lightbox2.lightbox2:LightBox2`
loading intersphinx inventory 'python' from https://docs.python.org/3/objects.inv ...
loading intersphinx inventory 'django' from http://docs.djangoproject.com/en/dev/_objects/ ...
intersphinx inventory has moved: http://docs.djangoproject.com/en/dev/_objects/ -> https://docs.djangoproject.com/en/dev/objects.inv
building [mo]: all of 0 po files
writing output...
building [html]: all source files
updating environment: [new config] 11 added, 0 changed, 0 removed
reading sources... [100%] runbook/users/enabling
Downloading remote images...
Copying static files for sphinxcontrib-images...[100%] lightbox2-customize/pointer.css
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
copying assets...
copying static files...
Writing evaluated template result to /Users/<username>/dev/adstest3/doc/build/html/_static/basic.css
Writing evaluated template result to /Users/<username>/dev/adstest3/doc/build/html/_static/language_data.js
Writing evaluated template result to /Users/<username>/dev/adstest3/doc/build/html/_static/documentation_options.js
Writing evaluated template result to /Users/<username>/dev/adstest3/doc/build/html/_static/js/versions.js
copying static files: done
copying extra files...
copying extra files: done
copying assets: done
writing output... [100%] runbook/users/enabling
generating indices... genindex py-modindex tf-definitionsindex done
highlighting module code... [100%] adstest3.users.models
highlighting code...[100%] /Users/<username>/dev/adstest3/terraform/common/main.tf
writing additional pages... search done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded.

@terencehonles
Copy link
Author

@terencehonles Can you cherry-pick commit fc15936 from #39 into your fork/PR?

Maybe a few other changes to pyproject.toml could be made as well (it causes a few deprecation warnings at the moment).

Done, I'll need a little time to follow up on the thread, but I just got back from an extended vacation and more or less caught up on my work responsibilities.

@jonascj
Copy link
Collaborator

jonascj commented Apr 16, 2025

@terencehonles Great! I think you're up to date, nothing relevant to this PR have been posted since I asked you to cherry-pick.

This thread has, however, been used to discuss an unreleated issue related to colored log output which causes errors with sphinx>8.2. That discussion is moved to #45.

I will try to prepare a release based on your updated PR. A few further changes to the code base (fix to #45 and fixing of pyproject.toml deprecation warnings) should happen outside of this PR.

terencehonles and others added 4 commits April 17, 2025 14:06
sphinx.util.status_iterator alias has been deprecated since sphinx 6.1
and will be removed in sphinx 8.0

See https://www.sphinx-doc.org/en/master/extdev/deprecated.html

The preferred access for status_iterator is
sphinx.util.display.status_iterator. This commit adopts the new sphinx
API and then falls back on the older API access since this plugin
supports older versions of sphinx.
@terencehonles terencehonles force-pushed the update-packaging-and-testing-and-drop-eol-pythons branch from f859520 to 8c72db8 Compare April 17, 2025 12:06
@terencehonles
Copy link
Author

I updated the license specifiers as mentioned in the thread #41 (comment) and updated the release instructions/script https://github.com/sphinx-contrib/images/pull/41/files#diff-8896efb82f66e1b2ad453d05d5577b82d8a370f239b79d9468bfe0e164bbb56f

@terencehonles
Copy link
Author

Friendly ping @jonascj

I will try to prepare a release based on your updated PR. A few further changes to the code base (fix to #45 and fixing of pyproject.toml deprecation warnings) should happen outside of this PR.

Should we just merge this now then? The release can be managed independently and if there are other docs or scripts that need to be updated they can be done by you outside this PR.

@jonascj
Copy link
Collaborator

jonascj commented May 2, 2025

Yes, I've tested it sufficiently in local branches, some pushed here for CI, to just merge it directly into master and close this.

Thank you for your persistance @terencehonles in getting this updated and merged, make the package usable again! I'll strive to release a new version this weekend.

Yes, I've tested it a few times in various local branches and a few pushed here to have the CI run.

I'm putting things together here https://github.com/sphinx-contrib/images/commits/release-1.0.0/ and I'll hopefully be merging that into master this weekend to release. I'm just missing a few tweaks to config files and the documentation.

That should close this PR as well (merging release-1.0.0 with master, fast-forwarding or not).

@jonascj jonascj merged commit ecb052f into sphinx-contrib:master May 2, 2025
6 checks passed
@terencehonles terencehonles deleted the update-packaging-and-testing-and-drop-eol-pythons branch May 8, 2025 15:51
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.

Drop Python 2 support the usage of setup.py is deprecated since setuptools 58.2.0s. the lib should mode toward pyproject.toml
4 participants