Skip to content

pytkdocs/django compatibility issues #149

Closed
@jmcgill298

Description

@jmcgill298

Please open an issue on pytkdocs instead
if this is related to Python docstrings parsing or the collection of Python objects!

Describe the bug
Having pytkdocs >= 0.12.0 causes mkdocstrings build to crash with Django projects. Installation of pytkdocs with pip installs a version of pytkdocs >= 0.12.0.

To Reproduce
Steps to reproduce the behavior:

  1. pip install mkdocstrings
  2. add mkdocs config to load docstrings for Django project
  3. run mkdocs build cli command
  4. See error

Expected behavior
I expected the docs to be built

Screenshots

nautobot@2f093c201409:~/plugins/nautobot-plugin-device-status-change$ python -m mkdocs build
INFO     -  MERMAID2  - Initialization arguments: {}
INFO     -  MERMAID2  - Using javascript library (8.11.2):
               https://unpkg.com/[email protected]/dist/mermaid.min.js
INFO     -  Cleaning site directory
INFO     -  Building documentation to directory: /opt/nautobot/plugins/nautobot-plugin-device-status-change/site
ERROR    -  mkdocstrings.extension: 'FilterSetOptions' object has no attribute 'get_fields'
            Traceback (most recent call last):
              File "/opt/nautobot/.local/lib/python3.6/site-packages/pytkdocs/cli.py", line 205, in main
                output = json.dumps(process_json(line))
              File "/opt/nautobot/.local/lib/python3.6/site-packages/pytkdocs/cli.py", line 114, in process_json
                return process_config(json.loads(json_input))
              File "/opt/nautobot/.local/lib/python3.6/site-packages/pytkdocs/cli.py", line 91, in process_config
                obj = loader.get_object_documentation(path, members)
              File "/opt/nautobot/.local/lib/python3.6/site-packages/pytkdocs/loader.py", line 358, in get_object_documentation
                root_object = self.get_module_documentation(leaf, members)
              File "/opt/nautobot/.local/lib/python3.6/site-packages/pytkdocs/loader.py", line 426, in get_module_documentation
                root_object.add_child(self.get_class_documentation(child_node))
              File "/opt/nautobot/.local/lib/python3.6/site-packages/pytkdocs/loader.py", line 519, in get_class_documentation
                child = self.get_class_documentation(child_node)
              File "/opt/nautobot/.local/lib/python3.6/site-packages/pytkdocs/loader.py", line 542, in get_class_documentation
                if self.detect_field_model(attr_name, direct_members, all_members):
              File "/opt/nautobot/.local/lib/python3.6/site-packages/pytkdocs/loader.py", line 577, in detect_field_model
                if remainder and not attrgetter(remainder)(all_members[first_order_attr_name]):
            AttributeError: 'FilterSetOptions' object has no attribute 'get_fields'
ERROR    -  Error reading page 'api/views.md':
ERROR    -  Could not collect 'device_status_change_plugin.views'

Aborted with a BuildError!

Information (please complete the following information):

  • OS: Ubuntu 20.04 WSL2
  • mkdocstrings version: 0.16.2 (tried all since June)
  • pytkdocs version: 0.[12, 13, 14].0 (worked once I got to 0.11.1)

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    unconfirmedThis bug was not reproduced yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions