sphinx-contrib / images

sphinxcontrib-images extension
Apache License 2.0
17 stars 14 forks source link

Incremental build is not working when the plugin enabled #8

Closed rhornig closed 3 years ago

rhornig commented 4 years ago

I have enabled the plugin with sphinx 2.4.4 and it seems that it interferes somehow with the incremental build process and sphinx always makes a full build when this plugin is enabled.

jonascj commented 4 years ago

@rhornig Please provide a minimal example demonstrating this (along with a requirements file for package versions).

I just tested with sphinx 2.4.4 and sphinxcontrib-images 0.9.1 and I see what I expect. If my index.html includes 1.rst and 2.rst, and I change 2.rst, then _build/html/1.html is not updated. Sphinx console output also states it only found 1 target out of date:

$ make html
Running Sphinx v2.4.4

loading pickled environment... done
Initiated sphinxcontrib-images backend: `sphinxcontrib_images_lightbox2.lightbox2:LightBox2`
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: 0 added, 1 changed, 0 removed
reading sources... [100%] 2                                                                                                                                                                                                                                                      
Copying static files for sphinxcontrib-images...[100%] lightbox2/img/loading.gif                                                                                                                                                                                                 
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index                                                                                                                                                                                                                                                   
generating indices...  genindexdone
writing additional pages...  searchdone
copying images... [100%] figs/wiki.png                                                                                                                                                                                                                                           
copying static files... ... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded.

I've attached the test project, it was made with sphinx-quickstart. issue8.zip

kujiu commented 4 years ago

Same issue here with my blog and my website (complete projects here: https://procrastinator.nerv-project.eu/kujiu_writer/kujiulabs/ and https://procrastinator.nerv-project.eu/nerv-project/communication/nerv_website ) It's two complex projects with a lot of extensions. I'll investigate a little more during the next two weeks to say if I understand why.

jonascj commented 4 years ago

@kujiu Even if you don't understand why, but manage to create a small example reproducing the problem, let us know!

kujiu commented 4 years ago

Ok, I've found the minimal way to reproduce.

  1. create a new project from scratch with sphinx-quickstart;
  2. add 'sphinxcontrib.images' in extensions parameter;
  3. add a config_images dict in conf.py with no or several options (but not all! It works if all options are configured);
  4. launch two times make html

The index is rewritten in the second execution. No need to change index.rst.

jonascj commented 3 years ago

How time flies when you have a baby and a 3-year-old! Please accept my apologies for not attending to the PRs and issues in a timely fashion. I'll attend to them at the latest on August 29th and 30th (I have another project with deadline on August 28th).

SilverRainZ commented 3 years ago

Meet the same issue:

Running Sphinx v3.4.0
loading translations [zh_CN]... done
loading pickled environment... done
Initiated sphinxcontrib-images backend: `sphinxcontrib_images_lightbox2.lightbox2:LightBox2`
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 0 source files that are out of date
updating environment: [config changed ('images_config')] 74 added, 5 changed, 0 removed
reading sources... [100%] todo                                                                                                                         
/home/la/.local/lib/python3.9/site-packages/sphinxcontrib/images.py:239: RemovedInSphinx40Warning: The app.add_stylesheet() is deprecated. Please use app.add_css_file() instead.
  app.add_stylesheet(os.path.relpath(dest_file_path, STATICS_DIR_PATH))
/home/la/.local/lib/python3.9/site-packages/sphinxcontrib/images.py:237: RemovedInSphinx40Warning: The app.add_javascript() is deprecated. Please use app.add_js_file() instead.
  app.add_javascript(os.path.relpath(dest_file_path, STATICS_DIR_PATH))
Copying static files for sphinxcontrib-images...[100%] lightbox2/img/loading.gif     
terencehonles commented 3 years ago

@SilverRainZ let's keep the discussion in the issue not the PR https://github.com/sphinx-contrib/images/pull/18#issuecomment-862359746 and it might be helpful to start by saying you are still having an issue instead of suggesting the fix did not work (since it may have).

I double checked and I don't see any issues on my end and this is what I see:

Initial run (after removing the build cache):

Running Sphinx v4.0.1
Initiated sphinxcontrib-images backend: `sphinxcontrib_images_lightbox2.lightbox2:LightBox2`
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 254 source files that are out of date
updating environment: [new config] 254 added, 0 changed, 0 removed
/python3.9/site-packages/recommonmark/parser.py:75: UserWarning: Container node skipped: type=document    
  warn("Container node skipped: type={0}".format(mdnode.t))
reading sources... [100%] index                                                                                                    
Copying static files for sphinxcontrib-images...[100%] lightbox2/img/loading.gif                                                   
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index                                                                                                     
generating indices... genindex py-modindex done
highlighting module code... [100%] 
writing additional pages... search done
copying images... [100%]
copying static files... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 3 warnings.

and running again:

Running Sphinx v4.0.1
loading pickled environment... done
Initiated sphinxcontrib-images backend: `sphinxcontrib_images_lightbox2.lightbox2:LightBox2`
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 5 changed, 0 removed
reading sources... [100%]
Copying static files for sphinxcontrib-images...[100%] lightbox2/img/loading.gif                                                   
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index                                                                                                     
generating indices... genindex py-modindex done
highlighting module code... [100%]
writing additional pages... search done
copying static files... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 6 warnings.

I removed the build warnings since they were due to stray files in my local env.

terencehonles commented 3 years ago

You may want to remove the build cache manually and see if there might be something else going on. Aside from that I'm not sure how much time you want to spend debugging your issue since it doesn't seem like I can reproduce it (you may want to double check your version number and seeing if using Sphinx 4.0.1 is any different because that's what I'm using and I don't know if it broke after that)

SilverRainZ commented 3 years ago

@terencehonles My fault, whan I am trying to fix #23, I use the earlier version of this extension, but not 0.9.3.

terencehonles commented 3 years ago

Cool, good to hear you're not having issues :slightly_smiling_face: I was hoping it wasn't going to break in a future version of Sphinx :sweat_smile: