Comments (8)
It's again because of wildcard imports (which Griffe does not handle perfectly, for various reasons).
- (descending)
freetensor
wildcard importsfreetensor.libop
- which wildcard imports
freetensor.libop.softmax
- which imports
freetensor.core
- so
freetensor.libop.softmax.core
is an alias tofreetensor.core
- and (ascending)
freetensor.libop.core
is an alias tofreetensor.core.softmax.core
- and
freetensor.core
is an alias tofreetensor.libop.core
- thus creating an (undetected) indirect cycle
freetensor.core
->freetensor.core
I think I've been able to add a guardrail against this case. I'll push a fix soon after I verified this is working properly.
from griffe.
😱
Thanks for the report, will try and replicate now 🙂
from griffe.
Griffe 0.25.1 should fix it 🙂
Let me know if it doesn't and I'll reopen.
from griffe.
Sorry for the late response. The infinite recursion erorr did disappear, but no API is rendered. The result is only an empty page. I have tried both Griffe 0.25.1 and 0.25.5, with other dependencies kept to the latest.
Please still use the repo mentioned in #83 to reproduce. The specific commit I tried is roastduck/FreeTensor@63cd89f .
Only the old "mkdocstrings==0.18.1" "pytkdocs[numpy-style]"
works for me.
from griffe.
That's alright! Thanks for reporting :) Good to hear this is fixed. Now you're probably just missing the show_submodules: true
option (globally in mkdocs.yml or locally in your Markdown page).
from griffe.
show_submoduels: true
works, but it results in another error:
INFO - Building documentation...
INFO - mkdocstrings: DEPRECATION: mkdocstrings' watch feature is deprecated in favor of MkDocs' watch feature, see https://www.mkdocs.org/user-guide/configuration/#watch
INFO - Cleaning site directory
WARNING - griffe: freetensor/libop/element_wise.py:288: Parameter 'out' does not appear in the function signature
ERROR - Error building page 'api.md': Could not resolve freetensor.libop.softmax.core
Traceback (most recent call last):
File "/home/rd/.local/lib/python3.9/site-packages/mkdocs_autorefs/plugin.py", line 78, in _get_item_url
return self._url_map[identifier]
KeyError: 'freetensor.core.VarRef'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/rd/.local/lib/python3.9/site-packages/griffe/dataclasses.py", line 945, in resolve_target
resolved = self.modules_collection[self.target_path]
File "/home/rd/.local/lib/python3.9/site-packages/griffe/mixins.py", line 28, in __getitem__
return self.members[parts[0]][parts[1:]] # type: ignore[attr-defined]
File "/home/rd/.local/lib/python3.9/site-packages/griffe/mixins.py", line 28, in __getitem__
return self.members[parts[0]][parts[1:]] # type: ignore[attr-defined]
File "/home/rd/.local/lib/python3.9/site-packages/griffe/mixins.py", line 28, in __getitem__
return self.members[parts[0]][parts[1:]] # type: ignore[attr-defined]
File "/home/rd/.local/lib/python3.9/site-packages/griffe/dataclasses.py", line 821, in __getitem__
return self.target[key]
File "/home/rd/.local/lib/python3.9/site-packages/griffe/mixins.py", line 27, in __getitem__
return self.members[parts[0]] # type: ignore[attr-defined]
KeyError: 'core'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/rd/.local/bin/mkdocs", line 8, in <module>
sys.exit(cli())
File "/home/rd/.local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/home/rd/.local/lib/python3.9/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/rd/.local/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/rd/.local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/rd/.local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/rd/.local/lib/python3.9/site-packages/mkdocs/__main__.py", line 234, in serve_command
serve.serve(dev_addr=dev_addr, livereload=livereload, watch=watch, **kwargs)
File "/home/rd/.local/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 82, in serve
builder(config)
File "/home/rd/.local/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 75, in builder
build(config, live_server=live_server, dirty=dirty)
File "/home/rd/.local/lib/python3.9/site-packages/mkdocs/commands/build.py", line 329, in build
_build_page(file.page, config, doc_files, nav, env, dirty)
File "/home/rd/.local/lib/python3.9/site-packages/mkdocs/commands/build.py", line 234, in _build_page
output = config.plugins.run_event('post_page', output, page=page, config=config)
File "/home/rd/.local/lib/python3.9/site-packages/mkdocs/plugins.py", line 517, in run_event
result = method(item, **kwargs)
File "/home/rd/.local/lib/python3.9/site-packages/mkdocs_autorefs/plugin.py", line 205, in on_post_page
fixed_output, unmapped = fix_refs(output, url_mapper)
File "/home/rd/.local/lib/python3.9/site-packages/mkdocs_autorefs/references.py", line 191, in fix_refs
html = AUTO_REF_RE.sub(fix_ref(url_mapper, unmapped), html)
File "/home/rd/.local/lib/python3.9/site-packages/mkdocs_autorefs/references.py", line 157, in inner
url = url_mapper(unescape(identifier))
File "/home/rd/.local/lib/python3.9/site-packages/mkdocs_autorefs/plugin.py", line 107, in get_item_url
url = self._get_item_url(identifier, fallback)
File "/home/rd/.local/lib/python3.9/site-packages/mkdocs_autorefs/plugin.py", line 83, in _get_item_url
new_identifiers = fallback(identifier)
File "/home/rd/.local/lib/python3.9/site-packages/mkdocstrings/handlers/base.py", line 508, in get_anchors
anchors = handler.get_anchors(handler.collect(identifier, fallback_config))
File "/home/rd/.local/lib/python3.9/site-packages/mkdocstrings_handlers/python/handler.py", line 200, in collect
doc_object = self._modules_collection[identifier]
File "/home/rd/.local/lib/python3.9/site-packages/griffe/mixins.py", line 28, in __getitem__
return self.members[parts[0]][parts[1:]] # type: ignore[attr-defined]
File "/home/rd/.local/lib/python3.9/site-packages/griffe/mixins.py", line 28, in __getitem__
return self.members[parts[0]][parts[1:]] # type: ignore[attr-defined]
File "/home/rd/.local/lib/python3.9/site-packages/griffe/dataclasses.py", line 821, in __getitem__
return self.target[key]
File "/home/rd/.local/lib/python3.9/site-packages/griffe/dataclasses.py", line 921, in target
self.resolve_target()
File "/home/rd/.local/lib/python3.9/site-packages/griffe/dataclasses.py", line 952, in resolve_target
self._target.aliases[self.path] = self # type: ignore[union-attr] # we just set the target
File "/home/rd/.local/lib/python3.9/site-packages/griffe/dataclasses.py", line 812, in __getattr__
attr = getattr(self.target, name)
File "/home/rd/.local/lib/python3.9/site-packages/griffe/dataclasses.py", line 921, in target
self.resolve_target()
File "/home/rd/.local/lib/python3.9/site-packages/griffe/dataclasses.py", line 947, in resolve_target
raise AliasResolutionError(self.target_path) from error
griffe.exceptions.AliasResolutionError: Could not resolve freetensor.libop.softmax.core
freetensor.libop.softmax.core
is indeed an alias. It is an from .. import core
, which is actually freetensor.core
. I have no idea why this alias cannot be resolved.
Tested with Griffe 0.25.5.
Feel free to open a new issue if you like.
from griffe.
One day it will work maybe 🤣
Thanks for the update, I'll investigate :)
from griffe.
Will close now, keep opening issues if you have any 🙏 ❤️
from griffe.
Related Issues (20)
- Get class parameters from parent's __init__ HOT 2
- RecursionError with Griffe, Material HOT 1
- API checks: double pass, static+dynamic analysis
- Numpy docstring for fixed set of values
- Skip Alias Resolution HOT 7
- numpydoc sections not represented as its own block, if first in docstring HOT 3
- fuzzing: Failing cases found with pysource-codegen HOT 6
- API checks: Don't report type-guarded objects HOT 4
- API checks: Improve reporting for attribute who lost their value
- Module overrides member HOT 3
- feature: Expressions modernization HOT 1
- not all members have is_package/is_module HOT 3
- class attribute has label 'instance-attribute' HOT 3
- feature: Support meson-python's editable installs
- bug: property and cached_property of dataclasses are class parameters HOT 1
- bug: A dataclass field with init=False should not be a parameter HOT 3
- bug: parameter kinds for dataclasses should match the non-dataclass equivalents
- bug: MkDocs !!! and ??? admonitions can no longer be parsed HOT 3
- bug: Regular classes that inherit dataclass do not get dataclass parameters HOT 1
- bug: A class that derives from a dataclass should be labelled a dataclass HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from griffe.