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

bug: [regression 0.46] Does not find inherited methods #295

Closed
llucax opened this issue Jun 17, 2024 · 4 comments
Closed

bug: [regression 0.46] Does not find inherited methods #295

llucax opened this issue Jun 17, 2024 · 4 comments
Assignees
Labels
unconfirmed This bug was not reproduced yet

Comments

@llucax
Copy link

llucax commented Jun 17, 2024

Description of the bug

I have a project linking to Sub.__init__, where Sub.__init__ is not actually defined but inherited from Parent.__init__. This worked fine until we upgraded to griffe 0.46.

To Reproduce

git clone https://github.com/frequenz-floss/frequenz-sdk-python.git
cd frequenz-sdk-python
python3.11 -m venv .venv
. .venv/bin/activate
python -m pip install .[dev-mkdocs]
python -m pip show griffe # Shows 0.46
mkdocs serve # fails mkdocs_autorefs: reference/frequenz/sdk/actor/index.md: Could not find cross-reference target '[frequenz.sdk.actor.Actor.__init__]'

(Sorry it is a very big project, my intuition is it should be easy to reproduce with a small code snippet just with a parent and sub-class, but if this is enough info to pin-point the bug I prefer not to spend the time to provide the proper MRE).

Full traceback

No traceback, just error message (warnings, but I use --strict) and a deprecation:

INFO    -  DeprecationWarning: Passing multiple extensions as a single list or tuple is deprecated. Please pass them as separate arguments instead.
             File "/tmp/frequenz-sdk-python/.venv/lib/python3.11/site-packages/mkdocstrings_handlers/python/handler.py", line 299, in collect
               extensions=load_extensions(extensions),
             File "/tmp/frequenz-sdk-python/.venv/lib/python3.11/site-packages/griffe/extensions/base.py", line 481, in load_extensions
               warnings.warn(
INFO    -  DeprecationWarning: This method is now a property and should be accessed as such (without parentheses).
             File "/tmp/frequenz-sdk-python/.venv/lib/python3.11/site-packages/jinja2/runtime.py", line 303, in call
               return __obj(*args, **kwargs)
             File "/tmp/frequenz-sdk-python/.venv/lib/python3.11/site-packages/griffe/mixins.py", line 393, in __call__
               warnings.warn(
WARNING -  mkdocs_autorefs: reference/frequenz/sdk/actor/index.md: Could not find cross-reference target '[frequenz.sdk.actor.Actor.__init__]'
WARNING -  mkdocs_autorefs: reference/frequenz/sdk/actor/index.md: Could not find cross-reference target '[frequenz.sdk.actor.Actor.__init__]'
WARNING -  mkdocs_autorefs: reference/frequenz/sdk/actor/index.md: Could not find cross-reference target '[frequenz.sdk.actor.Actor.__init__]'
WARNING -  mkdocs_autorefs: user-guide/actors.md: Could not find cross-reference target '[frequenz.sdk.actor.Actor.__init__]'
WARNING -  mkdocs_autorefs: user-guide/actors.md: Could not find cross-reference target '[frequenz.sdk.actor.Actor.__init__]'
WARNING -  mkdocs_autorefs: user-guide/actors.md: Could not find cross-reference target '[frequenz.sdk.actor.Actor.__init__]'

Full log with -v attached.

Expected behavior

It picks up the __init__ from the parent class as before.

Environment information

$ griffe --debug-info
- __System__: Linux-6.7.12-amd64-x86_64-with-glibc2.38
- __Python__: cpython 3.11.9 (/tmp/frequenz-sdk-python/.venv/bin/python)
- __Environment variables__:
- __Installed packages__:
  - `griffe` v0.46.0

PASTE OUTPUT HERE

Additional context

Using griffe 0.45.3 works:

$ python -m pip install griffe==0.45.3
Collecting griffe==0.45.3
  Using cached griffe-0.45.3-py3-none-any.whl.metadata (6.3 kB)
Requirement already satisfied: colorama>=0.4 in ./.venv/lib/python3.11/site-packages (from griffe==0.45.3) (0.4.6)
Using cached griffe-0.45.3-py3-none-any.whl (120 kB)
Installing collected packages: griffe
  Attempting uninstall: griffe
    Found existing installation: griffe 0.46.0
    Uninstalling griffe-0.46.0:
      Successfully uninstalled griffe-0.46.0
Successfully installed griffe-0.45.3
$ mkdocs serve
INFO    -  Building documentation...
INFO    -  [macros] - Macros arguments: {'module_name': 'docs/_scripts/macros', 'modules': [], 'render_by_default': True, 'include_dir': '', 'include_yaml': [], 'j2_block_start_string': '', 'j2_block_end_string': '', 'j2_variable_start_string': '', 'j2_variable_end_string': '', 'on_undefined': 'strict',
           'on_error_fail': True, 'verbose': False}
INFO    -  [macros] - Found local Python module 'docs/_scripts/macros' in: /tmp/frequenz-sdk-python
INFO    -  [macros] - Found external Python module 'docs/_scripts/macros' in: /tmp/frequenz-sdk-python
INFO    -  [macros] - Extra variables (config file): ['social', 'version']
INFO    -  [macros] - Extra filters (module): ['pretty']
INFO    -  Cleaning site directory
INFO    -  Doc file 'SUMMARY.md' contains an unrecognized relative link 'user-guide/', it was left as is. Did you mean 'user-guide/index.md'?
INFO    -  Doc file 'SUMMARY.md' contains an unrecognized relative link 'tutorials/', it was left as is.
INFO    -  Doc file 'SUMMARY.md' contains an unrecognized relative link 'reference/', it was left as is.
INFO    -  Doc file 'user-guide/glossary.md' contains a link '#grid_power', but there is no such anchor on this page.
INFO    -  Documentation built in 7.11 seconds
INFO    -  [10:32:53] Watching paths for changes: 'docs', 'mkdocs.yml', 'src', 'CONTRIBUTING.md'
INFO    -  [10:32:53] Serving on http://127.0.0.1:8000/
@llucax llucax added the unconfirmed This bug was not reproduced yet label Jun 17, 2024
@llucax llucax changed the title bug: Regression on 0.46, it is not allowing referencing to inherited methods? bug: [regression 0.46] Does not find inherited methods Jun 17, 2024
@pawamoy
Copy link
Member

pawamoy commented Jun 17, 2024

Thanks for the report @llucax, and sorry for the trouble. Looking into it right now.

@pawamoy
Copy link
Member

pawamoy commented Jun 17, 2024

Turns out it's the same issue as #295, so closing in favor of the oldest 🙂 See an explanation of the issue there.

@pawamoy pawamoy closed this as not planned Won't fix, can't repro, duplicate, stale Jun 17, 2024
@llucax
Copy link
Author

llucax commented Jun 17, 2024

sorry for the trouble

All good, we are using an unstable tool and we are not pinning the transitive dependencies, so we know what we are getting into 🙃

Turns out it's the same issue as #295

You linked to this very same issue 😬 😆

@pawamoy
Copy link
Member

pawamoy commented Jun 17, 2024

Erm, #294 😂

pawamoy added a commit that referenced this issue Jun 17, 2024
….) to be public

The reasoning is that is a special object, even though it is not accessed directly, provides public functionality: comparing objects, multiplying them, printing their Python representation or stringified version, etc..

Issue-294: #294
Issue-295: #295
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unconfirmed This bug was not reproduced yet
Projects
None yet
Development

No branches or pull requests

2 participants