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

Fixes for sphinx build #1063

Merged
merged 32 commits into from
Dec 9, 2023
Merged

Fixes for sphinx build #1063

merged 32 commits into from
Dec 9, 2023

Conversation

ericwb
Copy link
Member

@ericwb ericwb commented Sep 22, 2023

  • The build_sphinx command has long since replaced with sphinx-build.
  • The root of the docs is now defined by root_doc instead of master_doc
  • Guard against the importlib.metadata.PackageNotFoundError exception occurring during the Sphinx build.
  • Update the copyright to current year
  • Use a platform agnostic sys.path loading in Sphinx conf

The build_sphinx command has long since replaced with
sphinx-build.
@ericwb
Copy link
Member Author

ericwb commented Sep 22, 2023

Verified it is now building: https://readthedocs.org/projects/bandit/builds/22008003/

@ericwb
Copy link
Member Author

ericwb commented Sep 22, 2023

Verified it is now building: https://readthedocs.org/projects/bandit/builds/22008003/

Nevermind, it's building, but the output looks very broken.

@ericwb ericwb changed the title Fixes for sphinx build WIP: Fixes for sphinx build Sep 28, 2023
@ericwb ericwb changed the title WIP: Fixes for sphinx build Fixes for sphinx build Dec 8, 2023
@ericwb
Copy link
Member Author

ericwb commented Dec 8, 2023

Docs now build and look proper: https://bandit.readthedocs.io/en/ericwb-patch-2/

@ericwb
Copy link
Member Author

ericwb commented Dec 8, 2023

FYI, the cryptic error from the Sphinx build looks like the following:

WARNING: autodoc: failed to import module 'formatters.screen' from module 'bandit'; the following exception was raised:
bandit

https://readthedocs.org/projects/bandit/builds/22797524/

Sphinx is swallowing the full exception, but it's raising a importlib.metadata.PackageNotFoundError

@sigmavirus24
Copy link
Member

We can install bandit as a requirement for building the docs. This is fairly common. It will resolve the version issue

Copy link
Member

@sigmavirus24 sigmavirus24 left a comment

Choose a reason for hiding this comment

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

Let's install bandit from source locally to avoid the importlib problem

@@ -16,4 +16,8 @@
from bandit.core.issue import * # noqa
from bandit.core.test_properties import * # noqa

__version__ = metadata.version("bandit")
try:
__version__ = metadata.version("bandit")
Copy link
Member

Choose a reason for hiding this comment

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

Please no

@ericwb
Copy link
Member Author

ericwb commented Dec 9, 2023

We can install bandit as a requirement for building the docs. This is fairly common. It will resolve the version issue

Thanks for the tip. That does work better!

@ericwb
Copy link
Member Author

ericwb commented Dec 9, 2023

@ericwb ericwb merged commit f3a18ab into main Dec 9, 2023
25 checks passed
@ericwb ericwb deleted the ericwb-patch-2 branch December 9, 2023 01:18
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.

2 participants