Skip to content

Commit

Permalink
emphasize @deprecated decorators (#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhils authored Oct 11, 2024
1 parent 9ac4e58 commit 308c3a1
Show file tree
Hide file tree
Showing 33 changed files with 118 additions and 68 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions pdoc/templates/content.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion pdoc/templates/default/module.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -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) -%}
Expand Down
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
Expand Up @@ -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.

0 comments on commit 308c3a1

Please sign in to comment.