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

asterisk in first position in Python function signature is dropped #328

Closed
dhalbert opened this issue Feb 21, 2022 · 3 comments
Closed

asterisk in first position in Python function signature is dropped #328

dhalbert opened this issue Feb 21, 2022 · 3 comments

Comments

@dhalbert
Copy link

Python 3.9.10
sphinx-autoapi: 1.8.4
Sphinx: 4.4.0
astroid: 2.9.3

The asterisk keyword indicator in a Python function argument list is being dropped in the generated documentation, if it occurs before any other arguments.

module.py:

def f(*, a, b):
    """f function"""
    pass

def g(a, *, b):
    """g function"""
    pass

generates the HTML below. Note the missing (*, .

Is this an astroid parsing problem? Should I/you file an issue there? Thanks.

Here are all the build files:
sigs.zip

image

@dhalbert
Copy link
Author

dhalbert commented Mar 1, 2022

I looked at the output of astroid for parsing these simple cases, and it looks OK.

@jepler
Copy link
Contributor

jepler commented May 31, 2022

This adds a (failing) test for the problem:

diff --git a/tests/test_astroid_utils.py b/tests/test_astroid_utils.py
index 823dbbb..2402f5e 100644
--- a/tests/test_astroid_utils.py
+++ b/tests/test_astroid_utils.py
@@ -181,6 +181,13 @@ class TestAstroidUtils:
                     sys.version_info[:2] < (3, 8), reason="Uses Python 3.8+ syntax"
                 ),
             ),
+            pytest.param(
+                "*, a: int, b: int",
+                "*, a: int, b: int",
+                marks=pytest.mark.skipif(
+                    sys.version_info[:2] < (3, 8), reason="Uses Python 3.8+ syntax"
+                ),
+            ),
             ("a: int, *args, b: str, **kwargs", "a: int, *args, b: str, **kwargs"),
             ("a: 'A'", "a: A"),
         ],

jepler added a commit to jepler/sphinx-autoapi that referenced this issue May 31, 2022
jepler added a commit to jepler/sphinx-autoapi that referenced this issue May 31, 2022
@jepler
Copy link
Contributor

jepler commented May 31, 2022

btw we encountered this 'in the wild': adafruit/circuitpython#6072 (comment)

jepler added a commit to jepler/circuitpython that referenced this issue Jul 25, 2022
readthedocs/sphinx-autoapi#328 has been fixed
and released in version 1.9.0 on pypi.  This version should
automatically be picked up, as we use unversioned dependencies on the
package.
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue May 6, 2023
v2.1.0 (2023-03-28)
-------------------

Deprecations and Removals
^^^^^^^^^^^^^^^^^^^^^^^^^

- Support for documenting languages other than Python is deprecated. (#248)
- Removed the option to have autoapi generate toctree entries for domain objects.
  Domain objects are now added to the toctree by Sphinx.
  Dropped support for sphinx < 5.2.0. (#369)


Misc
^^^^

- Added basic type checking.
- Integrated towncrier into the release workflow.


v2.0.1 (2023-01-16)
-------------------

Features
^^^^^^^^
- Can turn off the addition of documented objects to the TOC tree.
- Added support for Python 3.11.

Bug Fixes
^^^^^^^^^
- `#330 <https://github.com/readthedocs/sphinx-autoapi/issues/330>`: (Python)
  Render tuple values as tuples, not lists.
- `#341 <https://github.com/readthedocs/sphinx-autoapi/issues/341>`: (Python)
  Fix module level assignments to class attributes being documented as
  module level attributes.
- (Python) Fix "bysource" sort order showing items in alphabetical order.
- (Python) Use the correct directives for a variable type and value.

Trivial/Internal Changes
^^^^^^^^^^^^^^^^^^^^^^^^
- Removed some autogenerated test data from the repository.


v2.0.0 (2022-09-27)
-------------------

Breaking Changes
^^^^^^^^^^^^^^^^

- Dropped support for Sphinx <4.
- `#352 <https://github.com/readthedocs/sphinx-autoapi/issues/352>`: (Python)
  Properties are rendered with the ``property`` directive,
  fixing support for Sphinx 5.2.
  A new ``PythonPythonMapper`` object (``PythonProperty``) has been created
  to support this change. This object can be passed to templates, filters,
  and hooks.
  A new ``property.rst`` template has also been created to support this change.

Trivial/Internal Changes
^^^^^^^^^^^^^^^^^^^^^^^^
- Use https links where possible in documentation.
- Pass correct argument types to ``status_iterator``.


V1.9.0 (2022-07-25)
-------------------

Breaking Changes
^^^^^^^^^^^^^^^^

- Dropped support for Python 3.6.

Features
^^^^^^^^

- Added support for Python 3.10.
- `#222 <https://github.com/readthedocs/sphinx-autoapi/issues/222>`:
  Marked extension as parallel read safe.

Bug Fixes
^^^^^^^^^
- `#324 <https://github.com/readthedocs/sphinx-autoapi/issues/324>`: (Python)
  Fail elegantly when no source files are found.
- (Python) Stop calling ``autodoc-process-docstring`` when docstring is empty.
  Works around sphinx-doc/sphinx#10701.
- `#318 <https://github.com/readthedocs/sphinx-autoapi/issues/318>`: (Python)
  Fixed misaligned argument types on methods/classmethods when using type comments.
- `#278 <https://github.com/readthedocs/sphinx-autoapi/issues/278>`: (Python)
  Limit signatures to 60 characters in summaries.
- Fix keyerror when using markdown sources.
- `#328 <https://github.com/readthedocs/sphinx-autoapi/issues/328>`: (Python)
  Fix kw-only marker getting ignored if first in the signature.

Trivial/Internal Changes
^^^^^^^^^^^^^^^^^^^^^^^^
- Fixed tests in Sphinx 5.
- Fixed many typos throughout the documentation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants