Skip to content
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

RemovedInSphinx80Warning in ProjectInfoFactory.__init__ #974

Open
gareth-rees opened this issue Mar 29, 2024 · 0 comments
Open

RemovedInSphinx80Warning in ProjectInfoFactory.__init__ #974

gareth-rees opened this issue Mar 29, 2024 · 0 comments

Comments

@gareth-rees
Copy link

gareth-rees commented Mar 29, 2024

Building a project with Sphinx 7.2.6, I get the following warning (line-wrapped for clarity):

python3.10/site-packages/breathe/project.py:116: RemovedInSphinx80Warning:
Sphinx 8 will drop support for representing paths as strings. Use "pathlib.Path" or "os.fspath" instead.
  self._default_build_dir = os.path.dirname(app.doctreedir.rstrip(os.sep))

I don't know exactly when Sphinx plan to release version 8, but their last release in the version 6 series was 6.2.1, and their latest release in the version 7 series is 7.2.6, so it may not be long now.

Possible solutions include os.path.normpath:

self._default_build_dir = os.path.dirname(os.path.normpath(app.doctreedir))

or conversion to str:

self._default_build_dir = os.path.dirname(str(app.doctreedir).rstrip(os.sep))

or conversion to Path and back again:

self._default_build_dir = str(Path(app.doctreedir).parent)

There may be more cases where code would need to be updated to support Sphinx 8.0. I had a quick look and found one more:

dot_file_path = os.path.abspath(
self.app.confdir + os.sep + project_path + os.sep + dot_file_path
)

This would need to become:

dot_file_path = os.path.abspath(os.path.join(self.app.confdir, project_path, dot_file_path))
gareth-rees added a commit to gareth-rees/breathe that referenced this issue Mar 31, 2024
In recent versions of Sphinx, code that treats Sphinx application
paths such as `Sphinx.confdir` and `Sphinx.doctreedir` as strings
emits the warning "Sphinx 8 will drop support for representing paths
as strings".

This commit updates path-manipulation code to use functions in the
`os.path` module, which accept path-like objects as well as strings.

This fixes issue breathe-doc#974.
gareth-rees added a commit to gareth-rees/breathe that referenced this issue Mar 31, 2024
In recent versions of Sphinx, code that treats Sphinx application
paths such as `Sphinx.confdir` and `Sphinx.doctreedir` as strings
emits the warning "Sphinx 8 will drop support for representing paths
as strings".

This commit updates path-manipulation code to use functions in the
`os.path` module, which accept path-like objects as well as strings.

This fixes issue breathe-doc#974.
gareth-rees added a commit to gareth-rees/breathe that referenced this issue Mar 31, 2024
In recent versions of Sphinx, code that treats Sphinx application
paths such as `Sphinx.confdir` and `Sphinx.doctreedir` as strings
emits the warning "Sphinx 8 will drop support for representing paths
as strings".

This commit updates path-manipulation code to use functions in the
`os.path` module, which accept path-like objects as well as strings.

This fixes issue breathe-doc#974.
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

No branches or pull requests

1 participant