[DE-7207] Fix sphinx doc build errors and warnings#453
Merged
Conversation
edwinpav
commented
Mar 2, 2026
| import os | ||
| import sys | ||
|
|
||
| import pkg_resources |
edwinpav
commented
Mar 2, 2026
| @@ -1,14 +1,12 @@ | |||
| [tool.pylint.MESSAGE_CONTROL] | |||
| disable= | |||
| bad-continuation, | |||
Contributor
Author
There was a problem hiding this comment.
bad-continuation was deleted from pylint entirely in version 2.6
edwinpav
commented
Mar 2, 2026
| C0111, | ||
| C0103, | ||
| R0904, | ||
| R0201, |
Contributor
Author
There was a problem hiding this comment.
Using error code seems more robust than using optional no-self-use
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
edwinpav
commented
Mar 3, 2026
| importlib-metadata = "^1.0.0" | ||
|
|
||
| [tool.poetry.dev-dependencies] | ||
| [tool.poetry.group.dev.dependencies] |
Contributor
Author
There was a problem hiding this comment.
Was getting:
The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead.
poetry.group.dev.dependencies already exited below, so I merged that into this, and changed the name of this section to the non-deprecated version.
vinay553
approved these changes
Mar 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Main change is I removed the deprecated
pkg_resourcespackage and replaced it withimportlib-metadata.pkg_resourcespackage was causing 2 main problems:pkg_resourcesis deprecated message, which was annoying, misleading, and confusing. They got this error because this package was imported in theerrors.pyfile since one of the error messages is meant to remind the user of the version package that they're on, and to update it to the most recent version if applicable.I also fixed the formatting of many pages/documentation.
When running
sphinx-build -b html . _build/htmlbefore my changes, there were ~79 errors/warnings. Now, there is only 13 warnings and 0 errors.For example, fixed this this entire page (if you go on it now, its super messy and clunky): https://docs.nucleus.scale.com/en/latest/api/nucleus/model_run/index.html#module-nucleus.model_run.ModelRun.predict
Other examples:

(old)
(new)

Greptile Summary
This PR replaces the deprecated
pkg_resourcespackage withimportlib_metadatafor version lookups, fixes ~66 Sphinx documentation build errors/warnings, and resolves circular import issues in the metrics subpackage.pkg_resources.get_distributionwithimportlib_metadata.versionindocs/conf.pyandnucleus/errors.py, eliminating deprecation warnings shown to users on SDK errorsfrom . import metricstonucleus/__init__.pyfor autoapi doc generation, and fixed resulting circular imports by changingmetrics/custom_types.pyandmetrics/segmentation_utils.pyto import directly fromnucleus.annotationandnucleus.predictioninstead of top-levelnucleusmodel_run.py,__init__.py,validate/client.py, andvalidate/scenario_test_metric.pyfrom ad-hoc:param/:return:format to Napoleon-styleParameters:/Returns::with proper RST formattingdocs/_templates/python/module.rstto use dynamic heading underline length[tool.poetry.group.dev.dependencies]section and migrated from deprecated[tool.poetry.dev-dependencies]inpyproject.tomlbad-continuation,no-self-use) from.pylintrcConfidence Score: 4/5
pkg_resourceswithimportlib_metadata) is straightforward and well-executed. The circular import fix in metrics subpackage is correctly handled. All other changes are docstring reformatting. The only minor consideration is the newimportlib-metadataruntime dependency, but it's the correct choice given the Python >=3.7 support requirement.nucleus/__init__.py(newfrom . import metricsimport) andnucleus/metrics/custom_types.py/nucleus/metrics/segmentation_utils.py(circular import fixes) to confirm no import regressions.Important Files Changed
from . import metrics, movedrequests/tqdmimports above pydantic compatibility block, and reformatted docstrings for Sphinx compliance. Import reordering fixes circular import with metrics subpackage.pkg_resourceswithimportlib_metadatafor getting package version inNucleusAPIError.pkg_resourceswithimportlib_metadata, removed deprecatedhtml_theme_optionsfor furo theme.nucleus(top-level) tonucleus.annotationandnucleus.predictiondirectly, fixing circular import caused by newfrom . import metricsin__init__.py.nucleusto direct submodule imports (nucleus.annotation,nucleus.prediction) to avoid circular imports.__all__withMetricandScalarResultto control autoapi doc generation.:param/:return:format to proper Napoleon-styleParameters:andReturns::with RST code blocks.Raises:format to proper Sphinx-compatible exception documentation.importlib-metadataas runtime dependency, consolidated duplicate[tool.poetry.group.dev.dependencies]section, migrated from deprecated[tool.poetry.dev-dependencies].=============.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A["nucleus/__init__.py"] -->|"from . import metrics (NEW)"| B["nucleus/metrics/__init__.py"] B --> C["nucleus/metrics/custom_types.py"] B --> D["nucleus/metrics/segmentation_utils.py"] C -->|"OLD: from nucleus import ..."| A C -->|"NEW: from nucleus.annotation import ..."| E["nucleus/annotation.py"] C -->|"NEW: from nucleus.prediction import ..."| F["nucleus/prediction.py"] D -->|"OLD: from nucleus import ..."| A D -->|"NEW: from nucleus.annotation import ..."| E D -->|"NEW: from nucleus.prediction import ..."| F A --> E A --> F style A fill:#e1f5fe style B fill:#e1f5fe style C fill:#fff3e0 style D fill:#fff3e0 style E fill:#e8f5e9 style F fill:#e8f5e9Last reviewed commit: c583cdd