idaes-pse icon indicating copy to clipboard operation
idaes-pse copied to clipboard

Update doctests to remove v2 deprecation messages

Open lbianchi-lbl opened this issue 2 years ago • 6 comments

As seen in e.g. #883.

lbianchi-lbl avatar Jun 16 '22 18:06 lbianchi-lbl

@dangunter from a quick check of the build script and apidocs, I believe the source of the deprecated module calls lies somewhere around here: https://github.com/IDAES/idaes-pse/blob/7f045d9cce7efa9f73eb90ff5249d79496168732/docs/build.py#L44. It seems the generated apidocs actually use deprecated path names, could you provide the source of these names to help locate and update them? Thanks!

bpaul4 avatar Jun 17 '22 16:06 bpaul4

@bpaul4 can you clarify what you mean by "the source of the deprecated module calls"? AFAIK sphinx-apidoc automatically imports all modules on the specified path to build the documentation, so I don't think there's e.g. a separate list of modules that uses outdated names that we should update.

My (largely unsupported by actual careful inspection) guess was that the cause of the deprecation messages being emitted when building the docs was outdated import paths being present in the code snippets within the .rst files.

lbianchi-lbl avatar Jun 17 '22 17:06 lbianchi-lbl

I couldn't locate any .rst files that directly call modules using deprecated paths, and the names of the apidocs ARE the deprecated paths. Since the source .rst files use the correct paths, I suspected that the apidoc build command was sourcing using an outdated list of file paths. I'm only somewhat familiar with how the apidocs are built by Sphinx, though.

bpaul4 avatar Jun 17 '22 17:06 bpaul4

@bpaul4 thanks for the clarification, I think I understand a bit better now.

  • I've just run the command and I believe that the deprecation messages are being generated because autodoc (which is also a Sphinx extension but different from apidoc, despite the confusingly similar name) actually imports all the modules, including the still-existing deprecated ones
  • Initially I thought that the messages were due to other modules using the outdated import paths, but this is probably not the case as Ctrl+F-ing for the outdated import paths returns no results in the majority of cases
  • If this is the case, the deprecation messages will go away as soon as the deprecated modules are removed in the Python codebase
  • If we don't want to wait until then, we should try to see if there's any way to pass a list of modules to be ignored and/or excluded from the autodoc search

lbianchi-lbl avatar Jun 17 '22 17:06 lbianchi-lbl

I couldn't find anything in the Sphinx autodoc documentation to have modules excluded from the search. Maybe the easiest/reasonable-hack-iest solution in the meantime would be to search for all deprecated .py files and temporarily move them out of the idaes directory before the build.

lbianchi-lbl avatar Jun 17 '22 18:06 lbianchi-lbl

I agree with your suggestion above. The only way I found in the Pyomo codebase to skip the warnings is either for all deprecation warnings or to tell Pyomo it's a testing environment and not to report them, both of which suppress output that we want to know about. Given that this will resolve itself after v2.0 is finalized, I support a temporary fix to move the deprecated folders out before the build.

bpaul4 avatar Jun 17 '22 19:06 bpaul4

I believe the deprecation warnings due to Sphinx autodoc will disappear once the redirects for deprecated import paths will be removed (see #937) without any further action needed.

lbianchi-lbl avatar Aug 25 '22 18:08 lbianchi-lbl

I think this should have been addressed by #937 and the other PRs related to deprecations. We have removed most of the backwards compatibility code so these should now result in failures, and everything seems to be passing, so I will close this as completed.

andrewlee94 avatar Sep 23 '22 15:09 andrewlee94