diff --git a/CHANGELOG.md b/CHANGELOG.md index b7e2acb8..67ae3c02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.16.7](https://github.com/mkdocstrings/python/releases/tag/1.16.7) - 2025-03-20 + +[Compare with 1.16.6](https://github.com/mkdocstrings/python/compare/1.16.6...1.16.7) + +### Code Refactoring + +- Prepare `public` filtering method feature ([fde2019](https://github.com/mkdocstrings/python/commit/fde20191cab20f39d9e5e729a95cdfa3390b8f1f) by Timothée Mazzucotelli). [Issue-78](https://github.com/mkdocstrings/python/issues/78) + ## [1.16.6](https://github.com/mkdocstrings/python/releases/tag/1.16.6) - 2025-03-18 [Compare with 1.16.5](https://github.com/mkdocstrings/python/compare/1.16.5...1.16.6) diff --git a/docs/insiders/changelog.md b/docs/insiders/changelog.md index 2508ec26..edddd290 100644 --- a/docs/insiders/changelog.md +++ b/docs/insiders/changelog.md @@ -2,6 +2,10 @@ ## mkdocstrings-python Insiders +### 1.11.0 March 20, 2025 { id="1.11.0" } + +- [Filtering method: `public`][option-filters-public] + ### 1.10.0 March 10, 2025 { id="1.10.0" } - [Backlinks][backlinks] diff --git a/docs/insiders/goals.yml b/docs/insiders/goals.yml index 2153312d..1dbf1597 100644 --- a/docs/insiders/goals.yml +++ b/docs/insiders/goals.yml @@ -45,3 +45,6 @@ goals: - name: Backlinks ref: /usage/configuration/general/#backlinks since: 2025/03/10 + - name: "Filtering method: `public`" + ref: /usage/configuration/members/#option-filters-public + since: 2025/03/20 diff --git a/docs/usage/configuration/members.md b/docs/usage/configuration/members.md index 363f7e0a..52e0d574 100644 --- a/docs/usage/configuration/members.md +++ b/docs/usage/configuration/members.md @@ -335,10 +335,21 @@ def function_c(): [](){#option-filters} ## `filters` -- **:octicons-package-24: Type list[str] | None :material-equal: `["!^_[^_]"]`{ title="default value" }** +- **:octicons-package-24: Type list[str] | Literal["public"] | None :material-equal: `["!^_[^_]"]`{ title="default value" }** -A list of filters applied to filter objects based on their name. +A list of filters, or `"public"`. + +**Filtering methods** + +[](){#option-filters-public} + +[:octicons-heart-fill-24:{ .pulse } Sponsors only](../../insiders/index.md){ .insiders } — +[:octicons-tag-24: Insiders 1.11.0](../../insiders/changelog.md#1.11.0) + +The `public` filtering method will include only public objects: those added to the `__all__` attribute of modules, or not starting with a single underscore. Special methods and attributes ("dunder" methods/attributes, starting and ending with two underscores), like `__init__`, `__call__`, `__mult__`, etc., are always considered public. + +**List of filters** Filters are regular expressions. These regular expressions are evaluated by Python and so must match the syntax supported by the [`re`][] module. @@ -379,13 +390,13 @@ plugins: python: options: filters: - - "!^_" + - "!^_[^_]" ``` ```md title="or in docs/some_page.md (local configuration)" ::: package.module options: - filters: [] + filters: public ``` ```python title="package/module.py" diff --git a/mkdocs.yml b/mkdocs.yml index 3e03312a..6fc301b0 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -160,7 +160,7 @@ plugins: ignore_init_summary: true docstring_section_style: list extensions: [scripts/griffe_extensions.py] - filters: ["!^_"] + filters: public heading_level: 1 inherited_members: true line_length: 88 diff --git a/src/mkdocstrings_handlers/python/_internal/config.py b/src/mkdocstrings_handlers/python/_internal/config.py index a09f9fbe..89ea451c 100644 --- a/src/mkdocstrings_handlers/python/_internal/config.py +++ b/src/mkdocstrings_handlers/python/_internal/config.py @@ -432,14 +432,24 @@ class PythonInputOptions: ] = field(default_factory=list) filters: Annotated[ - list[str], + list[str] | Literal["public"], _Field( group="members", - description="""A list of filters applied to filter objects based on their name. + description="""A list of filters, or `"public"`. + + **List of filters** A filter starting with `!` will exclude matching objects instead of including them. The `members` option takes precedence over `filters` (filters will still be applied recursively to lower members in the hierarchy). + + **Filtering methods** + + [:octicons-heart-fill-24:{ .pulse } Sponsors only](../insiders/index.md){ .insiders } — + [:octicons-tag-24: Insiders 1.11.0](../insiders/changelog.md#1.11.0) + + The `public` method will include only public objects: + those added to `__all__` or not starting with an underscore (except for special methods/attributes). """, ), ] = field(default_factory=lambda: _DEFAULT_FILTERS.copy()) @@ -916,12 +926,12 @@ def from_data(cls, **data: Any) -> Self: class PythonOptions(PythonInputOptions): # type: ignore[override,unused-ignore] """Final options passed as template context.""" - filters: list[tuple[re.Pattern, bool]] = field( # type: ignore[assignment] + filters: list[tuple[re.Pattern, bool]] | Literal["public"] = field( # type: ignore[assignment] default_factory=lambda: [ (re.compile(filtr.removeprefix("!")), filtr.startswith("!")) for filtr in _DEFAULT_FILTERS ], ) - """A list of filters applied to filter objects based on their name.""" + """A list of filters, or `"public"`.""" summary: SummaryOption = field(default_factory=SummaryOption) """Whether to render summaries of modules, classes, functions (methods) and attributes.""" @@ -930,6 +940,11 @@ class PythonOptions(PythonInputOptions): # type: ignore[override,unused-ignore] def coerce(cls, **data: Any) -> MutableMapping[str, Any]: """Create an instance from a dictionary.""" if "filters" in data: + # Non-insiders: transform back to default filters. + # Next: `if "filters" in data and not isinstance(data["filters"], str):`. + if data["filters"] == "public": + data["filters"] = _DEFAULT_FILTERS + # Filters are `None` or a sequence of strings (tests use tuples). data["filters"] = [ (re.compile(filtr.removeprefix("!")), filtr.startswith("!")) for filtr in data["filters"] or () ] diff --git a/src/mkdocstrings_handlers/python/_internal/rendering.py b/src/mkdocstrings_handlers/python/_internal/rendering.py index 313658bc..8ab9b21f 100644 --- a/src/mkdocstrings_handlers/python/_internal/rendering.py +++ b/src/mkdocstrings_handlers/python/_internal/rendering.py @@ -148,7 +148,7 @@ def do_format_signature( The same code, formatted. """ env = context.environment - # YORE: Bump 2: Replace `do_get_template(env, "signature")` with `"signature.html.jinja"`. + # YORE: Bump 2: Replace `do_get_template(env, "signature")` with `"signature.html.jinja"` within line. template = env.get_template(do_get_template(env, "signature")) if annotations is None: @@ -208,7 +208,7 @@ def do_format_attribute( The same code, formatted. """ env = context.environment - # YORE: Bump 2: Replace `do_get_template(env, "expression")` with `"expression.html.jinja"`. + # YORE: Bump 2: Replace `do_get_template(env, "expression")` with `"expression.html.jinja"` within line. template = env.get_template(do_get_template(env, "expression")) annotations = context.parent["config"].show_signature_annotations @@ -399,7 +399,7 @@ def _keep_object(name: str, filters: Sequence[tuple[Pattern, bool]]) -> bool: def do_filter_objects( objects_dictionary: dict[str, Object | Alias], *, - filters: Sequence[tuple[Pattern, bool]] | None = None, + filters: Sequence[tuple[Pattern, bool]] | Literal["public"] | None = None, members_list: bool | list[str] | None = None, inherited_members: bool | list[str] = False, keep_no_docstrings: bool = True, @@ -408,7 +408,7 @@ def do_filter_objects( Parameters: objects_dictionary: The dictionary of objects. - filters: Filters to apply, based on members' names. + filters: Filters to apply, based on members' names, or `"public"`. Each element is a tuple: a pattern, and a boolean indicating whether to reject the object if the pattern matches. members_list: An optional, explicit list of members to keep. @@ -449,7 +449,9 @@ def do_filter_objects( ] # Use filters and docstrings. - if filters: + if filters == "public": + objects = [obj for obj in objects if obj.is_public] + elif filters: objects = [ obj for obj in objects if _keep_object(obj.name, filters) or (inherited_members_specified and obj.inherited) ] diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja index 40c011ed..0b9fcd64 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja @@ -49,7 +49,7 @@ Context: {% endif %} {% with heading_level = heading_level + extra_level %} {% for attribute in attributes|order_members(config.members_order, members_list) %} - {% if members_list is not none or (not attribute.is_imported or attribute.is_public) %} + {% if config.filters == "public" or members_list is not none or (not attribute.is_imported or attribute.is_public) %} {% include attribute|get_template with context %} {% endif %} {% endfor %} @@ -69,7 +69,7 @@ Context: {% endif %} {% with heading_level = heading_level + extra_level %} {% for class in classes|order_members(config.members_order, members_list) %} - {% if members_list is not none or (not class.is_imported or class.is_public) %} + {% if config.filters == "public" or members_list is not none or (not class.is_imported or class.is_public) %} {% include class|get_template with context %} {% endif %} {% endfor %} @@ -90,7 +90,7 @@ Context: {% with heading_level = heading_level + extra_level %} {% for function in functions|order_members(config.members_order, members_list) %} {% if not (obj.kind.value == "class" and function.name == "__init__" and config.merge_init_into_class) %} - {% if members_list is not none or (not function.is_imported or function.is_public) %} + {% if config.filters == "public" or members_list is not none or (not function.is_imported or function.is_public) %} {% include function|get_template with context %} {% endif %} {% endif %} @@ -112,7 +112,7 @@ Context: {% endif %} {% with heading_level = heading_level + extra_level %} {% for module in modules|order_members("alphabetical", members_list) %} - {% if members_list is not none or (not module.is_alias or module.is_public) %} + {% if config.filters == "public" or members_list is not none or (not module.is_alias or module.is_public) %} {% include module|get_template with context %} {% endif %} {% endfor %} @@ -137,7 +137,7 @@ Context: {% if not (obj.is_class and child.name == "__init__" and config.merge_init_into_class) %} - {% if members_list is not none or child.is_public %} + {% if config.filters == "public" or members_list is not none or child.is_public %} {% if child.is_attribute %} {% with attribute = child %} {% include attribute|get_template with context %} diff --git a/tests/snapshots/__init__.py b/tests/snapshots/__init__.py index 712cdafe..e411bfa8 100644 --- a/tests/snapshots/__init__.py +++ b/tests/snapshots/__init__.py @@ -353,5 +353,35 @@ ("inherited_members", ()), ("members", ()), ): external("a185e216dc7b*.html"), + (("filters", "public"), ("inherited_members", ("method1",)), ("members", None)): external("6af55596d9c4*.html"), + (("filters", "public"), ("inherited_members", ("method1",)), ("members", False)): external( + "6abf5ddd819b*.html", + ), + (("filters", "public"), ("inherited_members", ()), ("members", None)): external("6d72c524b827*.html"), + (("filters", "public"), ("inherited_members", False), ("members", False)): external("9dab67183389*.html"), + (("filters", "public"), ("inherited_members", ("method1",)), ("members", True)): external("6c0b7207df03*.html"), + (("filters", "public"), ("inherited_members", True), ("members", ())): external("f48d651b3f1a*.html"), + (("filters", "public"), ("inherited_members", ("method1",)), ("members", ("module_attribute",))): external( + "408244423577*.html", + ), + (("filters", "public"), ("inherited_members", True), ("members", None)): external("16295fa51a2c*.html"), + (("filters", "public"), ("inherited_members", True), ("members", True)): external("37232379c426*.html"), + (("filters", "public"), ("inherited_members", ()), ("members", ())): external("2e866eca9a45*.html"), + (("filters", "public"), ("inherited_members", True), ("members", False)): external("ed5d07bcdbaa*.html"), + (("filters", "public"), ("inherited_members", False), ("members", ())): external("135f57223e00*.html"), + (("filters", "public"), ("inherited_members", False), ("members", None)): external("b4e20d5cd52e*.html"), + (("filters", "public"), ("inherited_members", ()), ("members", False)): external("46daa7e60b98*.html"), + (("filters", "public"), ("inherited_members", False), ("members", True)): external("a255ee80bf7a*.html"), + (("filters", "public"), ("inherited_members", ()), ("members", True)): external("74e2496015e1*.html"), + (("filters", "public"), ("inherited_members", True), ("members", ("module_attribute",))): external( + "e254ae60f9af*.html", + ), + (("filters", "public"), ("inherited_members", ("method1",)), ("members", ())): external("51d73351dc55*.html"), + (("filters", "public"), ("inherited_members", ()), ("members", ("module_attribute",))): external( + "d56d3aeae22b*.html", + ), + (("filters", "public"), ("inherited_members", False), ("members", ("module_attribute",))): external( + "80399c502938*.html", + ), }, ) diff --git a/tests/snapshots/external/135f57223e006849dcdd1463367127e4c5ee4aba5f12bde17ab3e494dbeed490.html b/tests/snapshots/external/135f57223e006849dcdd1463367127e4c5ee4aba5f12bde17ab3e494dbeed490.html new file mode 100644 index 00000000..e8d65a7e --- /dev/null +++ b/tests/snapshots/external/135f57223e006849dcdd1463367127e4c5ee4aba5f12bde17ab3e494dbeed490.html @@ -0,0 +1,22 @@ + + +
+

+ + members_package + +

+
+

+ Docstring for the package. +

+
+
+
+
diff --git a/tests/snapshots/external/16295fa51a2c3a60d1461a9a14093603333f836326a007d8eb061f78ab38a712.html b/tests/snapshots/external/16295fa51a2c3a60d1461a9a14093603333f836326a007d8eb061f78ab38a712.html new file mode 100644 index 00000000..40c14a7b --- /dev/null +++ b/tests/snapshots/external/16295fa51a2c3a60d1461a9a14093603333f836326a007d8eb061f78ab38a712.html @@ -0,0 +1,506 @@ + + +
+

+ + members_package + +

+
+

+ Docstring for the package. +

+
+
+

+ + + module_attribute + + + = + + + 42 + + + + + + module-attribute + + + +

+
+

+ Docstring for + + module_attribute + + . +

+
+
+
+

+ + Class + +

+
+

+ Docstring for + + Class + + . +

+
+
+

+ + + class_attribute + + + = + + + 42 + + + + + + class-attribute + + + + + instance-attribute + + + +

+
+

+ Docstring for + + Class.class_attribute + + . +

+
+
+
+

+ + + instance_attribute + + + = + + + a + + + + + + + b + + + + + + instance-attribute + + + +

+
+

+ Docstring for + + Class.instance_attribute + + . +

+
+
+
+

+ + NestedClass + +

+
+

+ Docstring for + + NestedClass + + . +

+
+
+
+

+ + + __init__ + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.__init__ + + . +

+
+
+
+

+ + + method1 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method1 + + . +

+
+
+
+

+ + + method2 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method2 + + . +

+
+
+
+
+
+
+

+ + Subclass + +

+
+

+ Bases: + + + Class + + +

+

+ Docstring for + + Subclass + + . +

+
+
+

+ + + class_attribute + + + = + + + 42 + + + + + + class-attribute + + + + + instance-attribute + + + +

+
+

+ Docstring for + + Class.class_attribute + + . +

+
+
+
+

+ + + instance_attribute + + + = + + + a + + + + + + + b + + + + + + instance-attribute + + + +

+
+

+ Docstring for + + Class.instance_attribute + + . +

+
+
+
+

+ + NestedClass + +

+
+

+ Docstring for + + NestedClass + + . +

+
+
+
+

+ + + __init__ + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.__init__ + + . +

+
+
+
+

+ + + method1 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method1 + + . +

+
+
+
+

+ + + method2 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method2 + + . +

+
+
+
+
+
+
+

+ + + module_function + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + module_function + + . +

+
+
+
+
+
diff --git a/tests/snapshots/external/2e866eca9a45f82cd1e16bb55bbc2a03bb19548457598bca83141cb375fb1aa3.html b/tests/snapshots/external/2e866eca9a45f82cd1e16bb55bbc2a03bb19548457598bca83141cb375fb1aa3.html new file mode 100644 index 00000000..ac0222f5 --- /dev/null +++ b/tests/snapshots/external/2e866eca9a45f82cd1e16bb55bbc2a03bb19548457598bca83141cb375fb1aa3.html @@ -0,0 +1,22 @@ + + +
+

+ + members_package + +

+
+

+ Docstring for the package. +

+
+
+
+
diff --git a/tests/snapshots/external/37232379c426474cc962db72ded419e39c3e416c30e367c8745f3be4e86557a4.html b/tests/snapshots/external/37232379c426474cc962db72ded419e39c3e416c30e367c8745f3be4e86557a4.html new file mode 100644 index 00000000..13b2239c --- /dev/null +++ b/tests/snapshots/external/37232379c426474cc962db72ded419e39c3e416c30e367c8745f3be4e86557a4.html @@ -0,0 +1,506 @@ + + +
+

+ + members_package + +

+
+

+ Docstring for the package. +

+
+
+

+ + + module_attribute + + + = + + + 42 + + + + + + module-attribute + + + +

+
+

+ Docstring for + + module_attribute + + . +

+
+
+
+

+ + Class + +

+
+

+ Docstring for + + Class + + . +

+
+
+

+ + + class_attribute + + + = + + + 42 + + + + + + class-attribute + + + + + instance-attribute + + + +

+
+

+ Docstring for + + Class.class_attribute + + . +

+
+
+
+

+ + + instance_attribute + + + = + + + a + + + + + + + b + + + + + + instance-attribute + + + +

+
+

+ Docstring for + + Class.instance_attribute + + . +

+
+
+
+

+ + NestedClass + +

+
+

+ Docstring for + + NestedClass + + . +

+
+
+
+

+ + + __init__ + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.__init__ + + . +

+
+
+
+

+ + + method1 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method1 + + . +

+
+
+
+

+ + + method2 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method2 + + . +

+
+
+
+
+
+
+

+ + Subclass + +

+
+

+ Bases: + + + Class + + +

+

+ Docstring for + + Subclass + + . +

+
+
+

+ + + class_attribute + + + = + + + 42 + + + + + + class-attribute + + + + + instance-attribute + + + +

+
+

+ Docstring for + + Class.class_attribute + + . +

+
+
+
+

+ + + instance_attribute + + + = + + + a + + + + + + + b + + + + + + instance-attribute + + + +

+
+

+ Docstring for + + Class.instance_attribute + + . +

+
+
+
+

+ + NestedClass + +

+
+

+ Docstring for + + NestedClass + + . +

+
+
+
+

+ + + __init__ + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.__init__ + + . +

+
+
+
+

+ + + method1 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method1 + + . +

+
+
+
+

+ + + method2 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method2 + + . +

+
+
+
+
+
+
+

+ + + module_function + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + module_function + + . +

+
+
+
+
+
diff --git a/tests/snapshots/external/408244423577f9b2598b319118c5f4a0a495116b06ebb2877a0964d526ec18e0.html b/tests/snapshots/external/408244423577f9b2598b319118c5f4a0a495116b06ebb2877a0964d526ec18e0.html new file mode 100644 index 00000000..befa0078 --- /dev/null +++ b/tests/snapshots/external/408244423577f9b2598b319118c5f4a0a495116b06ebb2877a0964d526ec18e0.html @@ -0,0 +1,57 @@ + + +
+

+ + members_package + +

+
+

+ Docstring for the package. +

+
+
+

+ + + module_attribute + + + = + + + 42 + + + + + + module-attribute + + + +

+
+

+ Docstring for + + module_attribute + + . +

+
+
+
+
+
diff --git a/tests/snapshots/external/46daa7e60b98815685904dd397f0de19cf1a94397d2165418a4f9fec02c7b560.html b/tests/snapshots/external/46daa7e60b98815685904dd397f0de19cf1a94397d2165418a4f9fec02c7b560.html new file mode 100644 index 00000000..6f76b142 --- /dev/null +++ b/tests/snapshots/external/46daa7e60b98815685904dd397f0de19cf1a94397d2165418a4f9fec02c7b560.html @@ -0,0 +1,22 @@ + + +
+

+ + members_package + +

+
+

+ Docstring for the package. +

+
+
+
+
diff --git a/tests/snapshots/external/51d73351dc5546cefc8087b8409ebb7841c879fb48c875ff4cba6fbadee64014.html b/tests/snapshots/external/51d73351dc5546cefc8087b8409ebb7841c879fb48c875ff4cba6fbadee64014.html new file mode 100644 index 00000000..f7385cf9 --- /dev/null +++ b/tests/snapshots/external/51d73351dc5546cefc8087b8409ebb7841c879fb48c875ff4cba6fbadee64014.html @@ -0,0 +1,24 @@ + + +
+

+ + members_package + +

+
+

+ Docstring for the package. +

+
+
+
+
diff --git a/tests/snapshots/external/6abf5ddd819b832a1593ece448c90e63e13faa4376cca76b4fddc4d52a47f8b0.html b/tests/snapshots/external/6abf5ddd819b832a1593ece448c90e63e13faa4376cca76b4fddc4d52a47f8b0.html new file mode 100644 index 00000000..e649c2e7 --- /dev/null +++ b/tests/snapshots/external/6abf5ddd819b832a1593ece448c90e63e13faa4376cca76b4fddc4d52a47f8b0.html @@ -0,0 +1,24 @@ + + +
+

+ + members_package + +

+
+

+ Docstring for the package. +

+
+
+
+
diff --git a/tests/snapshots/external/6af55596d9c42d2634baadf77df6060caba2bd9c2d634576378cc18131c0efba.html b/tests/snapshots/external/6af55596d9c42d2634baadf77df6060caba2bd9c2d634576378cc18131c0efba.html new file mode 100644 index 00000000..5ca6f9fe --- /dev/null +++ b/tests/snapshots/external/6af55596d9c42d2634baadf77df6060caba2bd9c2d634576378cc18131c0efba.html @@ -0,0 +1,353 @@ + + +
+

+ + members_package + +

+
+

+ Docstring for the package. +

+
+
+

+ + + module_attribute + + + = + + + 42 + + + + + + module-attribute + + + +

+
+

+ Docstring for + + module_attribute + + . +

+
+
+
+

+ + Class + +

+
+

+ Docstring for + + Class + + . +

+
+
+

+ + + class_attribute + + + = + + + 42 + + + + + + class-attribute + + + + + instance-attribute + + + +

+
+

+ Docstring for + + Class.class_attribute + + . +

+
+
+
+

+ + + instance_attribute + + + = + + + a + + + + + + + b + + + + + + instance-attribute + + + +

+
+

+ Docstring for + + Class.instance_attribute + + . +

+
+
+
+

+ + NestedClass + +

+
+

+ Docstring for + + NestedClass + + . +

+
+
+
+

+ + + __init__ + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.__init__ + + . +

+
+
+
+

+ + + method1 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method1 + + . +

+
+
+
+

+ + + method2 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method2 + + . +

+
+
+
+
+
+
+

+ + Subclass + +

+
+

+ Bases: + + + Class + + +

+

+ Docstring for + + Subclass + + . +

+
+
+

+ + + method1 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method1 + + . +

+
+
+
+
+
+
+

+ + + module_function + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + module_function + + . +

+
+
+
+
+
diff --git a/tests/snapshots/external/6c0b7207df0351e1d5232859a5c13b72533fb8c87e5dc0e971b185f8dfe38c84.html b/tests/snapshots/external/6c0b7207df0351e1d5232859a5c13b72533fb8c87e5dc0e971b185f8dfe38c84.html new file mode 100644 index 00000000..a191cb33 --- /dev/null +++ b/tests/snapshots/external/6c0b7207df0351e1d5232859a5c13b72533fb8c87e5dc0e971b185f8dfe38c84.html @@ -0,0 +1,353 @@ + + +
+

+ + members_package + +

+
+

+ Docstring for the package. +

+
+
+

+ + + module_attribute + + + = + + + 42 + + + + + + module-attribute + + + +

+
+

+ Docstring for + + module_attribute + + . +

+
+
+
+

+ + Class + +

+
+

+ Docstring for + + Class + + . +

+
+
+

+ + + class_attribute + + + = + + + 42 + + + + + + class-attribute + + + + + instance-attribute + + + +

+
+

+ Docstring for + + Class.class_attribute + + . +

+
+
+
+

+ + + instance_attribute + + + = + + + a + + + + + + + b + + + + + + instance-attribute + + + +

+
+

+ Docstring for + + Class.instance_attribute + + . +

+
+
+
+

+ + NestedClass + +

+
+

+ Docstring for + + NestedClass + + . +

+
+
+
+

+ + + __init__ + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.__init__ + + . +

+
+
+
+

+ + + method1 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method1 + + . +

+
+
+
+

+ + + method2 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method2 + + . +

+
+
+
+
+
+
+

+ + Subclass + +

+
+

+ Bases: + + + Class + + +

+

+ Docstring for + + Subclass + + . +

+
+
+

+ + + method1 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method1 + + . +

+
+
+
+
+
+
+

+ + + module_function + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + module_function + + . +

+
+
+
+
+
diff --git a/tests/snapshots/external/6d72c524b827a2e4fd84a17b2aecfffca0d05bfa3fc38815f89836607e5a6c92.html b/tests/snapshots/external/6d72c524b827a2e4fd84a17b2aecfffca0d05bfa3fc38815f89836607e5a6c92.html new file mode 100644 index 00000000..5540be65 --- /dev/null +++ b/tests/snapshots/external/6d72c524b827a2e4fd84a17b2aecfffca0d05bfa3fc38815f89836607e5a6c92.html @@ -0,0 +1,318 @@ + + +
+

+ + members_package + +

+
+

+ Docstring for the package. +

+
+
+

+ + + module_attribute + + + = + + + 42 + + + + + + module-attribute + + + +

+
+

+ Docstring for + + module_attribute + + . +

+
+
+
+

+ + Class + +

+
+

+ Docstring for + + Class + + . +

+
+
+

+ + + class_attribute + + + = + + + 42 + + + + + + class-attribute + + + + + instance-attribute + + + +

+
+

+ Docstring for + + Class.class_attribute + + . +

+
+
+
+

+ + + instance_attribute + + + = + + + a + + + + + + + b + + + + + + instance-attribute + + + +

+
+

+ Docstring for + + Class.instance_attribute + + . +

+
+
+
+

+ + NestedClass + +

+
+

+ Docstring for + + NestedClass + + . +

+
+
+
+

+ + + __init__ + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.__init__ + + . +

+
+
+
+

+ + + method1 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method1 + + . +

+
+
+
+

+ + + method2 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method2 + + . +

+
+
+
+
+
+
+

+ + Subclass + +

+
+

+ Bases: + + + Class + + +

+

+ Docstring for + + Subclass + + . +

+
+
+
+
+
+

+ + + module_function + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + module_function + + . +

+
+
+
+
+
diff --git a/tests/snapshots/external/74e2496015e194b88a30c9d0a4d9309bf74c122d1d24aecaa4d9c9c392057d1a.html b/tests/snapshots/external/74e2496015e194b88a30c9d0a4d9309bf74c122d1d24aecaa4d9c9c392057d1a.html new file mode 100644 index 00000000..7d596388 --- /dev/null +++ b/tests/snapshots/external/74e2496015e194b88a30c9d0a4d9309bf74c122d1d24aecaa4d9c9c392057d1a.html @@ -0,0 +1,318 @@ + + +
+

+ + members_package + +

+
+

+ Docstring for the package. +

+
+
+

+ + + module_attribute + + + = + + + 42 + + + + + + module-attribute + + + +

+
+

+ Docstring for + + module_attribute + + . +

+
+
+
+

+ + Class + +

+
+

+ Docstring for + + Class + + . +

+
+
+

+ + + class_attribute + + + = + + + 42 + + + + + + class-attribute + + + + + instance-attribute + + + +

+
+

+ Docstring for + + Class.class_attribute + + . +

+
+
+
+

+ + + instance_attribute + + + = + + + a + + + + + + + b + + + + + + instance-attribute + + + +

+
+

+ Docstring for + + Class.instance_attribute + + . +

+
+
+
+

+ + NestedClass + +

+
+

+ Docstring for + + NestedClass + + . +

+
+
+
+

+ + + __init__ + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.__init__ + + . +

+
+
+
+

+ + + method1 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method1 + + . +

+
+
+
+

+ + + method2 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method2 + + . +

+
+
+
+
+
+
+

+ + Subclass + +

+
+

+ Bases: + + + Class + + +

+

+ Docstring for + + Subclass + + . +

+
+
+
+
+
+

+ + + module_function + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + module_function + + . +

+
+
+
+
+
diff --git a/tests/snapshots/external/80399c502938940d34e928b35648146970dc524534fe2e7f7127ccb32e3067d0.html b/tests/snapshots/external/80399c502938940d34e928b35648146970dc524534fe2e7f7127ccb32e3067d0.html new file mode 100644 index 00000000..e40923d9 --- /dev/null +++ b/tests/snapshots/external/80399c502938940d34e928b35648146970dc524534fe2e7f7127ccb32e3067d0.html @@ -0,0 +1,55 @@ + + +
+

+ + members_package + +

+
+

+ Docstring for the package. +

+
+
+

+ + + module_attribute + + + = + + + 42 + + + + + + module-attribute + + + +

+
+

+ Docstring for + + module_attribute + + . +

+
+
+
+
+
diff --git a/tests/snapshots/external/9dab67183389335dadba724875c80c49909904aa135e65c6c411c3a903d458da.html b/tests/snapshots/external/9dab67183389335dadba724875c80c49909904aa135e65c6c411c3a903d458da.html new file mode 100644 index 00000000..12da79f0 --- /dev/null +++ b/tests/snapshots/external/9dab67183389335dadba724875c80c49909904aa135e65c6c411c3a903d458da.html @@ -0,0 +1,22 @@ + + +
+

+ + members_package + +

+
+

+ Docstring for the package. +

+
+
+
+
diff --git a/tests/snapshots/external/a255ee80bf7a569ab3aa55ea94af24ce6671dace3d6075df5d14a3ff428ceb8b.html b/tests/snapshots/external/a255ee80bf7a569ab3aa55ea94af24ce6671dace3d6075df5d14a3ff428ceb8b.html new file mode 100644 index 00000000..1973e99b --- /dev/null +++ b/tests/snapshots/external/a255ee80bf7a569ab3aa55ea94af24ce6671dace3d6075df5d14a3ff428ceb8b.html @@ -0,0 +1,318 @@ + + +
+

+ + members_package + +

+
+

+ Docstring for the package. +

+
+
+

+ + + module_attribute + + + = + + + 42 + + + + + + module-attribute + + + +

+
+

+ Docstring for + + module_attribute + + . +

+
+
+
+

+ + Class + +

+
+

+ Docstring for + + Class + + . +

+
+
+

+ + + class_attribute + + + = + + + 42 + + + + + + class-attribute + + + + + instance-attribute + + + +

+
+

+ Docstring for + + Class.class_attribute + + . +

+
+
+
+

+ + + instance_attribute + + + = + + + a + + + + + + + b + + + + + + instance-attribute + + + +

+
+

+ Docstring for + + Class.instance_attribute + + . +

+
+
+
+

+ + NestedClass + +

+
+

+ Docstring for + + NestedClass + + . +

+
+
+
+

+ + + __init__ + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.__init__ + + . +

+
+
+
+

+ + + method1 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method1 + + . +

+
+
+
+

+ + + method2 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method2 + + . +

+
+
+
+
+
+
+

+ + Subclass + +

+
+

+ Bases: + + + Class + + +

+

+ Docstring for + + Subclass + + . +

+
+
+
+
+
+

+ + + module_function + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + module_function + + . +

+
+
+
+
+
diff --git a/tests/snapshots/external/b4e20d5cd52e746cc7473537a2318a9ad886c5d8d8654c8d4f85fe209b04d86b.html b/tests/snapshots/external/b4e20d5cd52e746cc7473537a2318a9ad886c5d8d8654c8d4f85fe209b04d86b.html new file mode 100644 index 00000000..39cf1b20 --- /dev/null +++ b/tests/snapshots/external/b4e20d5cd52e746cc7473537a2318a9ad886c5d8d8654c8d4f85fe209b04d86b.html @@ -0,0 +1,318 @@ + + +
+

+ + members_package + +

+
+

+ Docstring for the package. +

+
+
+

+ + + module_attribute + + + = + + + 42 + + + + + + module-attribute + + + +

+
+

+ Docstring for + + module_attribute + + . +

+
+
+
+

+ + Class + +

+
+

+ Docstring for + + Class + + . +

+
+
+

+ + + class_attribute + + + = + + + 42 + + + + + + class-attribute + + + + + instance-attribute + + + +

+
+

+ Docstring for + + Class.class_attribute + + . +

+
+
+
+

+ + + instance_attribute + + + = + + + a + + + + + + + b + + + + + + instance-attribute + + + +

+
+

+ Docstring for + + Class.instance_attribute + + . +

+
+
+
+

+ + NestedClass + +

+
+

+ Docstring for + + NestedClass + + . +

+
+
+
+

+ + + __init__ + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.__init__ + + . +

+
+
+
+

+ + + method1 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method1 + + . +

+
+
+
+

+ + + method2 + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + Class.method2 + + . +

+
+
+
+
+
+
+

+ + Subclass + +

+
+

+ Bases: + + + Class + + +

+

+ Docstring for + + Subclass + + . +

+
+
+
+
+
+

+ + + module_function + + + ( + + + a + + + , + + + b + + + ) + + +

+
+

+ Docstring for + + module_function + + . +

+
+
+
+
+
diff --git a/tests/snapshots/external/d56d3aeae22be9b2494a085b812f0a3a5fabdbef184198de0462a0b944393891.html b/tests/snapshots/external/d56d3aeae22be9b2494a085b812f0a3a5fabdbef184198de0462a0b944393891.html new file mode 100644 index 00000000..c8211de8 --- /dev/null +++ b/tests/snapshots/external/d56d3aeae22be9b2494a085b812f0a3a5fabdbef184198de0462a0b944393891.html @@ -0,0 +1,55 @@ + + +
+

+ + members_package + +

+
+

+ Docstring for the package. +

+
+
+

+ + + module_attribute + + + = + + + 42 + + + + + + module-attribute + + + +

+
+

+ Docstring for + + module_attribute + + . +

+
+
+
+
+
diff --git a/tests/snapshots/external/e254ae60f9af14754001bc63b74a3c473f5198cf2a58f4d30ad6d5a4c196e67c.html b/tests/snapshots/external/e254ae60f9af14754001bc63b74a3c473f5198cf2a58f4d30ad6d5a4c196e67c.html new file mode 100644 index 00000000..7b0e60a5 --- /dev/null +++ b/tests/snapshots/external/e254ae60f9af14754001bc63b74a3c473f5198cf2a58f4d30ad6d5a4c196e67c.html @@ -0,0 +1,55 @@ + + +
+

+ + members_package + +

+
+

+ Docstring for the package. +

+
+
+

+ + + module_attribute + + + = + + + 42 + + + + + + module-attribute + + + +

+
+

+ Docstring for + + module_attribute + + . +

+
+
+
+
+
diff --git a/tests/snapshots/external/ed5d07bcdbaa3f295c0cb1544d54b196728ed6c70f4d6c902991baca6f16193c.html b/tests/snapshots/external/ed5d07bcdbaa3f295c0cb1544d54b196728ed6c70f4d6c902991baca6f16193c.html new file mode 100644 index 00000000..85cb268c --- /dev/null +++ b/tests/snapshots/external/ed5d07bcdbaa3f295c0cb1544d54b196728ed6c70f4d6c902991baca6f16193c.html @@ -0,0 +1,22 @@ + + +
+

+ + members_package + +

+
+

+ Docstring for the package. +

+
+
+
+
diff --git a/tests/snapshots/external/f48d651b3f1a2ce91910e05f4c3f7a7ec95e7d0e88d4503f101610d74029ce23.html b/tests/snapshots/external/f48d651b3f1a2ce91910e05f4c3f7a7ec95e7d0e88d4503f101610d74029ce23.html new file mode 100644 index 00000000..e8f0258e --- /dev/null +++ b/tests/snapshots/external/f48d651b3f1a2ce91910e05f4c3f7a7ec95e7d0e88d4503f101610d74029ce23.html @@ -0,0 +1,22 @@ + + +
+

+ + members_package + +

+
+

+ Docstring for the package. +

+
+
+
+
diff --git a/tests/test_end_to_end.py b/tests/test_end_to_end.py index 6b6b6401..7a26cb53 100644 --- a/tests/test_end_to_end.py +++ b/tests/test_end_to_end.py @@ -149,7 +149,7 @@ class Subclass(Class): @pytest.mark.parametrize("inherited_members", [(), ("method1",), True, False]) @pytest.mark.parametrize("members", [(), ("module_attribute",), True, False, None]) -@pytest.mark.parametrize("filters", [(), ("!module_attribute",), ("module_attribute",), None]) +@pytest.mark.parametrize("filters", [(), ("!module_attribute",), ("module_attribute",), "public", None]) def test_end_to_end_for_members( session_handler: PythonHandler, members_package: TmpPackage,