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

Emphasize @deprecated decorators #750

Merged
merged 2 commits into from
Oct 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -4,8 +4,10 @@

## Unreleased: pdoc next

- Remove support for Python 3.8, which has reached end-of-life on 2024-10-07 .
- Remove support for Python 3.8, which has reached end-of-life on 2024-10-07.
([#747](https://github.com/mitmproxy/pdoc/pull/747), @mhils)
- Python 3.13: `@deprecated` decorators are now rendered with visual emphasis.
([#750](https://github.com/mitmproxy/pdoc/pull/750), @mhils)
- Inherited members are now hidden by default if the base class is not part of the documentation.
Please make yourself heard in https://github.com/mitmproxy/pdoc/issues/715 if you relied on the old behavior.
([#748](https://github.com/mitmproxy/pdoc/pull/748), @mhils)
7 changes: 7 additions & 0 deletions pdoc/templates/content.css
Original file line number Diff line number Diff line change
@@ -308,6 +308,13 @@ This makes sure that the pdoc styling doesn't leak to the rest of the page when
margin-left: 2rem;
}

.pdoc .decorator-deprecated {
color: #842029;
}
.pdoc .decorator-deprecated ~ span {
filter: grayscale(1) opacity(0.8);
}

.pdoc .name {
color: var(--name);
font-weight: bold;
2 changes: 1 addition & 1 deletion pdoc/templates/default/module.html.jinja2
Original file line number Diff line number Diff line change
@@ -162,7 +162,7 @@ See https://pdoc.dev/docs/pdoc/render_helpers.html#DefaultMacroExtension for an
{% enddefaultmacro %}
{% defaultmacro decorators(doc) %}
{% for d in doc.decorators if not d.startswith("@_") %}
<div class="decorator">{{ d }}</div>
<div class="decorator decorator-{{ d[1:].partition("(")[0] }}">{{ d }}</div>
{% endfor %}
{% enddefaultmacro %}
{% defaultmacro function(fn) -%}
2 changes: 1 addition & 1 deletion test/testdata/ast_parsing.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/collections_abc.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/demo.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/demo_eager.html

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions test/testdata/demo_long.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/demopackage.html

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions test/testdata/demopackage_dir.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/enums.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/example_customtemplate.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/example_darkmode.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/example_mkdocs.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/flavors_google.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/flavors_numpy.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/flavors_rst.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/math_demo.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/math_misc.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/mermaid_demo.html

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions test/testdata/misc.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/misc_py310.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/misc_py312.html

Large diffs are not rendered by default.

54 changes: 43 additions & 11 deletions test/testdata/misc_py313.html

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions test/testdata/misc_py313.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
from warnings import deprecated


class MyDict(dict):
pass


class CustomException(RuntimeError):
"""custom exception type"""


@deprecated("Do not use this anymore")
def deprecated_func():
pass
1 change: 1 addition & 0 deletions test/testdata/misc_py313.txt
Original file line number Diff line number Diff line change
@@ -18,4 +18,5 @@
<method def add_note(self, object, /): ... # inherited from builtins.BaseException.add_note, Exception.add_note(n…>
<var args # inherited from builtins.BaseException.args>
>
<@deprecated('Do not use this anymore') function def deprecated_func(): ...>
>
2 changes: 1 addition & 1 deletion test/testdata/pyo3_sample_library.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions test/testdata/render_options.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/top_level_reimports.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/type_checking_imports.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/type_stubs.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/typed_dict.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/testdata/visibility.html

Large diffs are not rendered by default.